Add method to get device index if using system default mode.
This commit is contained in:
@@ -120,6 +120,20 @@ int32 Audio::GetActiveDeviceIndex()
|
||||
return ActiveDeviceIndex;
|
||||
}
|
||||
|
||||
int32 Audio::GetActiveDeviceResolvedIndex()
|
||||
{
|
||||
AudioDevice* active = GetActiveDevice();
|
||||
if (active != nullptr)
|
||||
{
|
||||
for (int32 i = 0; i < Devices.Count(); i++)
|
||||
{
|
||||
if (&Devices[i] == active)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Audio::SetActiveDeviceIndex(int32 index)
|
||||
{
|
||||
index = Math::Clamp(index, -1, Devices.Count() - 1);
|
||||
|
||||
@@ -61,11 +61,17 @@ public:
|
||||
API_PROPERTY() static AudioDevice* GetActiveDevice();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the active device.
|
||||
/// Gets the index of the active device. Returns -1 if set to system default mode.
|
||||
/// </summary>
|
||||
/// <returns>The active device index.</returns>
|
||||
API_PROPERTY() static int32 GetActiveDeviceIndex();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resolved index in Devices array of the device currently playing (resolves system default mode to the actual device index).
|
||||
/// </summary>
|
||||
/// <returns>The resolved active device index.</returns>
|
||||
API_PROPERTY() static int32 GetActiveDeviceResolvedIndex();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the index of the active device.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user