com.avaya.deskphoneservices

## Class AudioInterfaceWrapper

- java.lang.Object
- - com.avaya.deskphoneservices.AudioInterfaceWrapper

- All Implemented Interfaces:
    com.avaya.clientservices.media.AudioInterface

      public class AudioInterfaceWrapper
      extends java.lang.Object
      implements com.avaya.clientservices.media.AudioInterface

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AudioInterfaceWrapper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAudioDeviceListener(com.avaya.clientservices.media.AudioDeviceListener listener)` Add a new listener to be informed when audio devices are added and removed or audio state changes.
    `com.avaya.clientservices.media.audio.AudioCapturer` | `createAudioCapturer(com.avaya.clientservices.media.audio.AudioCapturerConfig cfg, com.avaya.clientservices.media.audio.AudioStreamListener callback)` This function creates AudioCapturer object, which provides audio capture control capability.
    `com.avaya.clientservices.media.AudioFilePlayer` | `createAudioFilePlayer(android.content.Context context, com.avaya.clientservices.media.AudioFilePlayerListener pAudioFilePlayerListener)` Create an Audio File Player.
    `com.avaya.clientservices.media.audio.AudioMixer` | `createAudioMixer(com.avaya.clientservices.media.audio.AudioMixerConfig cfg)` This function creates AudioMixer object, which provides audio mixing capability.
    `com.avaya.clientservices.media.AudioDevice` | `getActiveDevice()`
    `java.util.List<com.avaya.clientservices.media.AudioDeviceListener>` | `getAudioDeviceListeners()`
    `com.avaya.clientservices.media.AudioInterface` | `getAudioInterface()` Returns the Audio Interface instance.
    `com.avaya.clientservices.media.AutomaticGainControlConfiguration` | `getAutomaticGainControlConfiguration()` Gets the Automatic Gain Control configuration.
    `com.avaya.clientservices.media.AutomaticGainControlMode` | `getAutomaticGainControlMode()` Gets the Automatic Gain Control mode.
    `java.util.List<com.avaya.clientservices.media.AudioDevice>` | `getDevices()`
    `com.avaya.clientservices.media.EchoCancellationMobileMode` | `getEchoCancellationMobileMode()` Gets the Mobile Echo Cancellation mode.
    `com.avaya.clientservices.media.EchoCancellationMode` | `getEchoCancellationMode()` Gets the Echo Cancellation mode.
    `com.avaya.clientservices.media.AudioMode` | `getMode()`
    `com.avaya.clientservices.media.NoiseSuppressionMode` | `getNoiseSuppressionMode()` Gets the Noise Suppression mode.
    `com.avaya.clientservices.media.AudioDevice` | `getUserRequestedDevice()`
    `boolean` | `isMuted()` This function gets's the current mute status for all audio calls
    `boolean` | `isSpeakerMuted()` This function gets's the current mute status for speaker
    `boolean` | `isYieldBluetoothOnPhoneCall()` Get flag to auto-yield bluetooth on phone call (incoming or outgoing)
    `boolean` | `mute(boolean mute)` This function set's mute status for all audio calls
    `boolean` | `muteSpeaker(boolean mute)` This function set's mute status for speaker
    `void` | `registerRecordPlayStatusListener(com.avaya.clientservices.media.AudioRecordPlayStatusListener listener)` Sets a listener that wants to track playback and recording status.
    `void` | `removeAudioDeviceListener(com.avaya.clientservices.media.AudioDeviceListener listener)` Remove an existing listener informing when audio device are added and removed.
    `void` | `setAudioDeviceSelectionListener(AudioDeviceSelectionChangeListener audioDeviceSelectionListener)`
    `void` | `setAudioInterface(com.avaya.clientservices.media.AudioInterface audioInterface)` This function sets a new Audio Interface.
    `boolean` | `setAutomaticGainControlConfiguration(com.avaya.clientservices.media.AutomaticGainControlConfiguration config)` Sets the Automatic Gain Control configuration.
    `boolean` | `setAutomaticGainControlMode(com.avaya.clientservices.media.AutomaticGainControlMode mode)` Sets the Automatic Gain Control mode.
    `boolean` | `setDscp(int dscpValue)` This function sets DSCP value for audio.
    `boolean` | `setEchoCancellationMobileMode(com.avaya.clientservices.media.EchoCancellationMobileMode mode)` Sets the Echo Cancellation Mobile mode.
    `boolean` | `setEchoCancellationMode(com.avaya.clientservices.media.EchoCancellationMode mode)` Sets the Echo Cancellation mode.
    `void` | `setMode(com.avaya.clientservices.media.AudioMode mode)` setMode will immediatly set the mode using AudioManager.setMode().
    `boolean` | `setNoiseSuppressionMode(com.avaya.clientservices.media.NoiseSuppressionMode mode)` Sets the Noise Suppression mode.
    `boolean` | `setUserRequestedDevice(com.avaya.clientservices.media.AudioDevice device)` User preferred audio device.
    `boolean` | `setYieldBluetoothOnPhoneCall(boolean yieldBluetoothOnPhoneCall)` Set flag to auto-yield bluetooth on phone call (incoming or outgoing)
    `boolean` | `yieldBluetooth()` yield bluetooth

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AudioInterfaceWrapper

          public AudioInterfaceWrapper()

  - ### Method Detail

    - #### setMode

          public void setMode(com.avaya.clientservices.media.AudioMode mode)

      setMode will immediatly set the mode using AudioManager.setMode(). If the necessary the media engine will restore the mode if finds that it has been changed either by other applications or by the applicaiton. The application should never call AudioManger.setMode() directly if it is using the AudioInterface APIs.
      Specified by:
        `setMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mode` - Audio mode for the media engine to use.

    - #### getMode

          public com.avaya.clientservices.media.AudioMode getMode()

      Specified by:
        `getMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        AudioMode as returned by AudioManager.getMode().

    - #### getDevices

          public java.util.List<com.avaya.clientservices.media.AudioDevice> getDevices()

      Specified by:
        `getDevices` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        List of (AudioDevice) available audio devices.

    - #### getActiveDevice

          public com.avaya.clientservices.media.AudioDevice getActiveDevice()

      Specified by:
        `getActiveDevice` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        Audio output device currently used by the platform. It may be different from what user selected.

    - #### getUserRequestedDevice

          public com.avaya.clientservices.media.AudioDevice getUserRequestedDevice()

      Specified by:
        `getUserRequestedDevice` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        Audio device requested by the user.

    - #### setUserRequestedDevice

          public boolean setUserRequestedDevice(com.avaya.clientservices.media.AudioDevice device)

      User preferred audio device. This affects both playback and microphone devices. When the audio device is set to HANDSET or SPEAKER, the platform built-in microphone device of the platform is selected. When it is set to WIRED_HEADSET, depending on the headset's capabilities, either the headset's microphone or the platform built-in microphone is selected. When it is set to BLUETOOTH_HEADSET, the headset's microphone is selected.
      Specified by:
        `setUserRequestedDevice` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `device` - Selected device
      Returns:
        True if successful, false otherwise.

    - #### yieldBluetooth

          public boolean yieldBluetooth()

      yield bluetooth
      Specified by:
        `yieldBluetooth` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        `true` if successful; false, otherwise.

    - #### setYieldBluetoothOnPhoneCall

          public boolean setYieldBluetoothOnPhoneCall(boolean yieldBluetoothOnPhoneCall)

      Set flag to auto-yield bluetooth on phone call (incoming or outgoing)
      Specified by:
        `setYieldBluetoothOnPhoneCall` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `yieldBluetoothOnPhoneCall` - The new yield status
      Returns:
        `true` if successful; false, otherwise.

    - #### isYieldBluetoothOnPhoneCall

          public boolean isYieldBluetoothOnPhoneCall()

      Get flag to auto-yield bluetooth on phone call (incoming or outgoing)
      Specified by:
        `isYieldBluetoothOnPhoneCall` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        `true` if currently yielding; false, otherwise.

    - #### mute

          public boolean mute(boolean mute)

      This function set's mute status for all audio calls
      Specified by:
        `mute` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mute` - The new mute status
      Returns:
        true if successful; false, otherwise.

    - #### isMuted

          public boolean isMuted()

      This function gets's the current mute status for all audio calls
      Specified by:
        `isMuted` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        audio mute status

    - #### muteSpeaker

          public boolean muteSpeaker(boolean mute)

      This function set's mute status for speaker
      Specified by:
        `muteSpeaker` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mute` - The new mute status
      Returns:
        true if successful; false, otherwise.

    - #### isSpeakerMuted

          public boolean isSpeakerMuted()

      This function gets's the current mute status for speaker
      Specified by:
        `isSpeakerMuted` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        speaker mute status

    - #### createAudioFilePlayer

          public com.avaya.clientservices.media.AudioFilePlayer createAudioFilePlayer(android.content.Context context,
                                                                                      com.avaya.clientservices.media.AudioFilePlayerListener pAudioFilePlayerListener)

      Create an Audio File Player.
      Specified by:
        `createAudioFilePlayer` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `context` - Caller's context
        `pAudioFilePlayerListener` - AudioFilePlayerListener for start/stop events.
      Returns:
        AudioFilePlayer to control audio playback.

    - #### registerRecordPlayStatusListener

          public void registerRecordPlayStatusListener(com.avaya.clientservices.media.AudioRecordPlayStatusListener listener)

      Sets a listener that wants to track playback and recording status. This is used for notifying when media streams are initialized, started or stopped.
      Specified by:
        `registerRecordPlayStatusListener` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `listener` - Listener instance.

    - #### addAudioDeviceListener

          public void addAudioDeviceListener(com.avaya.clientservices.media.AudioDeviceListener listener)

      Add a new listener to be informed when audio devices are added and removed or audio state changes.
      Specified by:
        `addAudioDeviceListener` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `listener` - The new listener.

    - #### removeAudioDeviceListener

          public void removeAudioDeviceListener(com.avaya.clientservices.media.AudioDeviceListener listener)

      Remove an existing listener informing when audio device are added and removed. or audio state changes.
      Specified by:
        `removeAudioDeviceListener` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `listener` - The listener to be removed.

    - #### setEchoCancellationMode

          public boolean setEchoCancellationMode(com.avaya.clientservices.media.EchoCancellationMode mode)

      Sets the Echo Cancellation mode.
      Specified by:
        `setEchoCancellationMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mode` - EchoCancellationMode
      Returns:
        success (true) or failure (false)

    - #### getEchoCancellationMode

          public com.avaya.clientservices.media.EchoCancellationMode getEchoCancellationMode()

      Gets the Echo Cancellation mode.
      Specified by:
        `getEchoCancellationMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        EchoCancellationMode on success, null on failure

    - #### setEchoCancellationMobileMode

          public boolean setEchoCancellationMobileMode(com.avaya.clientservices.media.EchoCancellationMobileMode mode)

      Sets the Echo Cancellation Mobile mode.
      Specified by:
        `setEchoCancellationMobileMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mode` - EchoCancellationMobileMode
      Returns:
        success (true) or failure (false)

    - #### getEchoCancellationMobileMode

          public com.avaya.clientservices.media.EchoCancellationMobileMode getEchoCancellationMobileMode()

      Gets the Mobile Echo Cancellation mode.
      Specified by:
        `getEchoCancellationMobileMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        EchoCancellationMobileMode on success, null on failure

    - #### setNoiseSuppressionMode

          public boolean setNoiseSuppressionMode(com.avaya.clientservices.media.NoiseSuppressionMode mode)

      Sets the Noise Suppression mode.
      Specified by:
        `setNoiseSuppressionMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mode` - NoiseSuppressionMode
      Returns:
        success (true) or failure (false)

    - #### getNoiseSuppressionMode

          public com.avaya.clientservices.media.NoiseSuppressionMode getNoiseSuppressionMode()

      Gets the Noise Suppression mode.
      Specified by:
        `getNoiseSuppressionMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        NoiseSuppressionMode on success, null on failure

    - #### setAutomaticGainControlMode

          public boolean setAutomaticGainControlMode(com.avaya.clientservices.media.AutomaticGainControlMode mode)

      Sets the Automatic Gain Control mode.
      Specified by:
        `setAutomaticGainControlMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `mode` - AutomaticGainControlMode
      Returns:
        success (true) or failure (false)

    - #### getAutomaticGainControlMode

          public com.avaya.clientservices.media.AutomaticGainControlMode getAutomaticGainControlMode()

      Gets the Automatic Gain Control mode.
      Specified by:
        `getAutomaticGainControlMode` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        AutomaticGainControlMode on success, null on failure

    - #### setAutomaticGainControlConfiguration

          public boolean setAutomaticGainControlConfiguration(com.avaya.clientservices.media.AutomaticGainControlConfiguration config)

      Sets the Automatic Gain Control configuration.
      Specified by:
        `setAutomaticGainControlConfiguration` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `config` - AutomaticGainControlConfiguration object
      Returns:
        success (true) or failure (false)

    - #### getAutomaticGainControlConfiguration

          public com.avaya.clientservices.media.AutomaticGainControlConfiguration getAutomaticGainControlConfiguration()

      Gets the Automatic Gain Control configuration.
      Specified by:
        `getAutomaticGainControlConfiguration` in interface `com.avaya.clientservices.media.AudioInterface`
      Returns:
        AutomaticGainControlConfiguration object with configuration on success, null on failure

    - #### setDscp

          public boolean setDscp(int dscpValue)

      This function sets DSCP value for audio.
      Specified by:
        `setDscp` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `dscpValue` - DSCP value must be in range 0-63.
      Returns:
        true if DSCP value is set, otherwise false.

    - #### createAudioCapturer

          public com.avaya.clientservices.media.audio.AudioCapturer createAudioCapturer(com.avaya.clientservices.media.audio.AudioCapturerConfig cfg,
                                                                                        com.avaya.clientservices.media.audio.AudioStreamListener callback)
                                                                                 throws com.avaya.clientservices.media.audio.AudioCapturerException

      This function creates AudioCapturer object, which provides audio capture control capability.
      Specified by:
        `createAudioCapturer` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `cfg` - Configuration for audio capturing
        `callback` - A callback object, which will receive an incoming audio stream
      Returns:
        AudioCapturer object, which can be used for audio capture control
      Throws:
        `com.avaya.clientservices.media.audio.AudioCapturerException` - when fails to initialize AudioCapturer, refer to logs for more information

    - #### createAudioMixer

          public com.avaya.clientservices.media.audio.AudioMixer createAudioMixer(com.avaya.clientservices.media.audio.AudioMixerConfig cfg)
                                                                           throws com.avaya.clientservices.media.audio.AudioMixerException

      This function creates AudioMixer object, which provides audio mixing capability.
      Specified by:
        `createAudioMixer` in interface `com.avaya.clientservices.media.AudioInterface`
      Parameters:
        `cfg` - Configuration for audio mixing
      Returns:
        AudioMixer object, which can be used for providing data for mixing
      Throws:
        `com.avaya.clientservices.media.audio.AudioMixerException` - when fails to initialize AudioMixer, refer to logs for more information

    - #### setAudioInterface

          public void setAudioInterface(com.avaya.clientservices.media.AudioInterface audioInterface)

      This function sets a new Audio Interface.
      Parameters:
        `audioInterface` - the `AudioInterface` object.

    - #### getAudioInterface

          public com.avaya.clientservices.media.AudioInterface getAudioInterface()

      Returns the Audio Interface instance.
      Returns:
        the wrapped `AudioInterface` instance.

    - #### setAudioDeviceSelectionListener

          public void setAudioDeviceSelectionListener(AudioDeviceSelectionChangeListener audioDeviceSelectionListener)

    - #### getAudioDeviceListeners

          public java.util.List<com.avaya.clientservices.media.AudioDeviceListener> getAudioDeviceListeners()