Can you put multiple sound files into one channel?

BlitzMax Forums/BlitzMax Beginners Area/Can you put multiple sound files into one channel?

Matt McFarland(Posted 2005) [#1]
Reason being, I wanted to code in the simplest way "volume control"

If I have 20 sound effects, 20 voices, and backround music playing, I'd love to be able to control all the sound effects in one channel, the voices in the other, and the music in the last. That way volume control would be a sinch..

Not sure if that is possible, any ideas on the best way to code this?


Matt McFarland(Posted 2005) [#2]
-* BumP *-


Gabriel(Posted 2005) [#3]
Erm, if you only ever want one sound playing at a time, yes. Otherwise, clearly not.

I usually knock up something simple but effective with types. Every time a new sound is played it uses the channel which was set playing the longest time ago ( so it's either done by now or it's the most complete of all ) and reuse that. Done like that, it's as simple as using one channel, but with the flexibility of as many channels as you choose to use. Keep music separate from sound effects for obvious reasons. You don't want your music stopping in the middle.


Grey Alien(Posted 2005) [#4]
I have an array of channels that every time a sound plays the pointer points at the next array slot, and eventually it loops back to the start. Then you can play say max 5 channels. Problem is if they all play at once it can be noisy so you really need to reduce the volume of all playing channels by a releative amount.