Set the actually opened audio device from vatlib

In the past, the optional arguments currentInput and currentOutput were not
used. Therefore we never knew which device was actually opened by vatlib.
This caused the Audio UI to be completely unsychronized from the reality
when loading swiftgui.

ref T337
This commit is contained in:
Roland Winklmeier
2018-09-12 17:12:55 +02:00
committed by Klaus Basan
parent 44b1273085
commit 24ebc2ce7f
5 changed files with 14 additions and 28 deletions

View File

@@ -36,6 +36,11 @@ namespace BlackMisc
return this->findBy(&CAudioDeviceInfo::getType, CAudioDeviceInfo::InputDevice);
}
CAudioDeviceInfo CAudioDeviceInfoList::findByDeviceIndex(int deviceIndex)
{
return this->findBy(&CAudioDeviceInfo::getIndex, deviceIndex).frontOrDefault();
}
int CAudioDeviceInfoList::count(CAudioDeviceInfo::DeviceType type) const
{
return std::count_if(this->begin(), this->end(), [type](const CAudioDeviceInfo &device)

View File

@@ -44,6 +44,9 @@ namespace BlackMisc
//! Get output devices in that list
CAudioDeviceInfoList getInputDevices() const;
//! Find device by its index
CAudioDeviceInfo findByDeviceIndex(int deviceIndex);
//! Count (as of type)
int count(CAudioDeviceInfo::DeviceType type) const;
};