Code example for AudioTrack

Methods: getPlaybackHeadPosition

0
     * Called on the listener to periodically notify it that the playback head 
     * has reached a multiple of the notification period.  
     */ 
    public void onPeriodicNotification( AudioTrack track ) {
        if (playerCallback != null) {
            int buffered = writtenTotal - track.getPlaybackHeadPosition()*channels;
            int ms = samplesToMs( buffered, sampleRate, channels );
             
            try { 
            	playerCallback.playerPCMFeedBuffer( isPlaying, ms, bufferSizeInMs );
            } catch (Exception e) {
            	e.printStackTrace();
            } 
        } 
    } 
 
 
    //////////////////////////////////////////////////////////////////////////// 
    // Runnable 
    ////////////////////////////////////////////////////////////////////////////