Hey peeps.. was having a few issues with my code below... it wont run alone so dont try. Just wondering if anyone has ever had an issue like it?
"sound 1,1,100,1" works.
"sound 2,1,100,1" works.
"sound 3,1,100,1" fails
What happenes, is that at the marked two lines, the program just shuts down, no error or anything.
Could this be an Fmod error?
If anyone has any ideas, please help.. this is a realy anoying bug in the system :/
Function addSound(channel,vol#,Pitch,Length)
Local p2#=pitch+200,o=channel
chancheck(channel)=0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If sounds(channel)<>0 Then
f = 440 * 2^(((P2/4.0) - 58)/12)
p2=f
If p2>100 And p2<44101 Then
SoundVolume sounds(channel),0
If ChannelPlaying(schan(channel))=0 Then schan(channel)=0
If schan(channel)=0 Then schan(channel)=PlaySound(sounds(channel)) ;Error causing line
ChannelPitch schan(channel),P2
ChannelVolume schan(channel),1
SoundVolume sounds(channel),1
volume(channel)=vol
sLength(channel)=Length
started(channel)=soundtimer()
release(channel)=-.3
sustain(channel)=.5
decay(channel)=-.2
EndIf
EndIf
updatesound()
.endbit
End Function
"sound 1,1,100,1" works.
"sound 2,1,100,1" works.
"sound 3,1,100,1" fails
What happenes, is that at the marked two lines, the program just shuts down, no error or anything.
Could this be an Fmod error?
If anyone has any ideas, please help.. this is a realy anoying bug in the system :/
Function addSound(channel,vol#,Pitch,Length)
Local p2#=pitch+200,o=channel
chancheck(channel)=0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If sounds(channel)<>0 Then
f = 440 * 2^(((P2/4.0) - 58)/12)
p2=f
If p2>100 And p2<44101 Then
SoundVolume sounds(channel),0
If ChannelPlaying(schan(channel))=0 Then schan(channel)=0
If schan(channel)=0 Then schan(channel)=PlaySound(sounds(channel)) ;Error causing line
ChannelPitch schan(channel),P2
ChannelVolume schan(channel),1
SoundVolume sounds(channel),1
volume(channel)=vol
sLength(channel)=Length
started(channel)=soundtimer()
release(channel)=-.3
sustain(channel)=.5
decay(channel)=-.2
EndIf
EndIf
updatesound()
.endbit
End Function