title: Looping an audio file
body: <p>I'm trying to generate and play a square wave. I'm generating the signal and then using</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>What IS the correct way to have a seamless loop?</p>