long rawPlaybackHeadPosition = 0xFFFFFFFFL & audioTrack.getPlaybackHeadPosition(); if (needsPassthroughWorkarounds) {
do{ // Montior playback to find when done if (audioTrack != null) x = audioTrack.getPlaybackHeadPosition(); else x = numSamples;
public int getCurrentPosition() { return (int)((mPlaybackStart + mAudioTrack.getPlaybackHeadPosition()) * (1000.0 / mSampleRate)); } }
/** * Returns whether the audio track should behave as though it has pending data. This is to work * around an issue on platform API versions 21/22 where AC-3 audio tracks can't be paused, so we * empty their buffers when paused. In this case, they should still behave as if they have * pending data, otherwise writing will never resume. * * @see #handleBuffer */ public boolean overrideHasPendingData() { return Util.SDK_INT <= 22 && isPassthrough && audioTrack.getPlayState() == android.media.AudioTrack.PLAYSTATE_PAUSED && audioTrack.getPlaybackHeadPosition() == 0; }
long rawPlaybackHeadPosition = 0xFFFFFFFFL & audioTrack.getPlaybackHeadPosition(); if (Util.SDK_INT <= 22 && isPassthrough) {
x = audioTrack.getPlaybackHeadPosition(); else x = numSamples;
@Override public void run () { int lastFrame = -AndroidPlayObjectProcessor.ONE; while (lastFrame != audioTrack.getPlaybackHeadPosition ()) { lastFrame = audioTrack.getPlaybackHeadPosition (); try { Thread.sleep (AndroidPlayObjectProcessor.ONE_SECOND); } catch (final InterruptedException e) { throw new SoundTransformRuntimeException (new PlayObjectException (new SoundTransformException (PlaySoundErrorCode.COULD_NOT_PLAY_SOUND, e))); } } if (stopMonitor != null) { synchronized (stopMonitor) { stopMonitor.notifyAll (); } } else { audioTrack.stop (); audioTrack.release (); } } };
switch (mState) { case STATE_PRIMING: if (mAudioTrack.getPlaybackHeadPosition() > (8 * mFramesPerBlock)) { nextState = STATE_LOWERING; mPreviousUnderrunCount = getUnderrunCount();