From 2257afd390e59ece7ef5398906df44ad95a50158 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 26 Mar 2014 15:20:27 -0700 Subject: [PATCH 1/4] removed unneeded call to disconnect() --- interface/src/Audio.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index c2d5f535a7..1575375d4b 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -840,7 +840,6 @@ bool Audio::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo) // cleanup any previously initialized device if (_audioOutput) { _audioOutput->stop(); - disconnect(_outputDevice, 0, 0, 0); _outputDevice = NULL; delete _audioOutput; From 411ebf805a11148cf81fbcd90b8dfbf7b469f7b1 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 26 Mar 2014 15:42:53 -0700 Subject: [PATCH 2/4] use InvokeMethod() for all menu scripting operations --- interface/src/Menu.h | 4 ++-- interface/src/scripting/MenuScriptingInterface.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 9452ba220d..983264ea55 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -66,8 +66,6 @@ public: static Menu* getInstance(); ~Menu(); - bool isOptionChecked(const QString& menuOption); - void setIsOptionChecked(const QString& menuOption, bool isChecked); void triggerOption(const QString& menuOption); QAction* getActionForOption(const QString& menuOption); @@ -133,6 +131,8 @@ public slots: void removeSeparator(const QString& menuName, const QString& separatorName); void addMenuItem(const MenuItemProperties& properties); void removeMenuItem(const QString& menuName, const QString& menuitem); + bool isOptionChecked(const QString& menuOption); + void setIsOptionChecked(const QString& menuOption, bool isChecked); private slots: void aboutApp(); diff --git a/interface/src/scripting/MenuScriptingInterface.cpp b/interface/src/scripting/MenuScriptingInterface.cpp index ccb3fe5eb9..4f9003b288 100644 --- a/interface/src/scripting/MenuScriptingInterface.cpp +++ b/interface/src/scripting/MenuScriptingInterface.cpp @@ -65,9 +65,15 @@ void MenuScriptingInterface::removeMenuItem(const QString& menu, const QString& }; bool MenuScriptingInterface::isOptionChecked(const QString& menuOption) { - return Menu::getInstance()->isOptionChecked(menuOption); + bool result; + QMetaObject::invokeMethod(Menu::getInstance(), "isOptionChecked", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(bool, result), + Q_ARG(const QString&, menuOption)); + return result; } void MenuScriptingInterface::setIsOptionChecked(const QString& menuOption, bool isChecked) { - return Menu::getInstance()->setIsOptionChecked(menuOption, isChecked); + QMetaObject::invokeMethod(Menu::getInstance(), "setIsOptionChecked", Qt::BlockingQueuedConnection, + Q_ARG(const QString&, menuOption), + Q_ARG(bool, isChecked)); } From 11c089c2219e65945dc4c94216db0fc8ed7e17c4 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 26 Mar 2014 16:48:57 -0700 Subject: [PATCH 3/4] add support for getting the actual default audio devices in windows by name --- interface/src/Audio.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 1575375d4b..75f624af7d 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -143,6 +143,28 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { } } #endif +#ifdef WIN32 + QString deviceName; + if (mode == QAudio::AudioInput) { + WAVEINCAPS wic; + // first use WAVE_MAPPER to get the default devices manufacturer ID + waveInGetDevCaps(WAVE_MAPPER, &wic, sizeof(wic)); + //Use the received manufacturer id to get the device's real name + waveInGetDevCaps(wic.wMid, &wic, sizeof(wic)); + qDebug() << "input device:" << wic.szPname; + deviceName = wic.szPname; + } else { + WAVEOUTCAPS woc; + // first use WAVE_MAPPER to get the default devices manufacturer ID + waveOutGetDevCaps(WAVE_MAPPER, &woc, sizeof(woc)); + //Use the received manufacturer id to get the device's real name + waveOutGetDevCaps(woc.wMid, &woc, sizeof(woc)); + qDebug() << "output device:" << woc.szPname; + deviceName = woc.szPname; + } + return getNamedAudioDeviceForMode(mode, deviceName); +#endif + // fallback for failed lookup is the default device return (mode == QAudio::AudioInput) ? QAudioDeviceInfo::defaultInputDevice() : QAudioDeviceInfo::defaultOutputDevice(); From 0435b16668830623440b6e96695e038814a98edf Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 26 Mar 2014 16:52:24 -0700 Subject: [PATCH 4/4] fix formatting --- interface/src/Audio.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 75f624af7d..321a4ea2ad 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -144,25 +144,25 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { } #endif #ifdef WIN32 - QString deviceName; - if (mode == QAudio::AudioInput) { - WAVEINCAPS wic; - // first use WAVE_MAPPER to get the default devices manufacturer ID - waveInGetDevCaps(WAVE_MAPPER, &wic, sizeof(wic)); - //Use the received manufacturer id to get the device's real name - waveInGetDevCaps(wic.wMid, &wic, sizeof(wic)); - qDebug() << "input device:" << wic.szPname; - deviceName = wic.szPname; - } else { - WAVEOUTCAPS woc; - // first use WAVE_MAPPER to get the default devices manufacturer ID - waveOutGetDevCaps(WAVE_MAPPER, &woc, sizeof(woc)); - //Use the received manufacturer id to get the device's real name - waveOutGetDevCaps(woc.wMid, &woc, sizeof(woc)); - qDebug() << "output device:" << woc.szPname; - deviceName = woc.szPname; - } - return getNamedAudioDeviceForMode(mode, deviceName); + QString deviceName; + if (mode == QAudio::AudioInput) { + WAVEINCAPS wic; + // first use WAVE_MAPPER to get the default devices manufacturer ID + waveInGetDevCaps(WAVE_MAPPER, &wic, sizeof(wic)); + //Use the received manufacturer id to get the device's real name + waveInGetDevCaps(wic.wMid, &wic, sizeof(wic)); + qDebug() << "input device:" << wic.szPname; + deviceName = wic.szPname; + } else { + WAVEOUTCAPS woc; + // first use WAVE_MAPPER to get the default devices manufacturer ID + waveOutGetDevCaps(WAVE_MAPPER, &woc, sizeof(woc)); + //Use the received manufacturer id to get the device's real name + waveOutGetDevCaps(woc.wMid, &woc, sizeof(woc)); + qDebug() << "output device:" << woc.szPname; + deviceName = woc.szPname; + } + return getNamedAudioDeviceForMode(mode, deviceName); #endif