public class AudioRecord extends Object implements AudioRouting
read(byte[],int, int)
, read(short[], int, int)
or read(ByteBuffer, int)
. The choice of which method to use will be based
on the audio data storage format that is the most convenient for the user of AudioRecord.
Upon creation, an AudioRecord object initializes its associated audio buffer that it will fill with the new audio data. The size of this buffer, specified during the construction, determines how long an AudioRecord can record before "over-running" data that has not been read yet. Data should be read from the audio hardware in chunks of sizes inferior to the total recording buffer size.
Modifier and Type | Class and Description |
---|---|
static class |
AudioRecord.Builder
Builder class for
AudioRecord objects. |
static interface |
AudioRecord.OnRecordPositionUpdateListener
Interface definition for a callback to be invoked when an AudioRecord has
reached a notification marker set by
setNotificationMarkerPosition(int)
or for periodic updates on the progress of the record head, as set by
setPositionNotificationPeriod(int) . |
static interface |
AudioRecord.OnRoutingChangedListener
Deprecated.
users should switch to the general purpose
AudioRouting.OnRoutingChangedListener class instead. |
static interface |
AudioRecord.ReadMode |
Modifier and Type | Field and Description |
---|---|
static int |
ERROR
Denotes a generic operation failure.
|
static int |
ERROR_BAD_VALUE
Denotes a failure due to the use of an invalid value.
|
static int |
ERROR_DEAD_OBJECT
An error code indicating that the object reporting it is no longer valid and needs to
be recreated.
|
static int |
ERROR_INVALID_OPERATION
Denotes a failure due to the improper use of a method.
|
static int |
READ_BLOCKING
The read mode indicating the read operation will block until all data
requested has been read.
|
static int |
READ_NON_BLOCKING
The read mode indicating the read operation will return immediately after
reading as much audio data as possible without blocking.
|
static int |
RECORDSTATE_RECORDING
indicates AudioRecord recording state is recording
|
static int |
RECORDSTATE_STOPPED
indicates AudioRecord recording state is not recording
|
static int |
STATE_INITIALIZED
indicates AudioRecord state is ready to be used
|
static int |
STATE_UNINITIALIZED
indicates AudioRecord state is not successfully initialized.
|
static String |
SUBMIX_FIXED_VOLUME |
static int |
SUCCESS
Denotes a successful operation.
|
Constructor and Description |
---|
AudioRecord(AudioAttributes attributes,
AudioFormat format,
int bufferSizeInBytes,
int sessionId) |
AudioRecord(int audioSource,
int sampleRateInHz,
int channelConfig,
int audioFormat,
int bufferSizeInBytes)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnRoutingChangedListener(AudioRecord.OnRoutingChangedListener listener,
Handler handler)
Deprecated.
users should switch to the general purpose
AudioRouting.OnRoutingChangedListener class instead. |
void |
addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener,
Handler handler)
Adds an
AudioRouting.OnRoutingChangedListener to receive notifications of
routing changes on this AudioRecord. |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
int |
getAudioFormat()
Returns the configured audio data encoding.
|
int |
getAudioSessionId()
Returns the audio session ID.
|
int |
getAudioSource()
Returns the audio recording source.
|
int |
getBufferSizeInFrames()
Returns the frame count of the native
AudioRecord buffer. |
int |
getChannelConfiguration()
Returns the configured channel position mask.
|
int |
getChannelCount()
Returns the configured number of channels.
|
AudioFormat |
getFormat()
Returns the configured
AudioRecord format. |
static int |
getMinBufferSize(int sampleRateInHz,
int channelConfig,
int audioFormat)
Returns the minimum buffer size required for the successful creation of an AudioRecord
object, in byte units.
|
int |
getNotificationMarkerPosition()
Returns the notification marker position expressed in frames.
|
int |
getPositionNotificationPeriod()
Returns the notification update period expressed in frames.
|
AudioDeviceInfo |
getPreferredDevice()
Returns the selected input specified by
setPreferredDevice(android.media.AudioDeviceInfo) . |
int |
getRecordingState()
Returns the recording state of the AudioRecord instance.
|
AudioDeviceInfo |
getRoutedDevice()
Returns an
AudioDeviceInfo identifying the current routing of this AudioRecord. |
int |
getSampleRate()
Returns the configured audio sink sample rate in Hz.
|
int |
getState()
Returns the state of the AudioRecord instance.
|
int |
getTimestamp(AudioTimestamp outTimestamp,
int timebase)
Poll for an
AudioTimestamp on demand. |
void |
native_release() |
int |
read(byte[] audioData,
int offsetInBytes,
int sizeInBytes)
Reads audio data from the audio hardware for recording into a byte array.
|
int |
read(byte[] audioData,
int offsetInBytes,
int sizeInBytes,
int readMode)
Reads audio data from the audio hardware for recording into a byte array.
|
int |
read(ByteBuffer audioBuffer,
int sizeInBytes)
Reads audio data from the audio hardware for recording into a direct buffer.
|
int |
read(ByteBuffer audioBuffer,
int sizeInBytes,
int readMode)
Reads audio data from the audio hardware for recording into a direct buffer.
|
int |
read(float[] audioData,
int offsetInFloats,
int sizeInFloats,
int readMode)
Reads audio data from the audio hardware for recording into a float array.
|
int |
read(short[] audioData,
int offsetInShorts,
int sizeInShorts)
Reads audio data from the audio hardware for recording into a short array.
|
int |
read(short[] audioData,
int offsetInShorts,
int sizeInShorts,
int readMode)
Reads audio data from the audio hardware for recording into a short array.
|
void |
release()
Releases the native AudioRecord resources.
|
void |
removeOnRoutingChangedListener(AudioRecord.OnRoutingChangedListener listener)
Deprecated.
users should switch to the general purpose
AudioRouting.OnRoutingChangedListener class instead. |
void |
removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener)
Removes an
AudioRouting.OnRoutingChangedListener which has been previously added
to receive rerouting notifications. |
int |
setNotificationMarkerPosition(int markerInFrames)
Sets the marker position at which the listener is called, if set with
setRecordPositionUpdateListener(OnRecordPositionUpdateListener) or
setRecordPositionUpdateListener(OnRecordPositionUpdateListener, Handler) . |
int |
setPositionNotificationPeriod(int periodInFrames)
Sets the period at which the listener is called, if set with
setRecordPositionUpdateListener(OnRecordPositionUpdateListener) or
setRecordPositionUpdateListener(OnRecordPositionUpdateListener, Handler) . |
boolean |
setPreferredDevice(AudioDeviceInfo deviceInfo)
Specifies an audio device (via an
AudioDeviceInfo object) to route
the input to this AudioRecord. |
void |
setRecordPositionUpdateListener(AudioRecord.OnRecordPositionUpdateListener listener)
Sets the listener the AudioRecord notifies when a previously set marker is reached or
for each periodic record head position update.
|
void |
setRecordPositionUpdateListener(AudioRecord.OnRecordPositionUpdateListener listener,
Handler handler)
Sets the listener the AudioRecord notifies when a previously set marker is reached or
for each periodic record head position update.
|
void |
startRecording()
Starts recording from the AudioRecord instance.
|
void |
startRecording(MediaSyncEvent syncEvent)
Starts recording from the AudioRecord instance when the specified synchronization event
occurs on the specified audio session.
|
void |
stop()
Stops recording.
|
public static final int STATE_UNINITIALIZED
public static final int STATE_INITIALIZED
public static final int RECORDSTATE_STOPPED
public static final int RECORDSTATE_RECORDING
public static final int SUCCESS
public static final int ERROR
public static final int ERROR_BAD_VALUE
public static final int ERROR_INVALID_OPERATION
public static final int ERROR_DEAD_OBJECT
public static final String SUBMIX_FIXED_VOLUME
public static final int READ_BLOCKING
public static final int READ_NON_BLOCKING
public AudioRecord(int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes) throws IllegalArgumentException
IllegalArgumentException
exception,
other errors do not. Thus you should call getState()
immediately after construction
to confirm that the object is usable.audioSource
- the recording source.
See MediaRecorder.AudioSource
for the recording source definitions.sampleRateInHz
- the sample rate expressed in Hertz. 44100Hz is currently the only
rate that is guaranteed to work on all devices, but other rates such as 22050,
16000, and 11025 may work on some devices.
AudioFormat.SAMPLE_RATE_UNSPECIFIED
means to use a route-dependent value
which is usually the sample rate of the source.
getSampleRate()
can be used to retrieve the actual sample rate chosen.channelConfig
- describes the configuration of the audio channels.
See AudioFormat.CHANNEL_IN_MONO
and
AudioFormat.CHANNEL_IN_STEREO
. AudioFormat.CHANNEL_IN_MONO
is guaranteed
to work on all devices.audioFormat
- the format in which the audio data is to be returned.
See AudioFormat.ENCODING_PCM_8BIT
, AudioFormat.ENCODING_PCM_16BIT
,
and AudioFormat.ENCODING_PCM_FLOAT
.bufferSizeInBytes
- the total size (in bytes) of the buffer where audio data is written
to during the recording. New audio data can be read from this buffer in smaller chunks
than this size. See getMinBufferSize(int, int, int)
to determine the minimum
required buffer size for the successful creation of an AudioRecord instance. Using values
smaller than getMinBufferSize() will result in an initialization failure.IllegalArgumentException
public AudioRecord(AudioAttributes attributes, AudioFormat format, int bufferSizeInBytes, int sessionId) throws IllegalArgumentException
attributes
- a non-null AudioAttributes
instance. Use
AudioAttributes.Builder#setAudioSource(int)
for configuring the audio
source for this instance.format
- a non-null AudioFormat
instance describing the format of the data
that will be recorded through this AudioRecord. See AudioFormat.Builder
for
configuring the audio format parameters such as encoding, channel mask and sample rate.bufferSizeInBytes
- the total size (in bytes) of the buffer where audio data is written
to during the recording. New audio data can be read from this buffer in smaller chunks
than this size. See getMinBufferSize(int, int, int)
to determine the minimum
required buffer size for the successful creation of an AudioRecord instance. Using values
smaller than getMinBufferSize() will result in an initialization failure.sessionId
- ID of audio session the AudioRecord must be attached to, or
AudioManager.AUDIO_SESSION_ID_GENERATE
if the session isn't known at construction
time. See also AudioManager.generateAudioSessionId()
to obtain a session ID before
construction.IllegalArgumentException
public void release()
protected void finalize()
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
public int getSampleRate()
AudioFormat.SAMPLE_RATE_UNSPECIFIED
,
then the sink sample rate is a route-dependent default value based on the source [sic].public int getAudioSource()
MediaRecorder.AudioSource
public int getAudioFormat()
AudioFormat.ENCODING_PCM_8BIT
,
AudioFormat.ENCODING_PCM_16BIT
, and AudioFormat.ENCODING_PCM_FLOAT
.public int getChannelConfiguration()
See AudioFormat.CHANNEL_IN_MONO
and AudioFormat.CHANNEL_IN_STEREO
.
This method may return AudioFormat.CHANNEL_INVALID
if
a channel index mask is used.
Consider getFormat()
instead, to obtain an AudioFormat
,
which contains both the channel position mask and the channel index mask.
public AudioFormat getFormat()
AudioRecord
format.AudioFormat
containing the
AudioRecord
parameters at the time of configuration.public int getChannelCount()
public int getState()
STATE_INITIALIZED
,
STATE_UNINITIALIZED
public int getRecordingState()
RECORDSTATE_STOPPED
,
RECORDSTATE_RECORDING
public int getBufferSizeInFrames()
AudioRecord
buffer.
This is greater than or equal to the bufferSizeInBytes converted to frame units
specified in the AudioRecord
constructor or Builder.
The native frame count may be enlarged to accommodate the requirements of the
source on creation or if the AudioRecord
is subsequently rerouted.AudioRecord
buffer.IllegalStateException
public int getNotificationMarkerPosition()
public int getPositionNotificationPeriod()
public int getTimestamp(AudioTimestamp outTimestamp, int timebase)
AudioTimestamp
on demand.
The AudioTimestamp reflects the frame delivery information at the earliest point available in the capture pipeline.
Calling startRecording()
following a stop()
will reset
the frame count to 0.
outTimestamp
- a caller provided non-null AudioTimestamp instance,
which is updated with the AudioRecord frame delivery information upon success.timebase
- one of
AudioTimestamp.TIMEBASE_BOOTTIME
or
AudioTimestamp.TIMEBASE_MONOTONIC
,
used to select the clock for the AudioTimestamp time.SUCCESS
if a timestamp is available,
or ERROR_INVALID_OPERATION
if a timestamp not available.public static int getMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat)
AudioRecord(int, int, int, int, int)
for more information on valid
configuration values.sampleRateInHz
- the sample rate expressed in Hertz.
AudioFormat.SAMPLE_RATE_UNSPECIFIED
is not permitted.channelConfig
- describes the configuration of the audio channels.
See AudioFormat.CHANNEL_IN_MONO
and
AudioFormat.CHANNEL_IN_STEREO
audioFormat
- the format in which the audio data is represented.
See AudioFormat.ENCODING_PCM_16BIT
.ERROR_BAD_VALUE
if the recording parameters are not supported by the
hardware, or an invalid parameter was passed,
or ERROR
if the implementation was unable to query the hardware for its
input properties,
or the minimum buffer size expressed in bytes.AudioRecord(int, int, int, int, int)
public int getAudioSessionId()
public void startRecording() throws IllegalStateException
IllegalStateException
public void startRecording(MediaSyncEvent syncEvent) throws IllegalStateException
syncEvent
- event that triggers the capture.IllegalStateException
MediaSyncEvent
public void stop() throws IllegalStateException
IllegalStateException
public int read(byte[] audioData, int offsetInBytes, int sizeInBytes)
AudioFormat.ENCODING_PCM_8BIT
to correspond to the data in the array.audioData
- the array to which the recorded audio data is written.offsetInBytes
- index in audioData from which the data is written expressed in bytes.sizeInBytes
- the number of requested bytes.ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic int read(byte[] audioData, int offsetInBytes, int sizeInBytes, int readMode)
AudioFormat.ENCODING_PCM_8BIT
to correspond to the data in the array.
The format can be AudioFormat.ENCODING_PCM_16BIT
, but this is deprecated.audioData
- the array to which the recorded audio data is written.offsetInBytes
- index in audioData to which the data is written expressed in bytes.
Must not be negative, or cause the data access to go out of bounds of the array.sizeInBytes
- the number of requested bytes.
Must not be negative, or cause the data access to go out of bounds of the array.readMode
- one of READ_BLOCKING
, READ_NON_BLOCKING
.
READ_BLOCKING
, the read will block until all the requested data
is read.
READ_NON_BLOCKING
, the read will return immediately after
reading as much audio data as possible without blocking.ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic int read(short[] audioData, int offsetInShorts, int sizeInShorts)
AudioFormat.ENCODING_PCM_16BIT
to correspond to the data in the array.audioData
- the array to which the recorded audio data is written.offsetInShorts
- index in audioData to which the data is written expressed in shorts.
Must not be negative, or cause the data access to go out of bounds of the array.sizeInShorts
- the number of requested shorts.
Must not be negative, or cause the data access to go out of bounds of the array.ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic int read(short[] audioData, int offsetInShorts, int sizeInShorts, int readMode)
AudioFormat.ENCODING_PCM_16BIT
to correspond to the data in the array.audioData
- the array to which the recorded audio data is written.offsetInShorts
- index in audioData from which the data is written expressed in shorts.
Must not be negative, or cause the data access to go out of bounds of the array.sizeInShorts
- the number of requested shorts.
Must not be negative, or cause the data access to go out of bounds of the array.readMode
- one of READ_BLOCKING
, READ_NON_BLOCKING
.
READ_BLOCKING
, the read will block until all the requested data
is read.
READ_NON_BLOCKING
, the read will return immediately after
reading as much audio data as possible without blocking.ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic int read(float[] audioData, int offsetInFloats, int sizeInFloats, int readMode)
AudioFormat.ENCODING_PCM_FLOAT
to correspond to the data in the array.audioData
- the array to which the recorded audio data is written.offsetInFloats
- index in audioData from which the data is written.
Must not be negative, or cause the data access to go out of bounds of the array.sizeInFloats
- the number of requested floats.
Must not be negative, or cause the data access to go out of bounds of the array.readMode
- one of READ_BLOCKING
, READ_NON_BLOCKING
.
READ_BLOCKING
, the read will block until all the requested data
is read.
READ_NON_BLOCKING
, the read will return immediately after
reading as much audio data as possible without blocking.ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic int read(ByteBuffer audioBuffer, int sizeInBytes)
Buffer.position()
on this buffer is
unchanged after a call to this method.
The representation of the data in the buffer will depend on the format specified in
the AudioRecord constructor, and will be native endian.audioBuffer
- the direct buffer to which the recorded audio data is written.
Data is written to audioBuffer.position().sizeInBytes
- the number of requested bytes. It is recommended but not enforced
that the number of bytes requested be a multiple of the frame size (sample size in
bytes multiplied by the channel count).ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic int read(ByteBuffer audioBuffer, int sizeInBytes, int readMode)
Buffer.position()
on this buffer is
unchanged after a call to this method.
The representation of the data in the buffer will depend on the format specified in
the AudioRecord constructor, and will be native endian.audioBuffer
- the direct buffer to which the recorded audio data is written.
Data is written to audioBuffer.position().sizeInBytes
- the number of requested bytes. It is recommended but not enforced
that the number of bytes requested be a multiple of the frame size (sample size in
bytes multiplied by the channel count).readMode
- one of READ_BLOCKING
, READ_NON_BLOCKING
.
READ_BLOCKING
, the read will block until all the requested data
is read.
READ_NON_BLOCKING
, the read will return immediately after
reading as much audio data as possible without blocking.ERROR_INVALID_OPERATION
if the object isn't properly initializedERROR_BAD_VALUE
if the parameters don't resolve to valid data and indexesERROR_DEAD_OBJECT
if the object is not valid anymore and
needs to be recreated. The dead object error code is not returned if some data was
successfully transferred. In this case, the error is returned at the next read()ERROR
in case of other errorpublic void setRecordPositionUpdateListener(AudioRecord.OnRecordPositionUpdateListener listener)
listener
- public void setRecordPositionUpdateListener(AudioRecord.OnRecordPositionUpdateListener listener, Handler handler)
listener
- handler
- the Handler that will receive the event notification messages.public int setNotificationMarkerPosition(int markerInFrames)
setRecordPositionUpdateListener(OnRecordPositionUpdateListener)
or
setRecordPositionUpdateListener(OnRecordPositionUpdateListener, Handler)
.markerInFrames
- marker position expressed in framesSUCCESS
, ERROR_BAD_VALUE
,
ERROR_INVALID_OPERATION
public AudioDeviceInfo getRoutedDevice()
AudioDeviceInfo
identifying the current routing of this AudioRecord.
Note: The query is only valid if the AudioRecord is currently recording. If it is not,
getRoutedDevice()
will return null.getRoutedDevice
in interface AudioRouting
public void addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener, Handler handler)
AudioRouting.OnRoutingChangedListener
to receive notifications of
routing changes on this AudioRecord.addOnRoutingChangedListener
in interface AudioRouting
listener
- The AudioRouting.OnRoutingChangedListener
interface to receive
notifications of rerouting events.handler
- Specifies the Handler
object for the thread on which to execute
the callback. If null
, the Handler
associated with the main
Looper
will be used.public void removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener)
AudioRouting.OnRoutingChangedListener
which has been previously added
to receive rerouting notifications.removeOnRoutingChangedListener
in interface AudioRouting
listener
- The previously added AudioRouting.OnRoutingChangedListener
interface
to remove.@Deprecated public void addOnRoutingChangedListener(AudioRecord.OnRoutingChangedListener listener, Handler handler)
AudioRouting.OnRoutingChangedListener
class instead.AudioRecord.OnRoutingChangedListener
to receive notifications of routing changes
on this AudioRecord.listener
- The AudioRecord.OnRoutingChangedListener
interface to receive notifications
of rerouting events.handler
- Specifies the Handler
object for the thread on which to execute
the callback. If null
, the Handler
associated with the main
Looper
will be used.@Deprecated public void removeOnRoutingChangedListener(AudioRecord.OnRoutingChangedListener listener)
AudioRouting.OnRoutingChangedListener
class instead.AudioRecord.OnRoutingChangedListener
which has been previously added
to receive rerouting notifications.listener
- The previously added AudioRecord.OnRoutingChangedListener
interface to remove.public int setPositionNotificationPeriod(int periodInFrames)
setRecordPositionUpdateListener(OnRecordPositionUpdateListener)
or
setRecordPositionUpdateListener(OnRecordPositionUpdateListener, Handler)
.
It is possible for notifications to be lost if the period is too small.periodInFrames
- update period expressed in framesSUCCESS
, ERROR_INVALID_OPERATION
public boolean setPreferredDevice(AudioDeviceInfo deviceInfo)
AudioDeviceInfo
object) to route
the input to this AudioRecord.setPreferredDevice
in interface AudioRouting
deviceInfo
- The AudioDeviceInfo
specifying the audio source.
If deviceInfo is null, default routing is restored.AudioDeviceInfo
is non-null and
does not correspond to a valid audio input device.public AudioDeviceInfo getPreferredDevice()
setPreferredDevice(android.media.AudioDeviceInfo)
. Note that this
is not guarenteed to correspond to the actual device being used for recording.getPreferredDevice
in interface AudioRouting
public final void native_release()