mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
[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:
committed by
Mat Sutcliffe
parent
fe1e976093
commit
81fa0b56c1
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QAudioDeviceInfo>
|
||||||
|
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
|
|
||||||
@@ -23,5 +24,16 @@ namespace BlackMisc
|
|||||||
if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return false; }
|
if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return false; }
|
||||||
return QProcess::startDetached("SndVol.exe");
|
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
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
//! Start the Windows mixer
|
//! Start the Windows mixer
|
||||||
BLACKMISC_EXPORT bool startWindowsMixer();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "blackcore/corefacadeconfig.h"
|
#include "blackcore/corefacadeconfig.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
|
#include "blackmisc/audio/audioutils.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/crashhandler.h"
|
#include "blackmisc/crashhandler.h"
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
#include <Qt>
|
#include <Qt>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ int main(int argc, char *argv[])
|
|||||||
QApplication qa(argc, argv);
|
QApplication qa(argc, argv);
|
||||||
Q_UNUSED(qa) // init of qa is required, but qa not used
|
Q_UNUSED(qa) // init of qa is required, but qa not used
|
||||||
|
|
||||||
|
initWindowsAudioDevices();
|
||||||
CCrashHandler::instance()->init();
|
CCrashHandler::instance()->init();
|
||||||
CGuiApplication a(CApplicationInfo::swiftCore(), CApplicationInfo::PilotClientCore, CIcons::swiftCore24());
|
CGuiApplication a(CApplicationInfo::swiftCore(), CApplicationInfo::PilotClientCore, CIcons::swiftCore24());
|
||||||
a.addWindowStateOption();
|
a.addWindowStateOption();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
|
#include "blackmisc/audio/audioutils.h"
|
||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/crashhandler.h"
|
#include "blackmisc/crashhandler.h"
|
||||||
#include "blackmisc/appstarttime.h"
|
#include "blackmisc/appstarttime.h"
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
|
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -28,6 +30,7 @@ int main(int argc, char *argv[])
|
|||||||
QApplication qa(argc, argv);
|
QApplication qa(argc, argv);
|
||||||
Q_UNUSED(qa) // application init needed
|
Q_UNUSED(qa) // application init needed
|
||||||
|
|
||||||
|
initWindowsAudioDevices();
|
||||||
CCrashHandler::instance()->init();
|
CCrashHandler::instance()->init();
|
||||||
CSwiftGuiStdApplication a; // application with contexts
|
CSwiftGuiStdApplication a; // application with contexts
|
||||||
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
||||||
|
|||||||
Reference in New Issue
Block a user