I think it's because other formats.. THey can all be PCM, but one of them may be RIFF or something else. It can also be that PureBasic's sound library can't play the file.
Try to play the file with this code: (I made this with hurry!)
Code: Select all
Procedure.s GetShortFileName(LongFileName$)
Static ShortPathName$, RetVal, iLen
ShortPathName$ = Space(256)
iLen = Len(ShortPathName$)
RetVal = GetShortPathName_(LongFileName$, ShortPathName$, iLen)
ShortFileName$ = Left(ShortPathName$, RetVal)
ProcedureReturn ShortFileName$
EndProcedure
Procedure MCI_OpenWaveFile(Alias$, FileName$)
ShortName$=GetShortFileName(FileName$)
Command=mciSendString_("open "+Chr(34)+FileName$+Chr(34)+" type waveaudio alias "+Alias$, 0, 0, 0)
If Command=0
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
Procedure MCI_Close(Alias$)
ProcedureReturn mciSendString_("close " + Alias$, 0, 0, 0)
EndProcedure
Procedure MCI_Play(Alias$, Loop)
If Loop>=1
Command=mciSendString_("play "+Alias$+" repeat", 0, 0, 0)
ElseIf Loop<=0
Command=mciSendString_("play "+Alias$, 0, 0, 0)
EndIf
ProcedureReturn Command
EndProcedure
Sound$=OpenFileRequester("","","Wave|*.wav",0)
MCI_OpenWaveFile("MySound", Sound$)
MCI_Play("MySound", 1)
MessageRequester("Mini-Media PLayer", "Currently playing: "+GetFilePart(Sound$))
MCI_Close("MySound") ; Never forget to close the file or the computer will hang.