Ok so I have a frequency generator which uses AudioTrack to send PCM data to the hardware. Here\'s the code I\'m using for that:
private class playSoundTask ext
I think I've managed to solve the problem.
...
samples[i] = (short)((float)Math.sin( angle )*Short.MAX_VALUE);
angle += increment;
angle = angle % (2.0f * (float) Math.PI); //added statement
...
As stated before, it's not about buffers. It is about the angle variable, it increases continuously. After a while, the variable gets too large and does not support little steps.
As the sine repeats after 2*PI, we need to take the modulus of angle.
Hope this helps.
edited: angle += increment is enough for the job.