I have a sound utility that I’m working on, one of the functions I’m trying to program is the ability to play a sound a random number of times then wait a random period of time. The first part is simple enough is simple enough through the channel’s setLoopCount function. But as I understand it a channel frees itself once the file is done playing.

I have a channel callback with callbacktype_end, that takes the channel and tries to copy the channel’s data into a new channel, including setting the callback onto itself, starts a thread that waits a random period of time, then unpauses the channel to start that whole process over again. But it’s throwing errors and I figured there had to be an easier way to this. Relinking to the new channel after all of the copying, not to mention the copying itself seems to not agree with my code for some reason.

So I have a few questions, is there an easy way for me to get the channel back together (sound, channel group, volume, pan) and ready to play again? Or do you see an easier way to implement a solution to this task?
Manually pull the length of the sound clip, use the setDelay function and forget about setLoopCount?

I was just figuring that I’m making this harder than I needed to make it and was wondering if anybody had run into this type of situation and had a solution they worked with.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.