IAudioDeviceCollection
The IAudioDeviceCollection interface. You can get the information of audio devices with this interface.
GetApplicationVolume
Retrieves the volume of the app.
UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
int GetApplicationVolume(int & volume);
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.
UFUNCTION(BlueprintPure, 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);
- This method is for Windows and macOS only.
- You need to call EnumeratePlaybackDevices or EnumerateRecordingDevices to get the device list before calling this method.
Parameters
- deviceName
- Output parameter; the name of the system's default audio device.
- deviceId
- Output parameter; the device ID of the system default audio device.
Returns
- 0: Success.
- < 0: Failure.
GetDevice
Gets the information of a specified audio device by index.
UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection")
int GetDevice(int index, FString& deviceName, FString& deviceId);
This method is for Windows and macOS only.
Parameters
- index
- An input parameter. The index of the device.
- deviceName
- An output parameter. The device name.
- deviceId
- An output parameter. The device ID.
Returns
- 0: Success.
- < 0: Failure.
IsApplicationMute
Checks 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 volume of the app.
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(const 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.
Returns
- 0: Success.
- < 0: Failure.