Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
agora::rtc::INGAudioDeviceManager Class Referenceabstract

`#include <NGIAgoraAudioDeviceManager.h>`

Inherits agora::RefCountInterface.

## Public Member Functions
virtual agora_refptr< IRecordingDeviceSource > | createRecordingDeviceSource (char deviceId[kAdmMaxDeviceNameSize])=0
virtual int | setMicrophoneVolume (unsigned int volume, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getMicrophoneVolume (unsigned int &volume)=0
virtual int | setSpeakerVolume (unsigned int volume, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getSpeakerVolume (unsigned int &volume)=0
virtual int | setMicrophoneMute (bool mute, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getMicrophoneMute (bool &mute)=0
virtual int | setSpeakerMute (bool mute, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getSpeakerMute (bool &mute)=0
virtual int | getPlayoutAudioParameters (AudioParameters *params) const =0
virtual int | getRecordAudioParameters (AudioParameters *params) const =0
virtual int | setDefaultAudioRouting (AudioRoute route, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | changeAudioRouting (AudioRoute route, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setAudioRoutingSpeakerOn (bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getCurrentRouting (AudioRoute &route)=0
virtual int | getNumberOfPlayoutDevices ()=0
virtual int | getNumberOfRecordingDevices ()=0
virtual AudioDeviceInfo | getPlayoutDeviceInfo (int index)=0
virtual AudioDeviceInfo | getRecordingDeviceInfo (int index)=0
virtual int | setPlayoutDevice (int index, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setRecordingDevice (int index, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | followSystemPlaybackDevice (bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | followSystemRecordingDevice (bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setApplicationVolume (unsigned int volume, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getApplicationVolume (unsigned int &volume)=0
virtual int | setApplicationMuteState (bool mute, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getApplicationMuteState (bool &mute)=0
virtual AudioDeviceInfo | getLoopbackDeviceInfo (int index)=0
virtual int | setLoopbackDevice (int index, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | followSystemLoopbackDevice (bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | registerObserver (IAudioDeviceManagerObserver *observer, void(*safeDeleter)(IAudioDeviceManagerObserver *)=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | unregisterObserver (IAudioDeviceManagerObserver *observer)=0
virtual int | setupAudioAttributeContext (void *audioAttr, aosl_ref_t ares=AOSL_REF_INVALID)=0
Public Member Functions inherited from agora::RefCountInterface
virtual void | AddRef () const =0
virtual RefCountReleaseStatus | Release () const =0
virtual bool | HasOneRef () const =0

## Protected Member Functions
| ~INGAudioDeviceManager ()
Protected Member Functions inherited from agora::RefCountInterface
virtual | ~RefCountInterface ()

## Detailed Description

The INGAudioDeciceManager class.

This class provides access to audio volume and audio route control, as well as device enumeration and selection on the PC.

## Constructor & Destructor Documentation

## ◆ ~INGAudioDeviceManager()

agora::rtc::INGAudioDeviceManager::~INGAudioDeviceManager | ( |  | ) |
| inline protected

## Member Function Documentation

## ◆ createRecordingDeviceSource()

virtual agora_refptr< IRecordingDeviceSource > agora::rtc::INGAudioDeviceManager::createRecordingDeviceSource | ( | char | deviceId[kAdmMaxDeviceNameSize] | ) |
| pure virtual

Creates a audio device source object and returns the pointer.

Returns
  - The pointer to IRecordingDeviceSource, if the method call succeeds.
  - An empty pointer NULL: Failure.

## ◆ setMicrophoneVolume()

virtual int agora::rtc::INGAudioDeviceManager::setMicrophoneVolume | ( | unsigned int | volume,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the volume of the microphone.

Parameters

  volume | The volume of the microphone. The value range is [0, 255].

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getMicrophoneVolume()

virtual int agora::rtc::INGAudioDeviceManager::getMicrophoneVolume | ( | unsigned int & | volume | ) |
| pure virtual

Gets the volume of the microphone.

Parameters

  volume | The volume of the microphone.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setSpeakerVolume()

virtual int agora::rtc::INGAudioDeviceManager::setSpeakerVolume | ( | unsigned int | volume,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the volume of the speaker.

Parameters

  volume | The volume of the speaker. The value range is [2, 255].

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getSpeakerVolume()

virtual int agora::rtc::INGAudioDeviceManager::getSpeakerVolume | ( | unsigned int & | volume | ) |
| pure virtual

Gets the volume of the speaker.

Parameters

  volume | The volume of the speaker.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setMicrophoneMute()

virtual int agora::rtc::INGAudioDeviceManager::setMicrophoneMute | ( | bool | mute,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Captures or stops capturing the local audio with the microphone.

Parameters

  mute | Determines whether to capture or stop capturing the local audio with the microphone. true: Stop capturing the local audio. false: (Default) Capture the local audio.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getMicrophoneMute()

virtual int agora::rtc::INGAudioDeviceManager::getMicrophoneMute | ( | bool & | mute | ) |
| pure virtual

Gets the mute state of the microphone.

Parameters

  mute | The mute state of the microphone.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setSpeakerMute()

virtual int agora::rtc::INGAudioDeviceManager::setSpeakerMute | ( | bool | mute,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Plays or stops playing the remote audio with the speaker.

Parameters

  mute | Determines whether to play or stop playing the remote audio. true: Stop playing the remote audio. false: (Default) Play the remote audio.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getSpeakerMute()

virtual int agora::rtc::INGAudioDeviceManager::getSpeakerMute | ( | bool & | mute | ) |
| pure virtual

Gets the mute state of the speaker.

Parameters

  mute | A reference to the mute state of the speaker.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getPlayoutAudioParameters()

virtual int agora::rtc::INGAudioDeviceManager::getPlayoutAudioParameters | ( | AudioParameters * | params | ) | const
| pure virtual

Get the playout parameters of audio device.

Parameters

  params | A point to the struct AudioParameters.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getRecordAudioParameters()

virtual int agora::rtc::INGAudioDeviceManager::getRecordAudioParameters | ( | AudioParameters * | params | ) | const
| pure virtual

Get the record parameters of audio device.

Parameters

  params | A point to the struct AudioParameters.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setDefaultAudioRouting()

virtual int agora::rtc::INGAudioDeviceManager::setDefaultAudioRouting | ( | AudioRoute | route,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the default audio routing.

This method allows apps to change the current audio route for the received audio. Noted: In Low Level API, we don't support default audio routing, i.e., setDefaultAudioRouteToSpeakerphone. This can be done in RTC engine.

Note
  This method applies to Android and iOS only.

Parameters

  route | The default audio route. See AudioRoute.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ changeAudioRouting()

virtual int agora::rtc::INGAudioDeviceManager::changeAudioRouting | ( | AudioRoute | route,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Changes the current audio routing.

Note
  This method applies to Android and iOS only.

Parameters

  route | The audio route that you want to change to. See AudioRoute.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioRoutingSpeakerOn()

virtual int agora::rtc::INGAudioDeviceManager::setAudioRoutingSpeakerOn | ( | bool | enable,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Changes the speaker status on/off.

Note
  This method applies to Android and iOS only.

Parameters

  enable | on/off

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getCurrentRouting()

virtual int agora::rtc::INGAudioDeviceManager::getCurrentRouting | ( | AudioRoute & | route | ) |
| pure virtual

Gets the current audio routing.

Note
  This method applies to Android and iOS only.

Parameters

  route | A reference to the audio route: AudioRoute.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getNumberOfPlayoutDevices()

virtual int agora::rtc::INGAudioDeviceManager::getNumberOfPlayoutDevices | ( |  | ) |
| pure virtual

Gets the index numbers of all audio playout devices.

Note
  This method applies to Windows or macOS only.

Returns
  - The index numbers of the audio playout devices: Success.
  - < 0: Failure.

## ◆ getNumberOfRecordingDevices()

virtual int agora::rtc::INGAudioDeviceManager::getNumberOfRecordingDevices | ( |  | ) |
| pure virtual

Gets the index numbers of all audio recording devices.

Note
  This method applies to Windows or macOS only.

Returns
  - The index numbers of the audio recording devices: Success.
  - < 0: Failure.

## ◆ getPlayoutDeviceInfo()

virtual AudioDeviceInfo agora::rtc::INGAudioDeviceManager::getPlayoutDeviceInfo | ( | int | index | ) |
| pure virtual

Gets the information of the current audio playout device.

Note
  This method applies to Windows or macOS only.

Parameters

  index | The index number of the current audio playout device.

Returns
  The information of the audio playout device. See AudioDeviceInfo.

## ◆ getRecordingDeviceInfo()

virtual AudioDeviceInfo agora::rtc::INGAudioDeviceManager::getRecordingDeviceInfo | ( | int | index | ) |
| pure virtual

Gets the information of the current recording device.

Note
  This method applies to Windows or macOS only.

Parameters

  index | The index number of the current recording device.

Returns
  The information of the recording device. See AudioDeviceInfo.

## ◆ setPlayoutDevice()

virtual int agora::rtc::INGAudioDeviceManager::setPlayoutDevice | ( | int | index,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the audio playback device.

Note
  This method applies to Windows or macOS only.

Parameters

  index | The index number of the audio playout device.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRecordingDevice()

virtual int agora::rtc::INGAudioDeviceManager::setRecordingDevice | ( | int | index,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the recording device.

Note
  This method applies to Windows or macOS only.

Parameters

  index | The index number of the recording device.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ followSystemPlaybackDevice()

virtual int agora::rtc::INGAudioDeviceManager::followSystemPlaybackDevice | ( | bool | enable,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

The status of following system default playback device.

Note
  The status of following system default playback device.

Parameters

  enable | Variable to whether the current device follow system default playback device or not. true: The current device will change when the system default playback device changed. false: The current device will change only current device is removed.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ followSystemRecordingDevice()

virtual int agora::rtc::INGAudioDeviceManager::followSystemRecordingDevice | ( | bool | enable,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

The status of following system default recording device.

Note
  The status of following system default recording device.

Parameters

  enable | Variable to whether the current device follow system default recording device or not. true: The current device will change when the system default recording device changed. false: The current device will change only current device is removed.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setApplicationVolume()

virtual int agora::rtc::INGAudioDeviceManager::setApplicationVolume | ( | unsigned int | volume,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the volume of the app.

Note
  This method applies to Windows only.

Parameters

  volume | The volume of the app. The value range is [0, 255].

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getApplicationVolume()

virtual int agora::rtc::INGAudioDeviceManager::getApplicationVolume | ( | unsigned int & | volume | ) |
| pure virtual

Gets the volume of the app.

Note
  This method applies to Windows only.

Parameters

  volume | The volume of the app. The value range is [0, 255].

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setApplicationMuteState()

virtual int agora::rtc::INGAudioDeviceManager::setApplicationMuteState | ( | bool | mute,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the mute state of the app.

Note
  This method applies to Windows only.

Parameters

  mute | Determines whether to set the app to the mute state. true: Set the app to the mute state. false: (Default) Do not set the app to the mute state.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getApplicationMuteState()

virtual int agora::rtc::INGAudioDeviceManager::getApplicationMuteState | ( | bool & | mute | ) |
| pure virtual

Gets the mute state of the app.

Note
  This method applies to Windows only.

Parameters

  mute | A reference to the mute state of the app.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getLoopbackDeviceInfo()

virtual AudioDeviceInfo agora::rtc::INGAudioDeviceManager::getLoopbackDeviceInfo | ( | int | index | ) |
| pure virtual

Gets the information of the current audio loopback device.

Note
  This method applies to Windows or macOS only.

Parameters

  index | The index number of the current audio playout device.

Returns
  The information of the audio playout device. See AudioDeviceInfo.

## ◆ setLoopbackDevice()

virtual int agora::rtc::INGAudioDeviceManager::setLoopbackDevice | ( | int | index,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the audio loopback device.

Note
  This method applies to Windows only.

Parameters

  index | The index number of the audio playout device.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ followSystemLoopbackDevice()

virtual int agora::rtc::INGAudioDeviceManager::followSystemLoopbackDevice | ( | bool | enable,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

The status of following system default loopback device.

Note
  The status of following system default loopback device.

Parameters

  enable | Variable to whether the current device follow system default loopback device or not. true: The current device will change when the system default loopback device changed. false: The current device will change only current device is removed.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ registerObserver()

virtual int agora::rtc::INGAudioDeviceManager::registerObserver | ( | IAudioDeviceManagerObserver * | observer,
|  | void(* | safeDeleter )(IAudioDeviceManagerObserver *) = NULL,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Registers an IAudioDeviceManagerObserver object.

You need to implement the IAudioDeviceManageObserver class in this method, and register callbacks according to your scenario.

Parameters

  observer | A pointer to the IAudioDeviceManagerObserver class.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ unregisterObserver()

virtual int agora::rtc::INGAudioDeviceManager::unregisterObserver | ( | IAudioDeviceManagerObserver * | observer | ) |
| pure virtual

Releases the IAudioDeviceManagerObserver object.

Parameters

  observer | The pointer to the IAudioDeviceManagerObserver class registered using registerObserver.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setupAudioAttributeContext()

virtual int agora::rtc::INGAudioDeviceManager::setupAudioAttributeContext | ( | void * | audioAttr,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual