I was just trying to create a (basic) music player to discover SB, but when I use the OpenFileRequester() function, it gives me only the name of the file by using both SelectedFileName() and SelectedFileID()

Code: Select all
;
InitSound()
Procedure Play()
PlaySound(0)
EndProcedure
Procedure RequesterSuccess()
; Process all the selected filename
;
While NextSelectedFile()
Debug "Filename: " + SelectedFileName()
LoadSound(0,SelectedFileID())
Debug "Loading the sound..."
Wend
EndProcedure
Procedure Open()
OpenFileRequester("", @RequesterSuccess(), #PB_Requester_MultiSelection)
EndProcedure
Procedure Start()
If OpenWindow(0, 0, 0, 200, 90, "Sound example", #PB_Window_TitleBar | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 180, 30, "Play")
ButtonGadget(1, 10, 50, 180, 30, "Open")
BindGadgetEvent(0, @Play())
BindGadgetEvent(1, @Open())
EndIf
EndProcedure
Procedure Loading(Type, Filename$, ObjectId)
Static NbLoadedElements
Debug Filename$ + " loaded (id = " + ObjectId + ")"
NbLoadedElements+1
If NbLoadedElements = 1 ; Finished the loading of all sounds, we can start the application
If IsSound(0)
Debug "Ok, sound loaded."
Else
Debug "Error !" ;This always happends...
EndIf
Start()
EndIf
EndProcedure
Procedure LoadingError(Type, Filename$)
Debug Filename$ + ": loading error"
EndProcedure
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loading())
BindEvent(#PB_Event_LoadingError, @LoadingError())
LoadSound(0, "Data/Lazer.wav")