IAudioDeviceCollection
The IAudioDeviceCollection interface. You can get the information of audio devices with this interface.
getApplicationVolume
Retrieves the volume of the app.
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.
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 [1/2]
Gets the default audio device of the system.
Parameters
Returns
getDefaultDevice [2/2]
Gets the system‘s default audio device and its type.
Details
- Since
- v4.3.1
- This method applies to macOS only.
- You need to call enumeratePlaybackDevices or enumerateRecordingDevices to get the device list before calling this method.
Parameters
- deviceTypeName
- Output parameter; indicates the type of audio devices, such as built-in, USB and HDMI. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.
Returns
getDevice [1/2]
Gets the information of a specified audio device by index.
This method is for Windows and macOS only.
Returns
getDevice [2/2]
Gets the audio device information and device type by index.
Details
- Since
- v4.3.1
You can call this method to get the name, type and ID of a specified audio device.
Parameters
- deviceTypeName
- Output parameter; indicates the type of audio devices, such as built-in, USB and HDMI. The maximum length is MAX_DEVICE_ID_LENGTH_TYPE.
Returns
isApplicationMute
Checks whether the app is muted.
Parameters
- mute
-
Whether the app is muted:
true: The app is muted.false: The app is not muted.
Returns
- 0: Success.
- < 0: Failure.
release
Releases all the resources occupied by the IAudioDeviceCollection object.
setApplicationMute
Mutes/Unmutes the app.
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.
Parameters
- volume
- The volume of the app. The value range is [0,255].
Returns
- 0: Success.
- < 0: Failure.
setDevice
Specifies an audio device.
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.
Returns
- 0: Success.
- < 0: Failure.