What boneheaded thing have I forgotten this time?
The code after it is the PureBasic example which play my wave file quite well.
Code: Select all
Enumeration
#SndStandard
EndEnumeration
If InitSound() <> 0
Debug "Sound environment okay"
If CatchSound(#SndStandard, ?_SndStandard) <> 0
Debug "Loaded the sound from the data section"
Debug IsSound(#SndStandard)
If PlaySound(#SndStandard, #PB_Sound_Loop) <> 0
Debug "Playing the sound, I hope"
Else
Debug "Could not play the sound"
EndIf
Else
Debug "Could not load sound from the datasection"
EndIf
Else
Debug "Sound environment stuffed"
EndIf
DataSection
_SndStandard: : IncludeBinary "tng-doorbell.wav"
EndDataSection
MessageRequester("Error", "Sound system is not available", 0)
End
EndIf
Code: Select all
SoundFileName$ = OpenFileRequester("Choose a .wav file", "", "Wave files|*.wav",0)
If SoundFileName$
If LoadSound(0, SoundFileName$)
PlaySound(0, #PB_Sound_Loop)
MessageRequester("Sound", "Playing the sound (loop)..."+#LF$+"Click to quit..", 0)
Else
MessageRequester("Error", "Can't load the sound.", 0)
EndIf
EndIf
End