                     }
                 }
             }
+            totalBufferedAudio += samplesWritten / targetRate;
         }
     }
 }

            var samplesWritten:int = 0;
            var leftSample:Number, rightSample:Number;

            while (samplesWritten < audioBufferSize) {

                if (audioBuffers.length == 0) {

            if (soundChannel == null) {
                return 0;
            } else {
                return soundChannel.position / 1000 - starvedAudioTime - droppedAudioTime;
            }
        }

