I am writing an Android application that plays music using recorded samples (using SoundPool). I have a Player that checks which samples I should play depending on the current time (realTimeElapsed). The player is updated using a timer set to 1 ms. Most of the time this works fine, but sometimes I have delays of about 100 ms.
I could not find a way to increase the priority of the timer, is there any other way to get these delays?
I show the scene using openGL at the same time, but I get the same delays if I turn off all the pictures.
thank
Edit:
I analyzed it with TraceView: an audio stream (Thread-16) starts every millisecond. But at t = 2580, a gap of about 200 ms occurs. The thread is not in a state of sleep during this period, but in the SoundPool.play method it is interrupted. Every time I have such a delay, the audio stream is interrupted. Is there no way to prevent these breaks?
I set the priority of the GL stream (which interrupts the audio stream) to THREAD_PRIORITY_LOWEST.

right-click on the image and select "show image" or near it to see the image in full resolution.
source
share