0
0

Hey folks,

I’ve got a long WAV file containing a number of really short samples. It doesn’t really seem to make any sense to load each sample separately when I could just play a region of that file (I don’t need polyphony or anything).

channel->setPosition gets me half way there, but I can’t think of a good way to stop at a given position.

setLoopPoints seems to get some of the way, but it looks like once the number of loops have been played, the file continues to the end?

I’m sure someone will have tried to do this before. Any tips?

  • You must to post comments
0
0

Take a look at the syncpoint part of the API. You would set a syncpoint at the end location of every sound. You then get a callback when a particular part of the file is reached, and you can do whatever you want from there. (Stop, pause, whatever…)

You might also try Channel::setDelay() with a DELAYTYPE_END or DELAYTYPE_PAUSE. That’ll let you set the precise time at which the sound should stop playing, but is a little less convenient usage-wise.

Hope that helps!

  • You must to post comments
0
0

I did experiment a bit with callbacks on syncpoints but was a bit worried that it wouldn’t work too well, since it’s only as accurate as the frequency at which you call System::update(). However, I’ve got it working nicely with a 25hz update and a safe gap between sounds. Thanks Adiss!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.