Package tvi.webrtc.audio
Class JavaAudioDeviceModule.Builder
- java.lang.Object
-
- tvi.webrtc.audio.JavaAudioDeviceModule.Builder
-
- Enclosing class:
- JavaAudioDeviceModule
public static class JavaAudioDeviceModule.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaAudioDeviceModulecreateAudioDeviceModule()Construct an AudioDeviceModule based on the supplied arguments.JavaAudioDeviceModule.BuildersetAudioAttributes(android.media.AudioAttributes audioAttributes)Set customAudioAttributesto use.JavaAudioDeviceModule.BuildersetAudioFormat(int audioFormat)Call this to change the audio format.JavaAudioDeviceModule.BuildersetAudioRecordErrorCallback(JavaAudioDeviceModule.AudioRecordErrorCallback audioRecordErrorCallback)Set a callback to retrieve errors from the AudioRecord.JavaAudioDeviceModule.BuildersetAudioRecordStateCallback(JavaAudioDeviceModule.AudioRecordStateCallback audioRecordStateCallback)Set a callback to retrieve information from the AudioRecord on when audio starts and stops.JavaAudioDeviceModule.BuildersetAudioSource(int audioSource)Call this to change the audio source.JavaAudioDeviceModule.BuildersetAudioTrackErrorCallback(JavaAudioDeviceModule.AudioTrackErrorCallback audioTrackErrorCallback)Set a callback to retrieve errors from the AudioTrack.JavaAudioDeviceModule.BuildersetAudioTrackStateCallback(JavaAudioDeviceModule.AudioTrackStateCallback audioTrackStateCallback)Set a callback to retrieve information from the AudioTrack on when audio starts and stop.JavaAudioDeviceModule.BuildersetInputSampleRate(int inputSampleRate)Call this method to specifically override input sample rate.JavaAudioDeviceModule.BuildersetOutputSampleRate(int outputSampleRate)Call this method to specifically override output sample rate.JavaAudioDeviceModule.BuildersetSampleRate(int sampleRate)Call this method if the default handling of querying the native sample rate shall be overridden.JavaAudioDeviceModule.BuildersetSamplesReadyCallback(JavaAudioDeviceModule.SamplesReadyCallback samplesReadyCallback)Set a callback to listen to the raw audio input from the AudioRecord.JavaAudioDeviceModule.BuildersetScheduler(java.util.concurrent.ScheduledExecutorService scheduler)JavaAudioDeviceModule.BuildersetUseHardwareAcousticEchoCanceler(boolean useHardwareAcousticEchoCanceler)Control if the built-in HW acoustic echo canceler should be used or not.JavaAudioDeviceModule.BuildersetUseHardwareNoiseSuppressor(boolean useHardwareNoiseSuppressor)Control if the built-in HW noise suppressor should be used or not.JavaAudioDeviceModule.BuildersetUseStereoInput(boolean useStereoInput)Control if stereo input should be used or not.JavaAudioDeviceModule.BuildersetUseStereoOutput(boolean useStereoOutput)Control if stereo output should be used or not.
-
-
-
Method Detail
-
setScheduler
public JavaAudioDeviceModule.Builder setScheduler(java.util.concurrent.ScheduledExecutorService scheduler)
-
setSampleRate
public JavaAudioDeviceModule.Builder setSampleRate(int sampleRate)
Call this method if the default handling of querying the native sample rate shall be overridden. Can be useful on some devices where the available Android APIs are known to return invalid results.
-
setInputSampleRate
public JavaAudioDeviceModule.Builder setInputSampleRate(int inputSampleRate)
Call this method to specifically override input sample rate.
-
setOutputSampleRate
public JavaAudioDeviceModule.Builder setOutputSampleRate(int outputSampleRate)
Call this method to specifically override output sample rate.
-
setAudioSource
public JavaAudioDeviceModule.Builder setAudioSource(int audioSource)
Call this to change the audio source. The argument should be one of the values from android.media.MediaRecorder.AudioSource. The default is AudioSource.VOICE_COMMUNICATION.
-
setAudioFormat
public JavaAudioDeviceModule.Builder setAudioFormat(int audioFormat)
Call this to change the audio format. The argument should be one of the values from android.media.AudioFormat ENCODING_PCM_8BIT, ENCODING_PCM_16BIT or ENCODING_PCM_FLOAT. Default audio data format is PCM 16 bit per sample. Guaranteed to be supported by all devices.
-
setAudioTrackErrorCallback
public JavaAudioDeviceModule.Builder setAudioTrackErrorCallback(JavaAudioDeviceModule.AudioTrackErrorCallback audioTrackErrorCallback)
Set a callback to retrieve errors from the AudioTrack.
-
setAudioRecordErrorCallback
public JavaAudioDeviceModule.Builder setAudioRecordErrorCallback(JavaAudioDeviceModule.AudioRecordErrorCallback audioRecordErrorCallback)
Set a callback to retrieve errors from the AudioRecord.
-
setSamplesReadyCallback
public JavaAudioDeviceModule.Builder setSamplesReadyCallback(JavaAudioDeviceModule.SamplesReadyCallback samplesReadyCallback)
Set a callback to listen to the raw audio input from the AudioRecord.
-
setAudioTrackStateCallback
public JavaAudioDeviceModule.Builder setAudioTrackStateCallback(JavaAudioDeviceModule.AudioTrackStateCallback audioTrackStateCallback)
Set a callback to retrieve information from the AudioTrack on when audio starts and stop.
-
setAudioRecordStateCallback
public JavaAudioDeviceModule.Builder setAudioRecordStateCallback(JavaAudioDeviceModule.AudioRecordStateCallback audioRecordStateCallback)
Set a callback to retrieve information from the AudioRecord on when audio starts and stops.
-
setUseHardwareNoiseSuppressor
public JavaAudioDeviceModule.Builder setUseHardwareNoiseSuppressor(boolean useHardwareNoiseSuppressor)
Control if the built-in HW noise suppressor should be used or not. The default is on if it is supported. It is possible to query support by calling isBuiltInNoiseSuppressorSupported().
-
setUseHardwareAcousticEchoCanceler
public JavaAudioDeviceModule.Builder setUseHardwareAcousticEchoCanceler(boolean useHardwareAcousticEchoCanceler)
Control if the built-in HW acoustic echo canceler should be used or not. The default is on if it is supported. It is possible to query support by calling isBuiltInAcousticEchoCancelerSupported().
-
setUseStereoInput
public JavaAudioDeviceModule.Builder setUseStereoInput(boolean useStereoInput)
Control if stereo input should be used or not. The default is mono.
-
setUseStereoOutput
public JavaAudioDeviceModule.Builder setUseStereoOutput(boolean useStereoOutput)
Control if stereo output should be used or not. The default is mono.
-
setAudioAttributes
public JavaAudioDeviceModule.Builder setAudioAttributes(android.media.AudioAttributes audioAttributes)
Set customAudioAttributesto use.
-
createAudioDeviceModule
public JavaAudioDeviceModule createAudioDeviceModule()
Construct an AudioDeviceModule based on the supplied arguments. The caller takes ownership and is responsible for calling release().
-
-