Package org.robolectric.shadows
Class ShadowAudioRecord
java.lang.Object
org.robolectric.shadows.ShadowAudioRecord
Shadow
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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides underlying data for theShadowAudioRecord.static interfaceProvidesShadowAudioRecord.AudioRecordSourcefor the givenAudioRecord. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidResetsShadowAudioRecord.AudioRecordSourceto be used for providing data toAudioRecord, so that all requests are fulfilled for audio data by completely filling any requested buffers.protected static intnative_get_min_buff_size(int sampleRateInHz, int channelCount, int audioFormat) protected intnative_read_in_byte_array(byte[] audioData, int offsetInBytes, int sizeInBytes) protected intnative_read_in_byte_array(byte[] audioData, int offsetInBytes, int sizeInBytes, boolean isBlocking) protected intnative_read_in_direct_buffer(Object jBuffer, int sizeInBytes) protected intnative_read_in_direct_buffer(Object jBuffer, int sizeInBytes, boolean isBlocking) protected intnative_read_in_float_array(float[] audioData, int offsetInFloats, int sizeInFloats, boolean isBlocking) protected intnative_read_in_short_array(short[] audioData, int offsetInShorts, int sizeInShorts) protected intnative_read_in_short_array(short[] audioData, int offsetInShorts, int sizeInShorts, boolean isBlocking) protected booleannative_setInputDevice(int preferredDeviceId) protected intnative_start(int syncEvent, int sessionId) static voidDeprecated.static voidsetSourceProvider(ShadowAudioRecord.AudioRecordSourceProvider audioRecordSourceProvider) SetsShadowAudioRecord.AudioRecordSourceProviderto be used for providing data ofAudioRecord.
-
Constructor Details
-
ShadowAudioRecord
public ShadowAudioRecord()
-
-
Method Details
-
setSource
Deprecated.SetsShadowAudioRecord.AudioRecordSourceto be used for providing data toAudioRecord. -
setSourceProvider
public static void setSourceProvider(ShadowAudioRecord.AudioRecordSourceProvider audioRecordSourceProvider) SetsShadowAudioRecord.AudioRecordSourceProviderto be used for providing data ofAudioRecord. -
clearSource
ResetsShadowAudioRecord.AudioRecordSourceto be used for providing data toAudioRecord, so that all requests are fulfilled for audio data by completely filling any requested buffers. -
native_get_min_buff_size
@Implementation protected static int native_get_min_buff_size(int sampleRateInHz, int channelCount, int audioFormat) -
native_start
-
native_read_in_byte_array
@Implementation(maxSdk=22) protected int native_read_in_byte_array(byte[] audioData, int offsetInBytes, int sizeInBytes) -
native_read_in_byte_array
@Implementation(minSdk=23) protected int native_read_in_byte_array(byte[] audioData, int offsetInBytes, int sizeInBytes, boolean isBlocking) -
native_read_in_short_array
@Implementation(maxSdk=22) protected int native_read_in_short_array(short[] audioData, int offsetInShorts, int sizeInShorts) -
native_read_in_short_array
@Implementation(minSdk=23) protected int native_read_in_short_array(short[] audioData, int offsetInShorts, int sizeInShorts, boolean isBlocking) -
native_read_in_float_array
@Implementation(minSdk=23) protected int native_read_in_float_array(float[] audioData, int offsetInFloats, int sizeInFloats, boolean isBlocking) -
native_read_in_direct_buffer
@Implementation(maxSdk=22) protected int native_read_in_direct_buffer(Object jBuffer, int sizeInBytes) -
native_read_in_direct_buffer
@Implementation(minSdk=23) protected int native_read_in_direct_buffer(Object jBuffer, int sizeInBytes, boolean isBlocking) -
native_setInputDevice
-
setSourceProvider(AudioRecordSourceProvider).