Use correct default audio output and input devices on Windows.
It was returning the first available device as the default, which might not be the actual default device. Use the WAVE_MAPPER device ID instead that tells Windows to use the most appropriate device. Change-Id: Id1e9324e889bbaaab54bc0e0da810a7ce5fcb592 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
17053a450b
commit
f424e8249b
@@ -469,20 +469,22 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
|
||||
|
||||
QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
|
||||
{
|
||||
QList<QByteArray> list = availableDevices(QAudio::AudioOutput);
|
||||
if (list.size() > 0)
|
||||
return list.at(0);
|
||||
else
|
||||
return QByteArray();
|
||||
QByteArray defaultDevice;
|
||||
QDataStream ds(&defaultDevice, QIODevice::WriteOnly);
|
||||
ds << quint32(WAVE_MAPPER) // device ID for default device
|
||||
<< QStringLiteral("Default Output Device");
|
||||
|
||||
return defaultDevice;
|
||||
}
|
||||
|
||||
QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
|
||||
{
|
||||
QList<QByteArray> list = availableDevices(QAudio::AudioInput);
|
||||
if (list.size() > 0)
|
||||
return list.at(0);
|
||||
else
|
||||
return QByteArray();
|
||||
QByteArray defaultDevice;
|
||||
QDataStream ds(&defaultDevice, QIODevice::WriteOnly);
|
||||
ds << quint32(WAVE_MAPPER) // device ID for default device
|
||||
<< QStringLiteral("Default Input Device");
|
||||
|
||||
return defaultDevice;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user