Java android.media AudioTrack fields, constructors, methods, implement or subclass

Example usage for Java android.media AudioTrack fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.media AudioTrack.

The text is from its open source code.

Subclass

android.media.AudioTrack has subclasses.
Click this link to see all its subclasses.

Field

intPLAYSTATE_STOPPED
indicates AudioTrack state is stopped
intPLAYSTATE_PAUSED
indicates AudioTrack state is paused
intPLAYSTATE_PLAYING
indicates AudioTrack state is playing
intMODE_STATIC
Creation mode where audio data is transferred from Java to the native layer only once before the audio starts playing.
intMODE_STREAM
Creation mode where audio data is streamed from Java to the native layer as the audio is playing.
intSTATE_UNINITIALIZED
State of an AudioTrack that was not successfully initialized upon creation.
intSTATE_INITIALIZED
State of an AudioTrack that is ready to be used.

Constructor

Method

intgetMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat)
Returns the estimated minimum buffer size required for an AudioTrack object to be created in the #MODE_STREAM mode.
intgetNativeOutputSampleRate(int streamType)
Returns the output sample rate in Hz for the specified stream type.
intgetPlaybackHeadPosition()
Returns the playback head position expressed in frames.
intgetState()
Returns the state of the AudioTrack instance.
voidplay()
Starts playing an AudioTrack.
voidrelease()
Releases the native AudioTrack resources.
voidstop()
Stops playing the audio data.
intwrite(@NonNull byte[] audioData, int offsetInBytes, int sizeInBytes)
Writes the audio data to the audio sink for playback (streaming mode), or copies audio data for later playback (static buffer mode).
intwrite(@NonNull short[] audioData, int offsetInShorts, int sizeInShorts)
Writes the audio data to the audio sink for playback (streaming mode), or copies audio data for later playback (static buffer mode).
intwrite(@NonNull ByteBuffer audioData, int sizeInBytes, @WriteMode int writeMode)
Writes the audio data to the audio sink for playback (streaming mode), or copies audio data for later playback (static buffer mode).