Jump to content

Chip-It


mrbond007
 Share

Recommended Posts

  • Administrators

Where in the world did you ever find them called chips? They are modules.

http://en.wikipedia.org/wiki/Module_file

Initially they were sythed (Commodore C64) but it's still used to describe the "sound". They still have competitions today for writing the best chip tune that only uses < 1KB of samples :P The fact they they are usually stored in modules now is fairly unimportant.
Link to comment
Share on other sites

  • 2 months later...

Hey everyone!

Has anyone have had problems trying to play mo3 files? Looking at Chip-it (and Bassmod) it looks like it's a supported file type, but when I try to play it in Chip-It the "current position" counter goes to "65335.-[" and the song length is "0-1:000". The file never plays.

I've included a sample MO3 file zipped.

Maximilian___Steam.zip

Link to comment
Share on other sites

Hey everyone!

Has anyone have had problems trying to play mo3 files? Looking at Chip-it (and Bassmod) it looks like it's a supported file type, but when I try to play it in Chip-It the "current position" counter goes to "65335.-[" and the song length is "0-1:000". The file never plays.

I've included a sample MO3 file zipped.

The bassmod plugin doesn't play mo3 tunes. I forgot to remove the file type.

My bad

Link to comment
Share on other sites

hi

has anyone played other filetypes with the "bass.dll" ?

i would like to play mp3 files with the "bass.dll" , but so far i failed on loading / playing them ..

any ideas?

tnx

shouldn't be too hard, did you read the documentation? there are example which can be translated to AutoIT

Opt("GUIOnEventMode", 1)

$Bass_Dll = DllOpen("bass.dll")
$File_Name = DllStructCreate("char[255]")
DllStructSetData($File_Name, 1, "test.mp3")
$DoIT = DllCall($Bass_Dll, "int", "BASS_Init", "int", -1, _
                                "int", 44100, _
                                "int", 0, _
                                "hwnd", 0, _
                                "ptr", 0)
$DoIT = DllCall($Bass_Dll, "int", "BASS_StreamCreateFile", "int", False, _
                                "ptr", DllStructGetPtr($File_Name), _
                                "int", 0, _
                                "int", 0, _
                                "int", 0)
DllCall($Bass_Dll, "int", "BASS_ChannelPlay", "int", $DoIT[0], "int", 0)
;DllCall($Bass_Dll, "int", "BASS_ChannelStop", "int", $DoIT[0])
While 1
    Sleep(100)
WEnd

Func OnAutoItExit()
    DllCall($Bass_Dll, "int", "BASS_StreamFree", "int", $DoIT[0])
    DllClose($Bass_Dll)
EndFunc

for chiptunes use BASS_MusicLoad() & BASS_MusicFree()

Link to comment
Share on other sites

I should really go to the second page before replying to something on the first :)

Edited by Gondus

-----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran

Link to comment
Share on other sites

@mrbond

thanks alot ,

well yes i read the documentation to bass, but i didnt know how i could translate it into dll calls

it looks easy when its working now :-)

although i still have troubles getting the position of the playback in seconds ( the channel bytes seem to work? )

Opt("GUIOnEventMode", 1)

$Bass_Dll = DllOpen("bass.dll")
$File_Name = DllStructCreate("char[255]")
DllStructSetData($File_Name, 1, "test.mp3")



$ret = DllCall($Bass_Dll, "int", "BASS_Free")
_DebugPrint("free " & $ret[0])

$DoIT = DllCall($Bass_Dll, "int", "BASS_Init", "int", -1, _
        "int", 44100, _
        "int", 0, _
        "hwnd", 0, _
        "ptr", 0)
_DebugPrint("bass init " & $DoIT[0])

$DoIT = DllCall($Bass_Dll, "int", "BASS_StreamCreateFile", "int", False, _
        "ptr", DllStructGetPtr($File_Name), _
        "int", 0, _
        "int", 0, _
        "int", 0)

$stream = $DoIT[0];
_DebugPrint("stream init " & $stream)

$ret = DllCall($Bass_Dll, "int", "BASS_ChannelPlay", "int", $stream, "int", 0)
;DllCall($Bass_Dll, "int", "BASS_ChannelStop", "int", $DoIT[0])
_DebugPrint("channel play " & $ret)


While 1

    ;QWORD      pos=BASS_ChannelGetPosition(strs[s]);
    ;DWORD   time=BASS_ChannelBytes2Seconds(strs[s],pos); // chan,pos
    ;float BASS_ChannelBytes2Seconds(    DWORD handle,    QWORD pos);

    ; doesnt work?
    $c = DllCall($Bass_Dll, "int", "BASS_GetCPU");
    _DebugPrint(" cpu " & Int($c[0]))

    ; works ..
    $p = DllCall($Bass_Dll, "int", "BASS_ChannelGetPosition", "int", $stream);
    $pos = $p[0]; -- will be 64 bit ?
    _DebugPrint("pos  " & $pos)

    ; autoit exits.. with error -- or gives NO result == 0 ???
    
;; ---> ??  
    $sec = DllCall($Bass_Dll, "int", "BASS_ChannelBytes2Seconds", "int", $stream, "qword", $pos);
    _DebugPrint(" sec " & Int($sec))

    Sleep(500)
WEnd

Func OnAutoItExit()
    DllCall($Bass_Dll, "int", "BASS_StreamFree", "int", $DoIT[0])
    DllClose($Bass_Dll)
EndFunc   ;==>OnAutoItExit


;
; prints on scite output window
;
Func _DebugPrint($s_text)
    $s_text = StringReplace($s_text, @LF, @LF & "-")
    ConsoleWrite($s_text & @LF); & _
EndFunc   ;==>_DebugPrint
Edited by nobbe
Link to comment
Share on other sites

I'm very new to using dll's in AutoIt. I keep getting errors with the following code. Do you know what I am doing wrong?

Opt("GUIOnEventMode", 1)

$Bass_Dll = DllOpen("bass.dll")
$File_Name = DllStructCreate("char[255]")
DllStructSetData($File_Name, 1, "chip.mo3")
$DoIT = DllCall($Bass_Dll, "int", "BASS_Init", "int", -1, _
                                "int", 44100, _
                                "int", 0, _
                                "hwnd", 0, _
                                "ptr", 0)
$DoIT = DllCall($Bass_Dll, "int", "BASS_MusicLoad", "int", False, _
                                "ptr", DllStructGetPtr($File_Name), _
                                "int", 0, _
                                "int", 0, _
                                "int", 0)
DllCall($Bass_Dll, "int", "BASS_ChannelPlay", "int", $DoIT[0], "int", 0)
;DllCall($Bass_Dll, "int", "BASS_ChannelStop", "int", $DoIT[0])
While 1
    Sleep(100)
WEnd

Func OnAutoItExit()
    DllCall($Bass_Dll, "int", "BASS_MusicFree", "int", $DoIT[0])
    DllClose($Bass_Dll)
EndFunc
Link to comment
Share on other sites

@mrbond

thanks alot ,

well yes i read the documentation to bass, but i didnt know how i could translate it into dll calls

it looks easy when its working now :-)

although i still have troubles getting the position of the playback in seconds ( the channel bytes seem to work? )

the BASS_ChannelBytes2Seconds() needs a QWORD type which i think isn't supported by AutoIt

Opt("GUIOnEventMode", 1)

$Bass_Dll = DllOpen("bass.dll")
$File_Name = DllStructCreate("char[255]")
DllStructSetData($File_Name, 1, "test.mp3")
$DoIT = DllCall($Bass_Dll, "int", "BASS_Init", "int", -1, _
                                "int", 44100, _
                                "int", 0, _
                                "hwnd", 0, _
                                "ptr", 0)

$DoIT = DllCall($Bass_Dll, "int", "BASS_StreamCreateFile", "int", False, _
                                "ptr", DllStructGetPtr($File_Name), _
                                "int", 0, _
                                "int", 0, _
                                "int", 0)
DllCall($Bass_Dll, "int", "BASS_ChannelPlay", "int", $DoIT[0], "int", 0)
While 1
    Sleep(100)
    $tip = DllCall($Bass_Dll, "int", "BASS_ChannelGetPosition", "dword", $DoIT[0])
;$pos = DllCall($Bass_Dll, "int", "BASS_ChannelBytes2Seconds", "dword", $DoIT[0], "qword", $tip[0])
    $cpu = DllCall($Bass_Dll, "float", "BASS_GetCPU")
    $Format = StringFormat("%02f", $cpu[0])
    ToolTip($tip[0] & @CRLF & "CPU : " & $Format & "%", 10, 10)
WEnd

Func OnAutoItExit()
    DllCall($Bass_Dll, "int", "BASS_StreamFree", "int", $DoIT[0])
    DllClose($Bass_Dll)
EndFunc
Link to comment
Share on other sites

I'm very new to using dll's in AutoIt. I keep getting errors with the following code. Do you know what I am doing wrong?

Opt("GUIOnEventMode", 1)

$Bass_Dll = DllOpen("bass.dll")
$File_Name = DllStructCreate("char[255]")
DllStructSetData($File_Name, 1, "chip.mo3")
$DoIT = DllCall($Bass_Dll, "int", "BASS_Init", "int", -1, _
                                "int", 44100, _
                                "int", 0, _
                                "hwnd", 0, _
                                "ptr", 0)
$DoIT = DllCall($Bass_Dll, "int", "BASS_MusicLoad", "int", False, _
                                                    "ptr", DllStructGetPtr($File_Name), _
                                                    "int", 0, _
                                                    "int", 0, _
                                                    "int", 0x200, _
                                                    "int", 0)
DllCall($Bass_Dll, "int", "BASS_ChannelPlay", "int", $DoIT[0], "int", 0)
;DllCall($Bass_Dll, "int", "BASS_ChannelStop", "int", $DoIT[0])
While 1
    Sleep(100)
WEnd

Func OnAutoItExit()
    DllCall($Bass_Dll, "int", "BASS_MusicFree", "int", $DoIT[0])
    DllClose($Bass_Dll)
EndFunc
Link to comment
Share on other sites

  • 4 months later...

I'm ashamed to ask this, but is there a easy way to Zedna resource udf to include the dll and chiptune easily?

http://www.autoitscript.com/forum/index.ph...;hl=compression

I have this, but as you could easily see I don't know where to start.

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, 2.xm, rcdata, TEST_XM_1, 0

#include "resources.au3"

$hBmp = _ResourceGet("TEST_XM", $RT_RCDATA)

If FileExists("BASSMOD.dll") Then
$bassdll = DllOpen("BASSMOD.dll")
$Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)
$Name_H = DllStructCreate("char[255]")
DllStructSetData($Name_H, 1, "$hBmp")
;DllStructSetData($hBmp,")
$Lod = DllCall($bassdll, "int", "BASSMOD_MusicLoad", "int", 0, _
                "ptr", DllStructGetPtr($Name_H), _
                "int", 0, _
                "int", 0, _
                "int", 1028)
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicPlay", "int", $Init[0])
EndIf

While 1
    $msg = GUIGetMsg()
    IF $msg = -3 Then Exit
WEnd

Func OnAutoItExit()
    If Not (FileExists("BASSMOD.DLL")) Then
        Exit
    Else
        DllCall($bassdll, "int:cdecl", "BASSMOD_MusicFree", "int", $Init[0])
        DllClose($bassdll)
    EndIf
EndFunc
Link to comment
Share on other sites

Nothing to be ashamed off, you can include the chiptune as part of the exe resource, but you can't do the same for the dll use FileInstall instead.

First put 2.xm and resource.au3 in the same directory.

Second change the last line in _ResourceGetAsString() :

Func _ResourceGetAsString($ResName, $ResType = 10, $ResLang = 0, $DLL = -1); $RT_RCDATA = 10
    Local $ResPointer, $ResSize, $struct

    $ResPointer = _ResourceGet($ResName, $ResType, $ResLang, $DLL)
    If @error Then
        SetError(1, 0, 0)
        Return ''
    EndIf
    $ResSize = @extended
    $struct = DllStructCreate("char[" & $ResSize & "]", $ResPointer)
;   Return DllStructGetData($struct, 1); returns string
    Return DllStructGetPtr($struct, 1); returns pointer
EndFunc

Third you may have to put ResourceHacker executable (ResHacker.exe) in the same directory as your script (in my case, i was forced to).

Fourth copy, paste and save this example inside Scite :

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, 2.xm, rcdata, TEST_XM_1, 0
#include "resources.au3"

Global $bassdll = DllOpen("BASSMOD.dll"), $Init[1]
$string = _ResourceGetAsString("TEST_XM_1")

If FileExists("BASSMOD.dll") Then
    $Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)
    $Lod = DllCall($bassdll, "int", "BASSMOD_MusicLoad", _
                             "int", True, _
                             "ptr", $string, _
                             "int", 0, _
                             "int", 0, _
                             "int", 1028)
    DllCall($bassdll, "int", "BASSMOD_MusicPlay")
EndIf

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit
WEnd

Func OnAutoItExit()
    If Not (FileExists("BASSMOD.DLL")) Then
        Exit
    Else
        DllCall($bassdll, "int", "BASSMOD_MusicFree")
        DllClose($bassdll)
    EndIf
EndFunc

While still inside Scite press CTRL+F7, compile and it's ready.

Note that bassmod documentation says that if you want to load a file from memory the first parameter must be set to True (or 1). In the earlier example we set it to False, and we loaded the chiptune from the harddrive.

Link to comment
Share on other sites

  • 4 months later...

Nothing to be ashamed off, you can include the chiptune as part of the exe resource, but you can't do the same for the dll use FileInstall instead.

First put 2.xm and resource.au3 in the same directory.

Second change the last line in _ResourceGetAsString() :

Func _ResourceGetAsString($ResName, $ResType = 10, $ResLang = 0, $DLL = -1); $RT_RCDATA = 10
       Local $ResPointer, $ResSize, $struct
   
       $ResPointer = _ResourceGet($ResName, $ResType, $ResLang, $DLL)
       If @error Then
           SetError(1, 0, 0)
           Return ''
       EndIf
       $ResSize = @extended
       $struct = DllStructCreate("char[" & $ResSize & "]", $ResPointer)
  ; Return DllStructGetData($struct, 1); returns string
       Return DllStructGetPtr($struct, 1); returns pointer
   EndFunc

Third you may have to put ResourceHacker executable (ResHacker.exe) in the same directory as your script (in my case, i was forced to).

Fourth copy, paste and save this example inside Scite :

#AutoIt3Wrapper_UseUpx=n
   #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, 2.xm, rcdata, TEST_XM_1, 0
   #include "resources.au3"
   
   Global $bassdll = DllOpen("BASSMOD.dll"), $Init[1]
   $string = _ResourceGetAsString("TEST_XM_1")
   
   If FileExists("BASSMOD.dll") Then
       $Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)
       $Lod = DllCall($bassdll, "int", "BASSMOD_MusicLoad", _
                                "int", True, _
                                "ptr", $string, _
                                "int", 0, _
                                "int", 0, _
                                "int", 1028)
       DllCall($bassdll, "int", "BASSMOD_MusicPlay")
   EndIf
   
   While 1
       $msg = GUIGetMsg()
       If $msg = -3 Then Exit
   WEnd
   
   Func OnAutoItExit()
       If Not (FileExists("BASSMOD.DLL")) Then
           Exit
       Else
           DllCall($bassdll, "int", "BASSMOD_MusicFree")
           DllClose($bassdll)
       EndIf
   EndFunc

While still inside Scite press CTRL+F7, compile and it's ready.

Note that bassmod documentation says that if you want to load a file from memory the first parameter must be set to True (or 1). In the earlier example we set it to False, and we loaded the chiptune from the harddrive.

I tried to use BASSMOD.DLL using MemoryDLL.au3 but I cannot hear any sound!

Is it even possible to play chiptune (BassMod.dll) using MemoryDLL.au3?

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...