fm.liveswitch.android.AudioRecordSource Class Reference

An Android AudioRecord-based source. More...

Public Member Functions

 AudioRecordSource (Context context, AudioConfig config)
 Initializes a new instance of the AudioRecordSource class. More...
 
int getAudioSource ()
 Gets the desired audio source (MediaRecorder.AudioSource). Defaults to MediaRecorder.AudioSource.VOICE_COMMUNICATION, except for Android versions prior to Honeycomb, which default to MediaRecorder.AudioSource.MIC. More...
 
void setAudioSource (int audioSource)
 Sets the desired audio source (MediaRecorder.AudioSource). Defaults to MediaRecorder.AudioSource.VOICE_COMMUNICATION, except for Android versions prior to Honeycomb, which default to MediaRecorder.AudioSource.MIC. More...
 
boolean getUseAcousticEchoCanceler ()
 Gets whether or not the Android AcousticEchoCanceler should be used. Defaults to false. More...
 
void setUseAcousticEchoCanceler (boolean useAcousticEchoCanceler)
 Sets whether or not the Android AcousticEchoCanceler should be used. Defaults to false. More...
 
boolean getUseAutomaticGainControl ()
 Gets whether or not the Android AutomaticGainControl should be used. Defaults to true. More...
 
void setUseAutomaticGainControl (boolean useAutomaticGainControl)
 Sets whether or not the Android AutomaticGainControl should be used. Defaults to true. More...
 
boolean getUseNoiseSuppressor ()
 Gets whether or not the Android NoiseSuppressor should be used. Defaults to true. More...
 
void setUseNoiseSuppressor (boolean useNoiseSuppressor)
 Sets whether or not the Android NoiseSuppressor should be used. Defaults to true. More...
 
Future< SourceInput[]> getInputs ()
 Gets the available inputs. More...
 
String getLabel ()
 Gets a label that identifies this class. More...
 
boolean destroy ()
 Destroys this instance. More...
 
boolean isBluetoothHeadsetConnected ()
 
void routeToBluetoothHeadset ()
 
- Public Member Functions inherited from fm.liveswitch.AudioSource
 AudioSource (fm.liveswitch.AudioFormat outputFormat)
 Initializes a new instance of the fm.liveswitch.AudioSource class. More...
 
 AudioSource (fm.liveswitch.AudioFormat outputFormat, int frameDuration)
 Initializes a new instance of the fm.liveswitch.AudioSource class. More...
 
int calculateDuration (int dataLength)
 Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format. More...
 
int calculateDurationFloat (int dataLength)
 Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format. More...
 
fm.liveswitch.AudioConfig getConfig ()
 Gets the output configuration. More...
 
boolean getDisableTimestampReset ()
 Gets whether the timestamp should be reset using the wall clock after fm.liveswitch.AudioSource#getTimestampResetInterval milliseconds elapse between frames. More...
 
boolean getForceTimestampReset ()
 Gets whether the timestamp should be reset before the next frame is processed. More...
 
int getFrameDuration ()
 Gets the frame duration in milliseconds. More...
 
int getTimestampResetInterval ()
 Gets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock. More...
 
double getVolume ()
 Gets a value indicating the volume (output resistance) of this source. More...
 
void setDisableTimestampReset (boolean value)
 Sets whether the timestamp should be reset using the wall clock after fm.liveswitch.AudioSource#getTimestampResetInterval milliseconds elapse between frames. More...
 
void setForceTimestampReset (boolean value)
 Sets whether the timestamp should be reset before the next frame is processed. More...
 
void setTimestampResetInterval (int value)
 Sets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock. More...
 
void setVolume (double value)
 Sets a value indicating the volume (output resistance) of this source. More...
 
- Public Member Functions inherited from fm.liveswitch.MediaSourceBase
String getExternalId ()
 Gets the external identifier. More...
 
String getId ()
 Gets the identifier. More...
 
String getTag ()
 Gets optional data to associate with this instance. More...
 
void setExternalId (String value)
 Sets the external identifier. More...
 
void setTag (String value)
 Sets optional data to associate with this instance. More...
 
abstract fm.liveswitch.Future< Object > start ()
 Starts this instance. More...
 
abstract fm.liveswitch.Future< Object > stop ()
 Stops this instance. More...
 
- Public Member Functions inherited from fm.liveswitch.Dynamic
java.util.HashMap< String, Object > getDynamicProperties ()
 Gets all dynamic properties on this instance. More...
 
Object getDynamicValue (String key)
 Gets a property value from the local cache. More...
 
void setDynamicValue (String key, Object value)
 Sets a property value in the local cache. More...
 
boolean unsetDynamicValue (String key)
 Removes a property value from the local cache. More...
 
- Public Member Functions inherited from fm.liveswitch.IElement
abstract String getExternalId ()
 Gets the external identifier. More...
 
abstract String getId ()
 Gets the identifier. More...
 
abstract String getPipelineJson ()
 Gets the pipeline JSON with this as the central point. More...
 
abstract void setExternalId (String value)
 Sets the external identifier. More...
 
- Public Member Functions inherited from fm.liveswitch.IMediaElement
abstract boolean getDeactivated ()
 Gets a value indicating whether this instance is deactivated. More...
 
abstract boolean getDisabled ()
 Gets a value indicating whether this instance is disabled. More...
 
abstract boolean getMuted ()
 Gets a value indicating whether this instance is muted. More...
 
abstract boolean getPaused ()
 Gets a value indicating whether this instance is paused. More...
 
abstract boolean getPersistent ()
 Gets a value indicating whether this instance is persistent. More...
 
abstract void setDeactivated (boolean value)
 Sets a value indicating whether this instance is deactivated. More...
 
abstract void setMuted (boolean value)
 Sets a value indicating whether this instance is muted. More...
 

Static Public Member Functions

static void addDeviceToVoiceCommunicationBlackList (String deviceModel)
 Add device to voiceCommunicationBlackList. Parameter is device model More...
 
static void removeDeviceFromVoiceCommunicationBlackList (String deviceModel)
 Remove device to voiceCommunicationBlackList Parameter is device model More...
 
static String[] getVoiceCommunicationBlackList ()
 Remove device to voiceCommunicationBlackList More...
 
static int getBufferDelay (AudioConfig config)
 Gets the length of the audio buffer in milliseconds. More...
 
- Static Public Member Functions inherited from fm.liveswitch.AudioSource
static int calculateDuration (int dataLength, int clockRate, int channelCount)
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
static int calculateDuration (int dataLength, fm.liveswitch.AudioConfig config)
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 
static int calculateDurationFloat (int dataLength, int clockRate, int channelCount)
 Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More...
 

Protected Member Functions

Future< Object > doStart ()
 
Future< Object > doStop ()
 
- Protected Member Functions inherited from fm.liveswitch.AudioSource
fm.liveswitch.IAudioInputCollection createInputCollection (fm.liveswitch.IAudioOutput output)
 Creates an input collection. More...
 
void doDestroy ()
 
void raiseFrame (fm.liveswitch.AudioFrame frame)
 Raises a frame. More...
 
boolean trySetSystemTimestamp (fm.liveswitch.AudioFrame frame)
 Tries to set the system timestamp on an audio frame. More...
 
boolean trySetTimestamp (fm.liveswitch.AudioFrame frame)
 Tries to set the timestamp on an audio frame. More...
 
- Protected Member Functions inherited from fm.liveswitch.MediaSourceBase
 MediaSourceBase ()
 
- Protected Member Functions inherited from fm.liveswitch.Dynamic
 Dynamic ()
 
- Protected Member Functions inherited from fm.liveswitch.Serializable
boolean getIsDirty ()
 Gets a value indicating whether this instance is dirty. More...
 
 Serializable ()
 Initializes a new instance of the fm.liveswitch.Serializable class. More...
 
void setIsDirty (boolean value)
 Sets a value indicating whether this instance is dirty. More...
 

Detailed Description

An Android AudioRecord-based source.

Constructor & Destructor Documentation

◆ AudioRecordSource()

fm.liveswitch.android.AudioRecordSource.AudioRecordSource ( Context  context,
AudioConfig  config 
)

Initializes a new instance of the AudioRecordSource class.

Parameters
configThe configuration.
contextThe Android context.

Member Function Documentation

◆ addDeviceToVoiceCommunicationBlackList()

static void fm.liveswitch.android.AudioRecordSource.addDeviceToVoiceCommunicationBlackList ( String  deviceModel)
static

Add device to voiceCommunicationBlackList. Parameter is device model

◆ destroy()

boolean fm.liveswitch.android.AudioRecordSource.destroy ( )

Destroys this instance.

Implements fm.liveswitch.IMediaElement.

◆ doStart()

Future<Object> fm.liveswitch.android.AudioRecordSource.doStart ( )
protected

◆ doStop()

Future<Object> fm.liveswitch.android.AudioRecordSource.doStop ( )
protected

◆ getAudioSource()

int fm.liveswitch.android.AudioRecordSource.getAudioSource ( )

Gets the desired audio source (MediaRecorder.AudioSource). Defaults to MediaRecorder.AudioSource.VOICE_COMMUNICATION, except for Android versions prior to Honeycomb, which default to MediaRecorder.AudioSource.MIC.

◆ getBufferDelay()

static int fm.liveswitch.android.AudioRecordSource.getBufferDelay ( AudioConfig  config)
static

Gets the length of the audio buffer in milliseconds.

◆ getInputs()

Future<SourceInput[]> fm.liveswitch.android.AudioRecordSource.getInputs ( )

Gets the available inputs.

◆ getLabel()

String fm.liveswitch.android.AudioRecordSource.getLabel ( )

Gets a label that identifies this class.

Implements fm.liveswitch.IMediaElement.

◆ getUseAcousticEchoCanceler()

boolean fm.liveswitch.android.AudioRecordSource.getUseAcousticEchoCanceler ( )

Gets whether or not the Android AcousticEchoCanceler should be used. Defaults to false.

◆ getUseAutomaticGainControl()

boolean fm.liveswitch.android.AudioRecordSource.getUseAutomaticGainControl ( )

Gets whether or not the Android AutomaticGainControl should be used. Defaults to true.

◆ getUseNoiseSuppressor()

boolean fm.liveswitch.android.AudioRecordSource.getUseNoiseSuppressor ( )

Gets whether or not the Android NoiseSuppressor should be used. Defaults to true.

◆ getVoiceCommunicationBlackList()

static String [] fm.liveswitch.android.AudioRecordSource.getVoiceCommunicationBlackList ( )
static

Remove device to voiceCommunicationBlackList

◆ isBluetoothHeadsetConnected()

boolean fm.liveswitch.android.AudioRecordSource.isBluetoothHeadsetConnected ( )

◆ removeDeviceFromVoiceCommunicationBlackList()

static void fm.liveswitch.android.AudioRecordSource.removeDeviceFromVoiceCommunicationBlackList ( String  deviceModel)
static

Remove device to voiceCommunicationBlackList Parameter is device model

◆ routeToBluetoothHeadset()

void fm.liveswitch.android.AudioRecordSource.routeToBluetoothHeadset ( )

◆ setAudioSource()

void fm.liveswitch.android.AudioRecordSource.setAudioSource ( int  audioSource)

Sets the desired audio source (MediaRecorder.AudioSource). Defaults to MediaRecorder.AudioSource.VOICE_COMMUNICATION, except for Android versions prior to Honeycomb, which default to MediaRecorder.AudioSource.MIC.

◆ setUseAcousticEchoCanceler()

void fm.liveswitch.android.AudioRecordSource.setUseAcousticEchoCanceler ( boolean  useAcousticEchoCanceler)

Sets whether or not the Android AcousticEchoCanceler should be used. Defaults to false.

◆ setUseAutomaticGainControl()

void fm.liveswitch.android.AudioRecordSource.setUseAutomaticGainControl ( boolean  useAutomaticGainControl)

Sets whether or not the Android AutomaticGainControl should be used. Defaults to true.

◆ setUseNoiseSuppressor()

void fm.liveswitch.android.AudioRecordSource.setUseNoiseSuppressor ( boolean  useNoiseSuppressor)

Sets whether or not the Android NoiseSuppressor should be used. Defaults to true.