mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Ref T730, adjusted audio device info/info list,
so it can be used with QAudioDeviceInfo
This commit is contained in:
committed by
Mat Sutcliffe
parent
b9b3675073
commit
835fdc478a
@@ -26,11 +26,43 @@ namespace BlackMisc
|
||||
m_deviceName(name), m_hostName(QHostInfo::localHostName())
|
||||
{ }
|
||||
|
||||
QAudioDeviceInfo CAudioDeviceInfo::toAudioDeviceInfo() const
|
||||
{
|
||||
QList<QAudioDeviceInfo> devices;
|
||||
switch (this->getType())
|
||||
{
|
||||
case InputDevice: devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); break;
|
||||
case OutputDevice: devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); break;
|
||||
default:
|
||||
devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
devices += QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
|
||||
break;
|
||||
}
|
||||
|
||||
for (const QAudioDeviceInfo &d : as_const(devices))
|
||||
{
|
||||
if (d.deviceName() == this->getName()) { return d; }
|
||||
}
|
||||
|
||||
return QAudioDeviceInfo();
|
||||
}
|
||||
|
||||
CAudioDeviceInfo::DeviceType CAudioDeviceInfo::fromQtMode(QAudio::Mode m)
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case QAudio::AudioInput: return InputDevice;
|
||||
case QAudio::AudioOutput: return OutputDevice;
|
||||
default: break;
|
||||
}
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
QString CAudioDeviceInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
Q_UNUSED(i18n)
|
||||
if (m_hostName.isEmpty()) { return m_deviceName; }
|
||||
return m_deviceName % u" [" % this->getHostName() % u']';
|
||||
}
|
||||
} // Voice
|
||||
} // BlackMisc
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user