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:
alutCreateBufferFromFile
which returns a bufferID
alGenSources
alSourcei(source, AL_BUFFER, bufferID)
alSourcei(source, AL_LOOPING, AL_TRUE)
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?
How do you run a thread/process playing WAV file? Have you had a chance to play around priorities and policies with that thread?
I think these low-level system calls allowing to change process (thread, actually) priority and policy might help:
Also, have a look at respective doc pages:
I'd start with setting policy to FIFO and raise priority of the process playing audio file. Hope it helps.