Ich hab vor längerer Zeit mal was mit Hilfe der nezplay.dll gebastelt. Leider hab ich jetzt auf Anhieb die Seite nicht mehr gefunden, wo die her stammt. Einfach mal googeln...
Wie dem auch sei, hier ist ein mehr oder weniger gutes Beispiel zur Benutzung. Leider nicht kommentiert, zur Not einfach nachfragen.
Code: Alles auswählen
Global Nummer, max
Nummer = 1
If OpenLibrary(0, "npnez.dll")
*GB_Version = GetFunction(0, "_HSPNEZVersion@16")
*GB_Open= GetFunction(0,"_HSPNSFOpen@16")
*GB_Open_Mem = GetFunction(0, "_HSPNSFOpenMemory@16")
*GB_Close = GetFunction(0, "_HSPNSFClose@16")
*GB_Song_No = GetFunction(0, "_HSPNSFSongNo@16")
*GB_Volume = GetFunction(0, "_HSPNSFVolume@16")
*GB_Stop = GetFunction(0, "_HSPNSFStop@16")
*GB_Play = GetFunction(0, "_HSPNSFPlay@16")
*GB_Play_Ex = GetFunction(0, "_HSPNSFPlayEx@16")
*GB_Play_Dx = GetFunction(0, "_HSPNSFPlayDXEx@16")
*GB_Clean = GetFunction(0, "_HSPNSFClean@16")
*GB_GetSongstart = GetFunction(0, "_HSPNSFGetSongStart@16")
*GB_GetSongMax = GetFunction(0, "_HSPNSFGetSongMax@16")
*GB_GetChannel = GetFunction(0, "_HSPNSFGetChannel@16")
*GB_GetFileInfo = GetFunction(0, "_HSPNSFGetFileInfo@16")
*GB_GetFileInfoDlg = GetFunction(0, "_HSPNSFOpenFileInfoDlg@16")
CallFunctionFast(*GB_Open_Mem,?GBS,?GBSEnd-?GBS,0,0)
max=CallFunctionFast(*GB_GetSongMax,0,0,0,0)
CallFunctionFast(*GB_Song_No,Nummer,0,0,0)
CallFunctionFast(*GB_Play,@music,0,0,0)
Title.s=PeekS(?GBS+$10)
Author.s=PeekS(?GBS+$30)
Copyright.s=PeekS(?GBS+$50)
If OpenConsole()
EnableGraphicalConsole(1)
PrintN("Gameboy music replayer.")
PrintN("")
PrintN("")
PrintN("")
PrintN("Title: "+title.s)
PrintN("Author: "+author.s)
PrintN("Copyright: "+copyright.s)
PrintN("")
PrintN("")
PrintN("Press ESC To exit...")
Repeat
ConsoleLocate(0,2)
PrintN("Song "+Str(nummer)+" von "+Str(Abs(max)))
KeyPressed$ = Inkey()
Delay(20)
If KeyPressed$ = Chr(120)
If Nummer< Abs(max) : Nummer+1 : EndIf
CallFunctionFast(*GB_Song_No,Nummer,0,0,0)
CallFunctionFast(*GB_Play,@music,0,0,0)
EndIf
If KeyPressed$ = Chr(121)
If Nummer > 1 : Nummer-1 : EndIf
CallFunctionFast(*GB_Song_No,Nummer,0,0,0)
CallFunctionFast(*GB_Play,?GBS,0,0,0)
EndIf
Until KeyPressed$ = Chr(27)
EndIf
EndIf
CloseLibrary(0)
DataSection
GBS: IncludeBinary "mario.gbs"
GBSEnd:
Die DLL samt Beispielsound und obiges Testprogramm gibt's hier:
http://tiny.cc/t049u
Mit X und Y (dt. Keyboard) kann man die Subsongs wechseln. Getestet wurde es mit PB4.41.
Gruß, Pad
