android.media.AudioTrack.AudioTrack(int streamType, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes, int mode) throws IllegalArgumentException
public AudioTrack (int streamType, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes, int mode)
Since:
API Level 3
Class constructor.
Parameters
streamType | the type of the audio stream. See STREAM_VOICE_CALL , STREAM_SYSTEM , STREAM_RING , STREAM_MUSIC and STREAM_ALARM |
---|---|
sampleRateInHz | the sample rate expressed in Hertz. Examples of rates are (but not limited to) 44100, 22050 and 11025. |
channelConfig | describes the configuration of the audio channels. See CHANNEL_OUT_MONO andCHANNEL_OUT_STEREO |
audioFormat | the format in which the audio data is represented. See ENCODING_PCM_16BIT andENCODING_PCM_8BIT |
bufferSizeInBytes | the total size (in bytes) of the buffer where audio data is read from for playback. If using the AudioTrack in streaming mode, you can write data into this buffer in smaller chunks than this size. If using the AudioTrack in static mode, this is the maximum size of the sound that will be played for this instance. See getMinBufferSize(int, int, int) to determine the minimum required buffer size for the successful creation of an AudioTrack instance in streaming mode. Using values smaller than getMinBufferSize() will result in an initialization failure. |
mode | streaming or static buffer. See MODE_STATIC and MODE_STREAM |
Throws
IllegalArgumentException |
---|