sound crash

BlitzMax Forums/BlitzMax Beginners Area/sound crash

jkrankie(Posted 2007) [#1]
Ok, this is really doing my head in.

I've been searching the forums for a remedy but couldn't find one. I currently call my sounds like this, after seeing grey alien saying that you shoul stop, null then reallocate a channel to avoid memory leaks:

stopchannel channel
channel=null
channel=allocchannel()
channel=playsound(sound)

but the same bug is still happening. Basically i get a "Unhandled Exception error, attempt to access a null field or method" at some random point during the game. the debugger invariable points to stopchannel being the cause of this problem, but if i don't use stopchannel my sounds go all crackly due to the regularity of which sounds are played (lots can be happening at once)

All my channels are global throughout the whole code, as are the sounds. the sound files are wavs

Can anyone shed some light on this for me?

Cheers
Charlie


skidracer(Posted 2007) [#2]
channel=playsound(sound) needs to be playsound(sound,channel)


jkrankie(Posted 2007) [#3]
That's great, thanks a lot.

Cheers
Charlie