Best code examples for Android AudioTrack class (android.media.AudioTrack)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AudioTrack class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android AudioTrack examples from Open Source projects
This code example shows how to use the following methods: release, stop
141:	oTrack.stop(); 
142:	oTrack.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: play
102:	AudioTrack.MODE_STREAM ); 
103:	mAudio.play(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getAudioFormat, getChannelCount, getSampleRate, getState
64:	track.getSampleRate() == rate && 
65:	track.getAudioFormat() == format && 
66:	track.getChannelCount() == channels) 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPlayState, play, write
285:	if (AudioTrack.PLAYSTATE_PLAYING != mAudioTrack.getPlayState()) { 
286:	mAudioTrack.play(); 
-
288:	int size = mAudioTrack.write(buf, 0, buf.length); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: play, setStereoVolume
243:	audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT, minBufferSize, AudioTrack.MODE_STREAM); 
-
246:	audioTrack.setStereoVolume(audioVolume, audioVolume); 
-
248:	audioTrack.play(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getState, play, release, setPlaybackRate, write
584:	AudioTrack track = new AudioTrack(TEST_STREAM_TYPE, TEST_SR, TEST_CONF, TEST_FORMAT, 
-
589:	track.write(data, 0, data.length); 
590:	track.write(data, 0, data.length); 
591:	assumeTrue(TEST_NAME, track.getState() == AudioTrack.STATE_INITIALIZED); 
592:	track.play(); 
593:	assertTrue(TEST_NAME, track.setPlaybackRate(2*outputSR) == AudioTrack.SUCCESS); 
-
595:	track.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: play, write
157:	audiotrack.play(); 
158:	audiotrack.write(audio, 0, audio.length); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: play
48:	: AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT, minSize, AudioTrack.MODE_STREAM); 
49:	track.play(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getState, play, write
63:	if (mAudioTrack.getState() == AudioTrack.STATE_UNINITIALIZED) 
-
65:	if (mAudioTrack.write(audioData, 0, bufferSize) != bufferSize) { 
-
68:	mAudioTrack.play(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: play
108:	AudioTrack audioTrack = new AudioTrack( 
-
115:	audioTrack.play(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: flush, play, release, write
100:	AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 
-
104:	audioTrack.write(generatedSnd, 0, generatedSnd.length); 
105:	audioTrack.play(); 
106:	audioTrack.flush(); 
107:	audioTrack.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: play, stop, write
47:	audioTrack.play(); 
48:	audioTrack.write(soundBuffer, 0, minBufferSize); 
49:	audioTrack.stop(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getNotificationMarkerPosition, getPlaybackHeadPosition, getPlaybackRate, getPositionNotificationPeriod, getSampleRate
809:	_at = new AudioTrack( 
-
821:	+ _at.getNotificationMarkerPosition()); 
822:	WebrtcLog("Play head pos = " + _at.getPlaybackHeadPosition()); 
-
824:	+ _at.getPositionNotificationPeriod()); 
825:	WebrtcLog("Playback rate = " + _at.getPlaybackRate()); 
826:	WebrtcLog("Sample rate = " + _at.getSampleRate()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getState, play, write
63:	if (mAudioTrack.getState() == AudioTrack.STATE_UNINITIALIZED) 
-
65:	if (mAudioTrack.write(audioData, 0, bufferSize) != bufferSize) { 
-
68:	mAudioTrack.play(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: release, stop
118:	mAudio.stop(); 
119:	mAudio.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: release, stop
165:	try { audiotrack.stop(); } catch(Exception e) { e.printStackTrace(); } 
166:	audiotrack.release(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: release, stop
187:	audioTrack.stop(); 
188:	audioTrack.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: release, stop
95:	mAudio.stop(); 
96:	mAudio.release(); 
Full Snippet Info
6
CodeRank
Related Android AudioTrack Questions & Answers:
See Code Examples for Android AudioTrack Methods: