@Implements(value=android.media.AudioRecord.class, minSdk=21) public final class ShadowAudioRecord extends Object
AudioRecord
which by default will fulfil any requests for audio data by completely
filling any requested buffers.
It is also possible to provide the underlying data by implementing ShadowAudioRecord.AudioRecordSource
and setting this via setSourceProvider(AudioRecordSourceProvider)
.
Modifier and Type | Class | Description |
---|---|---|
static interface |
ShadowAudioRecord.AudioRecordSource |
Provides underlying data for the
ShadowAudioRecord . |
static interface |
ShadowAudioRecord.AudioRecordSourceProvider |
Provides
ShadowAudioRecord.AudioRecordSource for the given AudioRecord . |
Constructor | Description |
---|---|
ShadowAudioRecord() |
Modifier and Type | Method | Description |
---|---|---|
static void |
clearSource() |
Resets
ShadowAudioRecord.AudioRecordSource to be used for providing data to AudioRecord , so that
all requests are fulfilled for audio data by completely filling any requested buffers. |
protected static int |
native_get_min_buff_size(int sampleRateInHz,
int channelCount,
int audioFormat) |
|
protected int |
native_read_in_byte_array(byte[] audioData,
int offsetInBytes,
int sizeInBytes) |
|
protected int |
native_read_in_byte_array(byte[] audioData,
int offsetInBytes,
int sizeInBytes,
boolean isBlocking) |
|
protected int |
native_read_in_direct_buffer(Object jBuffer,
int sizeInBytes) |
|
protected int |
native_read_in_direct_buffer(Object jBuffer,
int sizeInBytes,
boolean isBlocking) |
|
protected int |
native_read_in_float_array(float[] audioData,
int offsetInFloats,
int sizeInFloats,
boolean isBlocking) |
|
protected int |
native_read_in_short_array(short[] audioData,
int offsetInShorts,
int sizeInShorts) |
|
protected int |
native_read_in_short_array(short[] audioData,
int offsetInShorts,
int sizeInShorts,
boolean isBlocking) |
|
protected int |
native_start(int syncEvent,
int sessionId) |
|
static void |
setSource(ShadowAudioRecord.AudioRecordSource source) |
Deprecated.
|
static void |
setSourceProvider(ShadowAudioRecord.AudioRecordSourceProvider audioRecordSourceProvider) |
Sets
ShadowAudioRecord.AudioRecordSourceProvider to be used for providing data of AudioRecord . |
@Deprecated public static void setSource(ShadowAudioRecord.AudioRecordSource source)
setSourceProvider(AudioRecordSourceProvider)
.ShadowAudioRecord.AudioRecordSource
to be used for providing data to AudioRecord
.public static void setSourceProvider(ShadowAudioRecord.AudioRecordSourceProvider audioRecordSourceProvider)
ShadowAudioRecord.AudioRecordSourceProvider
to be used for providing data of AudioRecord
.@Resetter public static void clearSource()
ShadowAudioRecord.AudioRecordSource
to be used for providing data to AudioRecord
, so that
all requests are fulfilled for audio data by completely filling any requested buffers.@Implementation protected static int native_get_min_buff_size(int sampleRateInHz, int channelCount, int audioFormat)
@Implementation protected int native_start(int syncEvent, int sessionId)
protected int native_read_in_byte_array(byte[] audioData, int offsetInBytes, int sizeInBytes)
@Implementation(minSdk=23) protected int native_read_in_byte_array(byte[] audioData, int offsetInBytes, int sizeInBytes, boolean isBlocking)
protected int native_read_in_short_array(short[] audioData, int offsetInShorts, int sizeInShorts)
@Implementation(minSdk=23) protected int native_read_in_short_array(short[] audioData, int offsetInShorts, int sizeInShorts, boolean isBlocking)
@Implementation(minSdk=23) protected int native_read_in_float_array(float[] audioData, int offsetInFloats, int sizeInFloats, boolean isBlocking)
protected int native_read_in_direct_buffer(Object jBuffer, int sizeInBytes)
@Implementation(minSdk=23) protected int native_read_in_direct_buffer(Object jBuffer, int sizeInBytes, boolean isBlocking)