I'm trying to generate and play a square wave. I'm generating the signal and then using
track = new AudioTrack(AudioManager.STREAM_MUSIC,
sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, minSize,
AudioTrack.MODE_STREAM);
track.write(signal, 0, signal.length);
and then calling track.play(). The problem is it only plays once. It looks like there is a method to set the loop points, but I don't know what to put in for the frames.
I have also tried calling track.write() and then track.play() in a while loop, but there is a short lag, and I don't think this is the correct way anyway.
What IS the correct way to have a seamless loop?