title: AudioTrack - how to know when a sound begins/ends?
body: <p>I am using Audio track to play a different sounds, in stream mode.
  I would like to know if there is a way to know when each sound beings/ends playing.</p>
  
  <p>I create the audio track like this:</p>
  
  <pre><code>AudioTrack tmpAudioTrack = new AudioTrack(
          STREAM_TYPE, 
          SAMPLE_RATE, 
          CHANNEL_CONFIG_TYPE, 
              AUDIO_FORMAT_TYPE, 
          getOptimalBufferSize(), 
          AUDIO_TRACK_MODE);'
  </code></pre>
  
  <p>And start it in a background thread:</p>
  
  <pre><code>backround_thread = new Thread(new MyRunnable(aTrack));
      backround_thread.start();   
  </code></pre>
  
  <p>I write each sound like this inside the runnable:</p>
  
  <pre><code>byte generatedSnd[] = new byte[2 * beepSamples];
  &lt;code for filling the buffer with sound here&gt;
  int bytesWritten = track.write(generatedSnd, 0, generatedSnd.length);
  </code></pre>
  
  <p>It is possible to use any of the AudioTrack APIs such setNotificationMarkerPosition, or setLoopPoints, or setPositionNotificationPeriod to accomplish this? and how do they work?</p>
  
  <p>Each sound can be different duration of time. I think this is key.</p>
  
  <p>I don't fully understand the documentation for these APIs. Is each frame the same as a sample? How do I specify a marker for where each sound begin/end?</p>
  
  <p>Thanks, </p>