Ok, here's a sound lib:
I got the explosion sound to test with from here:
http://www.sosbbs.com/~rwbenjamin/waveS.htm
http://www.sosbbs.com/~rwbenjamin/explo2.wav (free use)
call handleSounds() in the loop somewhere.
Use the function: playASound(file$,dat$="") to play a sound. You can specify string parameters that effect the sound like this:
or
I got the explosion sound to test with from here:
http://www.sosbbs.com/~rwbenjamin/waveS.htm
http://www.sosbbs.com/~rwbenjamin/explo2.wav (free use)
call handleSounds() in the loop somewhere.
Use the function: playASound(file$,dat$="") to play a sound. You can specify string parameters that effect the sound like this:
PlayASound("explosion.wav","volume=0.4")play it at 0.4 of the normal volume
PlayASound("explosion.wav","times=5")play it five times
PlayASound("explosion.wav","volume=0.4,time=2")
or
PlayASound("explosion.wav")to play a sound with normal volume and pitch and only play it once.
; sound.bb Type sound Field file$ Field hand,channel,times Field dat$[3],state$ End Type ; playASound("saveme.wav","volume=1.0,pitch=44000,times=1") Function playASound(file$,dat$="") p.sound=New sound p\file=file For i=0 To 3 p\dat[i]=parse(dat,",",i) Next p\hand=LoadSound(file) p\channel=PlaySound(p\hand) p\times=1 For i=0 To 3 a$=parse(p\dat[i],"=",0) b$=parse(p\dat[i],"=",1) If a = "" Then Exit a=Lower(a):b=Lower(b) Select a Case "volume":ChannelVolume(p\channel,b) Case "pitch":ChannelPitch(p\channel,b) Case "times":p\times=b End Select Next p\state="play" End Function Function handleSounds() For s.sound=Each sound Select s\state Case "play" If ChannelPlaying(s\channel)=0 ; it's stopped playing. Play it again If s\times<>-1 s\times=s\times-1 EndIf If s\times>0 Or s\times=-1 s\channel=PlaySound(s\hand) Else s\state="die" EndIf EndIf Case "die" StopChannel(s\channel) FreeSound s\hand Delete s End Select Next End Function Function parse$(in$,de$,se) For x=1 To Len(in) v$=Mid(in,x,1) If v=de i=i+1 If se=i And v<>de m$=m+v Next Return m End Function