I've implemented an OpenSLES buffered queue following the example here: https://github.com/googlesamples/android-ndk/blob/master/native-audio/app/src/main/cpp/native-audio-jni.c
However when I enqueue my sound and it's (implicitly) played, I can hear a glitch at the beginning of the sound:
(*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, nextBuffer, nextSize);
This glitch is not present on the (file) sample.
If I enqueue twice the sample, I can hear twice this glitch.
The sample was encoded using Audacity into a mono .wav of 44kHz
Actually, .wav format does not means raw hence the file start with an header. That was what producing the glitch at the beginning.
With Audacity, exporting as "Other uncompressed format" > "RAW (header-less)", "Signed 16-bit PCM" solved the issue.