Find lowest open channel...

Rimrook

  • Posts: 251
Still working on my sound emitter and I encountered a new challenge. How would you go about finding the lowest open sound channel to play a new sound on? How would you approach this challenge?

What I have gathered so far is when I play, not loop, a sound on a channel, its position will stop at the sounds length and never revert back to zero. Using that as my initial detection was a bust. I'm also experiencing glitching concerning the get length and get position blocks when attempting to display them as text. It's all very strange.

I also don't know what the channel limit is. Can I cycle through a hundred channels or will that over load the engine? Sorry for so many questions.

DTH

  • *
  • Posts: 148
Quote
I also don't know what the channel limit is.

there are 32 channels indexed from 0 to 31

Quote
How would you approach this challenge?

checking if position = 0 or position = length  for each of the 32 channels should work, use a "repeat until" loop block with a counter variable

or below (untested but see no reason why this would not work

Rimrook

  • Posts: 251
Wow thank you for the quick reply and solid info. I'll try some things with what you have me and I'll report back if this works so others can use it.

DTH

  • *
  • Posts: 148
NP, you do know you can just use "play sound" and it will find the first available channel?

for a complex sound app tho I can see why you would want to take care of that yourself

Rimrook

  • Posts: 251
Tested. It worked perfectly as you expected, well done.

DTH

  • *
  • Posts: 148