mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
[AFV] Ref T730, make sure device is "valid"
This commit is contained in:
@@ -62,7 +62,7 @@ namespace BlackMisc
|
|||||||
bool isOutputDevice() const { return this->getType() == OutputDevice; }
|
bool isOutputDevice() const { return this->getType() == OutputDevice; }
|
||||||
|
|
||||||
//! Valid audio device object?
|
//! Valid audio device object?
|
||||||
bool isValid() const { return !m_deviceName.isEmpty(); }
|
bool isValid() const { return !m_deviceName.isEmpty() && (m_deviceName != Unknown); }
|
||||||
|
|
||||||
//! Is this a default device?
|
//! Is this a default device?
|
||||||
bool isDefault() const { return m_deviceName == "default"; }
|
bool isDefault() const { return m_deviceName == "default"; }
|
||||||
|
|||||||
@@ -82,13 +82,13 @@ namespace BlackSound
|
|||||||
|
|
||||||
QAudioDeviceInfo getLowestLatencyDevice(const CAudioDeviceInfo &device, QAudioFormat &format)
|
QAudioDeviceInfo getLowestLatencyDevice(const CAudioDeviceInfo &device, QAudioFormat &format)
|
||||||
{
|
{
|
||||||
if (device.isDefault())
|
if (device.isDefault() || !device.isValid())
|
||||||
{
|
{
|
||||||
if (device.getType() == CAudioDeviceInfo::InputDevice) { return QAudioDeviceInfo::defaultInputDevice(); }
|
if (device.getType() == CAudioDeviceInfo::InputDevice) { return QAudioDeviceInfo::defaultInputDevice(); }
|
||||||
else { return QAudioDeviceInfo::defaultOutputDevice(); }
|
else { return QAudioDeviceInfo::defaultOutputDevice(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
QAudio::Mode mode = (device.getType() == CAudioDeviceInfo::InputDevice) ? QAudio::AudioInput : QAudio::AudioOutput;
|
const QAudio::Mode mode = device.isInputDevice() ? QAudio::AudioInput : QAudio::AudioOutput;
|
||||||
const QList<QAudioDeviceInfo> allQtDevices = QAudioDeviceInfo::availableDevices(mode);
|
const QList<QAudioDeviceInfo> allQtDevices = QAudioDeviceInfo::availableDevices(mode);
|
||||||
|
|
||||||
// Find the one with lowest latency.
|
// Find the one with lowest latency.
|
||||||
|
|||||||
Reference in New Issue
Block a user