java.lang.Object | |
↳ | android.media.AudioFormat.Builder |
Builder class for AudioFormat
objects.
Use this class to configure and create an AudioFormat instance. By setting format
characteristics such as audio encoding, channel mask or sample rate, you indicate which
of those are to vary from the default behavior on this device wherever this audio format
is used.
AudioFormat
is for instance used in
AudioTrack(AudioAttributes, AudioFormat, int, int, int)
. In this
constructor, every format characteristic set on the Builder
(e.g. with
setSampleRate(int)
) will alter the default values used by an
AudioTrack
. In this case for audio playback with AudioTrack
, the
sample rate set in the Builder
would override the platform output sample rate
which would otherwise be selected by default.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new Builder with none of the format characteristics set.
| |||||||||||
Constructs a new Builder from a given
AudioFormat .
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Combines all of the format characteristics that have been set and return a new
AudioFormat object.
| |||||||||||
Sets the channel mask.
| |||||||||||
Sets the data encoding format.
| |||||||||||
Sets the sample rate.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constructs a new Builder with none of the format characteristics set.
Constructs a new Builder from a given AudioFormat
.
af | the AudioFormat object whose data will be reused in the new Builder.
|
---|
Combines all of the format characteristics that have been set and return a new
AudioFormat
object.
AudioFormat
object
Sets the channel mask.
channelMask | describes the configuration of the audio channels.
For output, the mask should be a combination of
for input, the mask should be |
---|
Sets the data encoding format.
encoding | one of ENCODING_DEFAULT ,
ENCODING_PCM_8BIT ,
ENCODING_PCM_16BIT ,
ENCODING_PCM_FLOAT ,
ENCODING_AC3 ,
ENCODING_E_AC3 . |
---|
IllegalArgumentException |
---|
Sets the sample rate.
sampleRate | the sample rate expressed in Hz |
---|
IllegalArgumentException |
---|