I have a requirement for perfect gapless looped audio in a BlackBerry 10 app. My loops are stored as WAV files. The method I'm using for playing them is:
- Create a buffer for the WAV file using
alutCreateBufferFromFile
which returns abufferID
- Create a sound source using
alGenSources
- Attach the buffer to the source using
alSourcei(source, AL_BUFFER, bufferID)
- Set the source looping property to true using
alSourcei(source, AL_LOOPING, AL_TRUE)
- Play the source using
alSourcePlay(source)
The audio plays fine most of the time, but during UI transitions (such as when the backlight goes off, or when the app is minimised) the audio stutters.
Any ideas how I can ensure the audio is smooth the whole time?
alSourcePlay
it spawns a separate thread to do the playing. How can I change the priority of that thread, rather than my main thread? – Gaffney