IAudioDeviceCollection

The IAudioDeviceCollection interface. You can get the information of audio devices with this interface.

getApplicationVolume

Retrieves the volume of the app.

virtual int getApplicationVolume(int& volume) = 0;

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

getCount

Gets the total number of audio playback or audio capture devices.

virtual int getCount() = 0;

Details

If you call enumeratePlaybackDevices before this method, the SDK returns the number of audio playback devices. If you call enumerateRecordingDevices before this method, the SDK returns the number of audio capture devices.

Returns

The number of audio playback or audio capture devices.

getDefaultDevice

Gets the default audio device of the system.

virtual int getDefaultDevice(char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;

Parameters

deviceName
Output parameter, the name of the system default audio device. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.
deviceId
Output parameter, the device ID of the the system default audio device. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.

Returns

  • 0: Success.
  • < 0: Failure.

getDevice

Gets the information of a specified audio device.

virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;

Parameters

index
An input parameter. The index of the device.
deviceName
An output parameter. The device name. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.
deviceId
An output parameter. The device ID. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.

Returns

  • 0: Success.
  • < 0: Failure.

isApplicationMute

Checks whether the app is muted.

virtual int isApplicationMute(bool &mute) = 0;

Parameters

mute
Whether the app is muted:
  • true: The app is muted.
  • false: The app is not muted.

Returns

  • 0: Success.
  • < 0: Failure.

setApplicationMute

Mutes/Unmutes the app.

virtual int setApplicationMute(bool mute) = 0;

Parameters

mute
Whether to mute the app:
  • true: Mute the app.
  • false: Unmute the app.

Returns

  • 0: Success.
  • < 0: Failure.

setApplicationVolume

Sets the volume of the app.

virtual int setApplicationVolume(int volume) = 0;

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

setDevice

Specifies an audio device.

virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;

Details

You can call this method to change the audio route currently being used, but this does not change the default audio route. For example, if the default audio route is speaker 1, you call this method to set the audio route as speaker 2 before joinging a channel and then start a device test, the SDK conducts device test on speaker 2. After the device test is completed and you join a channel, the SDK still uses speaker 1, the default audio route.

Parameters

deviceId
The device ID. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.

Returns

  • 0: Success.
  • < 0: Failure.