I’d like to be able to start a stream playing, then the instant it finishes, start it again or start a different stream. Hopefully there is a way of detecting the end and starting a new sample quickly enough for the beat to continue seamlessly.
I need some advice on the best way to do it.
One way might be to use FSOUND_Stream_SetEndCallback() and have the callback function start the next stream.
Another way might be to poll Stream_IsPlaying() until the result is false, then start the next sample.
Another way I can think of takes advantage of the fact that the streams are all the same length. I could use a many-stream-long silent stream with syncpoints equally spaced in the file to syncronise the starts of all the real samples. Seems like a hack though.
Any help or advice would be appreciated.
- zoom asked 14 years ago
Thanks for the help.
I tried using the callbacks but there is a significant time between the stream ending and the callback function execution. I havent timed it exactly, it is approximately 0.2-0.5 seconds. Not fast enough for seamless looping.
I’m going to try the third option next.
- zoom answered 14 years ago
Moving to FSB sounds like it might be the way to go.
A similar problem seems to occur when I try to play a wav when it has already started. It will not play again until the wav has finished plus a small delay.
At the moment I am using the FSOUND_Stream_Open() and FSOUND_Stream_Play() functions to play a wav. I think I might have missed some easier way of playing sounds.
- zoom answered 13 years ago
Please login first to submit.