-
- All Implemented Interfaces:
-
com.twilio.voice.AudioDevice,com.twilio.voice.AudioDeviceCapturer,com.twilio.voice.AudioDeviceRenderer
public class DefaultAudioDevice implements AudioDevice
DefaultAudioDevice is the default audio device module SDK uses when a custom one is not provided.
By default, the Voice SDK uses `DefaultAudioDevice` to capture and render audio. The SDK performs acoustic echo cancellation (AEC) and noise suppression (NS) using device hardware by default. Using device hardware is more efficient, but some devices do not implement these audio effects well. `DefaultAudioDevice` provides API `setUseHardwareAcousticEchoCanceler(...)` or `setUseHardwareNoiseSuppressor(...)` to toggle the default behavior. If you are experiencing echo or background noise on certain devices reference the following snippet for enabling software implementations of AEC and NS anytime before invoking `Voice.connect(...)` or `CallInvite.accept(...)`.
// Use software AEC DefaultAudioDevice defaultAudioDevice=new DefaultAudioDevice(); defaultAudioDevice.setUseHardwareAcousticEchoCanceler(false); Voice.setAudioDevice(defaultAudioDevice); // Use software NS DefaultAudioDevice defaultAudioDevice=new DefaultAudioDevice(); defaultAudioDevice.setUseHardwareNoiseSuppressor(false); Voice.setAudioDevice(defaultAudioDevice);
-
-
Field Summary
Fields Modifier and Type Field Description private booleanuseHardwareAcousticEchoCancelerprivate booleanuseHardwareNoiseSuppressor
-
Method Summary
Modifier and Type Method Description voidsetUseHardwareAcousticEchoCanceler(boolean useHardwareAcousticEchoCanceler)Control if the built-in hardware AEC should be used or not. voidsetUseHardwareNoiseSuppressor(boolean useHardwareNoiseSuppressor)Control if the built-in hardware noise suppressor should be used or not. booleanuseHardwareAcousticEchoCanceler()Indicates if the built-in hardware AEC is used or not. booleanuseHardwareNoiseSuppressor()Indicates if the built-in hardware noise suppressor is used or not. AudioFormatgetCapturerFormat()This method is a no-op that returns {@code null}.booleanonInitCapturer()This method is a no-op that returns {@code false}.booleanonStartCapturing(@NonNull() AudioDeviceContext audioDeviceContext)This method is a no-op that returns {@code false}.booleanonStopCapturing()This method is a no-op that returns {@code false}.AudioFormatgetRendererFormat()This method is a no-op that returns {@code null}.booleanonInitRenderer()This method is a no-op that returns {@code false}.booleanonStartRendering(@NonNull() AudioDeviceContext audioDeviceContext)This method is a no-op that returns {@code false}.booleanonStopRendering()This method is a no-op that returns {@code false}.-
Methods inherited from class com.twilio.voice.AudioDevice
audioDeviceExecuteWorkerBlock, audioDeviceFormatChanged, audioDeviceReadRenderData, audioDeviceWriteCaptureData -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setUseHardwareAcousticEchoCanceler
void setUseHardwareAcousticEchoCanceler(boolean useHardwareAcousticEchoCanceler)
Control if the built-in hardware AEC should be used or not. The default value is
{@code * true}.- Parameters:
useHardwareAcousticEchoCanceler- true if audio device should use hardware AEC, falseotherwise
-
setUseHardwareNoiseSuppressor
void setUseHardwareNoiseSuppressor(boolean useHardwareNoiseSuppressor)
Control if the built-in hardware noise suppressor should be used or not. The default value is
{@code true}.- Parameters:
useHardwareNoiseSuppressor- true if audio device should use hardware noise suppressor,false otherwise.
-
useHardwareAcousticEchoCanceler
boolean useHardwareAcousticEchoCanceler()
Indicates if the built-in hardware AEC is used or not. The default value is
{@code true}.
-
useHardwareNoiseSuppressor
boolean useHardwareNoiseSuppressor()
Indicates if the built-in hardware noise suppressor is used or not. The default value is
{@code true}.
-
getCapturerFormat
@Nullable() AudioFormat getCapturerFormat()
This method is a no-op that returns
{@code null}.
-
onInitCapturer
boolean onInitCapturer()
This method is a no-op that returns
{@code false}.
-
onStartCapturing
boolean onStartCapturing(@NonNull() AudioDeviceContext audioDeviceContext)
This method is a no-op that returns
{@code false}.
-
onStopCapturing
boolean onStopCapturing()
This method is a no-op that returns
{@code false}.
-
getRendererFormat
@Nullable() AudioFormat getRendererFormat()
This method is a no-op that returns
{@code null}.
-
onInitRenderer
boolean onInitRenderer()
This method is a no-op that returns
{@code false}.
-
onStartRendering
boolean onStartRendering(@NonNull() AudioDeviceContext audioDeviceContext)
This method is a no-op that returns
{@code false}.
-
onStopRendering
boolean onStopRendering()
This method is a no-op that returns
{@code false}.
-
-
-
-