wasting sound channels

BlitzMax Forums/BlitzMax Programming/wasting sound channels

Grey Alien(Posted 2006) [#1]
OK, apart from the fact that if you used the code below to play many sounds at once, or shortly after one an other, it would get very noisy, is there a good reason not to "waste" sound channels like this?

What I mean is, each time Playsound is called, it's returning a new Channel, so what happens to the old one? When does it get freed up as an object. Also leaving so many channels without ever stopping them or freeing them, does this have an adverse affect on the soundcard or CPU. Does anyone know because I certainly don't?

Thanks in advance for any input:

Graphics 800,600,0

'test variables
Global Bang:TSound = LoadSound("data/explosion.wav",False)
Global ChannelBang:TChannel

Repeat
	Cls
	If KeyHit(KEY_SPACE) Then
		ChannelBang = PlaySound(Bang)
	EndIf
	Flip
Until KeyHit(KEY_ESCAPE)



Fetze(Posted 2006) [#2]
I guess, the channel gets freed, if there is no reference pointing at it. Just like it is handled for all the other Object-Types.

I didn't find a Channel-maximum until now but I wouldn't waste them, just be make sure, there will be no error.


Grey Alien(Posted 2006) [#3]
I guess so, I just like something more concrete to go on.