[AFV] Based on RRs idea init Qt audio device lists. The idea is to init them upfront in the main thread

Ref: https://discordapp.com/channels/539048679160676382/539925070550794240/676414836351172614
This commit is contained in:
Klaus Basan
2020-02-26 00:14:53 +01:00
committed by Mat Sutcliffe
parent fe1e976093
commit 81fa0b56c1
4 changed files with 22 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
#include <QProcess>
#include <QStringList>
#include <QAudioDeviceInfo>
using namespace BlackConfig;
@@ -23,5 +24,16 @@ namespace BlackMisc
if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return false; }
return QProcess::startDetached("SndVol.exe");
}
void initWindowsAudioDevices()
{
if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return; }
// force init of device lists
// see https://discordapp.com/channels/539048679160676382/539925070550794240/676418182038421534
QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
}
} // ns
} // ns

View File

@@ -19,6 +19,10 @@ namespace BlackMisc
{
//! Start the Windows mixer
BLACKMISC_EXPORT bool startWindowsMixer();
//! On windows init the audio devices
//! \remarks workaround for WSAPI driver crashes, hoping that upfront init already sets global vars. etc.
BLACKMISC_EXPORT void initWindowsAudioDevices();
}
}