Home | History | Annotate | Download | only in tts

Lines Matching refs:audioTrack

19 import android.media.AudioTrack;
83 AudioTrack current = ((SynthesisMessageParams) token).getAudioTrack();
364 // extra trouble to clean the data to prevent the AudioTrack resources
375 final AudioTrack audioTrack = createStreamingAudioTrack(param);
377 if (DBG) Log.d(TAG, "Created audio track [" + audioTrack.hashCode() + "]");
379 param.setAudioTrack(audioTrack);
396 final AudioTrack audioTrack = param.getAudioTrack();
404 int playState = audioTrack.getPlayState();
405 if (playState == AudioTrack.PLAYSTATE_STOPPED) {
406 if (DBG) Log.d(TAG, "AudioTrack stopped, restarting : " + audioTrack.hashCode());
407 audioTrack.play();
413 int written = audioTrack.write(bufferCopy.mBytes, count, bufferCopy.mBytes.length);
428 final AudioTrack audioTrack = params.getAudioTrack();
430 if (audioTrack == null) {
438 audioTrack.getPlayState());
440 audioTrack.stop();
444 audioTrack.hashCode());
446 audioTrack.hashCode() + "]");
448 // The last call to AudioTrack.write( ) will return only after
449 // all data from the audioTrack has been sent to the mixer, so
453 // Never allow the audioTrack to be observed in a state where
455 // is in the various stopFoo methods that call AudioTrack#stop from
458 audioTrack.release();
471 * The minimum increment of time to wait for an audiotrack to finish
477 * The maximum increment of time to sleep while waiting for an audiotrack
495 // In this case we would have called AudioTrack#stop() to flush
526 final AudioTrack audioTrack = params.mAudioTrack;
533 while ((currentPosition = audioTrack.getPlaybackHeadPosition()) < lengthInFrames &&
534 audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
537 audioTrack.getSampleRate();
550 "for AudioTrack to make progress, Aborting");
581 private static AudioTrack createStreamingAudioTrack(SynthesisMessageParams params) {
587 = AudioTrack.getMinBufferSize(sampleRateInHz, channelConfig, audioFormat);
590 AudioTrack audioTrack = new AudioTrack(params.mStreamType, sampleRateInHz, channelConfig,
591 audioFormat, bufferSizeInBytes, AudioTrack.MODE_STREAM);
592 if (audioTrack.getState() != AudioTrack.STATE_INITIALIZED) {
594 audioTrack.release();
599 setupVolume(audioTrack, params.mVolume, params.mPan);
600 return audioTrack;
613 private static void setupVolume(AudioTrack audioTrack, float volume, float pan) {
624 if (audioTrack.setStereoVolume(volLeft, volRight) != AudioTrack.SUCCESS) {