Agora RTC Objective-C API Reference Refactor

Public Member Functions
INGAudioDeviceManager Class Referenceabstract

Inherits 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 | registerObserver (IAudioDeviceManagerObserver *observer, void(*safeDeleter)(IAudioDeviceManagerObserver *)=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | unregisterObserver (IAudioDeviceManagerObserver *observer)=0

## 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()

~INGAudioDeviceManager | ( |  | ) |
| inline protected

## Member Function Documentation

## ◆ createRecordingDeviceSource()

virtual agora_refptr<IRecordingDeviceSource> 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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.

## ◆ registerObserver()

virtual int registerObserver | ( | IAudioDeviceManagerObserver * | observer,
|  | void(*)(IAudioDeviceManagerObserver *) | safeDeleter = `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 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 setupAudioAttributeContext | ( | void * | audioAttr,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

## ◆ AddRef()

virtual void AddRef | ( |  | ) | const
| pure virtual inherited

## ◆ Release()

virtual RefCountReleaseStatus Release | ( |  | ) | const
| pure virtual inherited

## ◆ HasOneRef()

virtual bool HasOneRef | ( |  | ) | const
| pure virtual inherited