IAudioDeviceCollection

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

GetApplicationVolume

Gets the volume of the application.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int GetApplicationVolume(int volume);

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

GetCount

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

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int GetCount();

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.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int GetDefaultDevice(FString& deviceName, FString& deviceId);

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

GetDevice

Gets the information of a specified audio device.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int GetDevice(int index, FString& deviceName, FString& deviceId);

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

IsApplicationMute

Gets whether the app is muted.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int IsApplicationMute(bool mute);

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.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	void Release();

SetApplicationMute

Mutes/Unmutes the app.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int SetApplicationMute(bool mute);

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

SetApplicationVolume

Sets the app volume.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int SetApplicationVolume(int volume);

Parameters

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

Returns

  • 0: Success.
  • < 0: Failure.

SetDevice

Specifies an audio device.

UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
	int SetDevice(FString deviceId);

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 512 字符.

Returns

  • 0: Success.
  • < 0: Failure.