From 8cae20f53de82ffe9a49c917bec62966e382ead6 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 1 Mar 2018 11:03:18 -0800 Subject: [PATCH 1/6] adding stereo checkbox to audio settings --- interface/resources/qml/hifi/audio/Audio.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index eab1e40af0..fc308100a8 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -112,6 +112,7 @@ Rectangle { // mute is in its own row RowLayout { + spacing: (margins.sizeCheckBox - 10.5) * 3; AudioControls.CheckBox { id: muteMic text: qsTr("Mute microphone"); @@ -123,6 +124,16 @@ Rectangle { checked = Qt.binding(function() { return AudioScriptingInterface.muted; }); // restore binding } } + + AudioControls.CheckBox { + id: stereoMic + spacing: muteMic.spacing; + text: qsTr("Enable stereo"); + checked: false; + onClicked: { + Audio.setIsStereoInput(checked); + } + } } RowLayout { From 4b572eda6bc93e89ae3e0debfe32a09615eb5e49 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 1 Mar 2018 11:05:40 -0800 Subject: [PATCH 2/6] changing Name --- interface/resources/qml/hifi/audio/Audio.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index fc308100a8..f7dde336c8 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -128,7 +128,7 @@ Rectangle { AudioControls.CheckBox { id: stereoMic spacing: muteMic.spacing; - text: qsTr("Enable stereo"); + text: qsTr("Stereo"); checked: false; onClicked: { Audio.setIsStereoInput(checked); From 55d8cfd4c154154705576e5703fbaacf3b52c02d Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 2 Mar 2018 10:56:44 -0800 Subject: [PATCH 3/6] make sure dont make audio devices that don't use stereo use stereo --- interface/resources/qml/hifi/audio/Audio.qml | 8 ++++++-- libraries/audio-client/src/AudioClient.cpp | 8 ++++++-- libraries/audio-client/src/AudioClient.h | 2 +- libraries/audio/src/AbstractAudioInterface.h | 2 +- libraries/script-engine/src/AudioScriptingInterface.cpp | 6 ++++-- libraries/script-engine/src/AudioScriptingInterface.h | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index f7dde336c8..a9a8a8e5c4 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -128,10 +128,13 @@ Rectangle { AudioControls.CheckBox { id: stereoMic spacing: muteMic.spacing; - text: qsTr("Stereo"); + text: qsTr("use stereo for stereo devices"); checked: false; onClicked: { - Audio.setIsStereoInput(checked); + var success = Audio.setIsStereoInput(checked); + if (!success) { + checked = !checked; + } } } } @@ -215,6 +218,7 @@ Rectangle { text: devicename onPressed: { if (!checked) { + stereoMic.checked = false; AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1); } } diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 8379151d1c..3828304964 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -1372,9 +1372,11 @@ void AudioClient::setNoiseReduction(bool enable) { } -void AudioClient::setIsStereoInput(bool isStereoInput) { - if (isStereoInput != _isStereoInput) { +bool AudioClient::setIsStereoInput(bool isStereoInput) { + bool stereoInputChanged = false; + if (isStereoInput != _isStereoInput && _inputDeviceInfo.supportedChannelCounts().contains(2)) { _isStereoInput = isStereoInput; + stereoInputChanged = true; if (_isStereoInput) { _desiredInputFormat.setChannelCount(2); @@ -1394,6 +1396,8 @@ void AudioClient::setIsStereoInput(bool isStereoInput) { // restart the input device switchInputToAudioDevice(_inputDeviceInfo); } + + return stereoInputChanged; } bool AudioClient::outputLocalInjector(const AudioInjectorPointer& injector) { diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 0643b8e52a..2c2ddd0342 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -194,7 +194,7 @@ public slots: void toggleMute(); bool isMuted() { return _muted; } - virtual void setIsStereoInput(bool stereo) override; + virtual bool setIsStereoInput(bool stereo) override; void setNoiseReduction(bool isNoiseGateEnabled); bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; } diff --git a/libraries/audio/src/AbstractAudioInterface.h b/libraries/audio/src/AbstractAudioInterface.h index 37731c31f7..ba1e733f13 100644 --- a/libraries/audio/src/AbstractAudioInterface.h +++ b/libraries/audio/src/AbstractAudioInterface.h @@ -41,7 +41,7 @@ public: public slots: virtual bool shouldLoopbackInjectors() { return false; } - virtual void setIsStereoInput(bool stereo) = 0; + virtual bool setIsStereoInput(bool stereo) = 0; }; Q_DECLARE_METATYPE(AbstractAudioInterface*) diff --git a/libraries/script-engine/src/AudioScriptingInterface.cpp b/libraries/script-engine/src/AudioScriptingInterface.cpp index 28bf5ed163..dd8d284c12 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.cpp +++ b/libraries/script-engine/src/AudioScriptingInterface.cpp @@ -60,8 +60,10 @@ ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound } } -void AudioScriptingInterface::setStereoInput(bool stereo) { +bool AudioScriptingInterface::setStereoInput(bool stereo) { + bool stereoInputChanged = false; if (_localAudioInterface) { - _localAudioInterface->setIsStereoInput(stereo); + stereoInputChanged = _localAudioInterface->setIsStereoInput(stereo); } + return stereoInputChanged; } diff --git a/libraries/script-engine/src/AudioScriptingInterface.h b/libraries/script-engine/src/AudioScriptingInterface.h index 23a0861acd..d46430ccce 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.h +++ b/libraries/script-engine/src/AudioScriptingInterface.h @@ -35,7 +35,7 @@ protected: // FIXME: there is no way to play a positionless sound Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position); - Q_INVOKABLE void setStereoInput(bool stereo); + Q_INVOKABLE bool setStereoInput(bool stereo); signals: void mutedByMixer(); /// the client has been muted by the mixer From 7ce13a3ce745ca53d206917dcbefee7bdf6d5d3c Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 2 Mar 2018 11:06:28 -0800 Subject: [PATCH 4/6] adding comment --- interface/resources/qml/hifi/audio/Audio.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index a9a8a8e5c4..156332579a 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -219,6 +219,7 @@ Rectangle { onPressed: { if (!checked) { stereoMic.checked = false; + Audio.setIsStereoInput(false); // the next selected audio device might not support stereo AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1); } } From 654770af512032cad26c91a8eff4cd1b0cdcc736 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 5 Mar 2018 09:39:26 -0800 Subject: [PATCH 5/6] fix controller dispatacher error --- scripts/system/controllers/controllerDispatcher.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/system/controllers/controllerDispatcher.js b/scripts/system/controllers/controllerDispatcher.js index 18b194dd3a..4f041d3067 100644 --- a/scripts/system/controllers/controllerDispatcher.js +++ b/scripts/system/controllers/controllerDispatcher.js @@ -43,6 +43,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); this.totalVariance = 0; this.highVarianceCount = 0; this.veryhighVarianceCount = 0; + this.orderedPluginNames = []; this.tabletID = null; this.blacklist = []; this.pointerManager = new PointerManager(); From 1997cd27bd463127a088148a013bd1e3efa70f0b Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 5 Mar 2018 11:26:37 -0800 Subject: [PATCH 6/6] correctly use default values --- scripts/system/html/js/entityProperties.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 2b29fbf041..86bbe7086b 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -321,22 +321,19 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) { } var keys = Object.keys(updateKeyPair); keys.forEach(function (key) { - delete parsedData[groupName][key]; if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") { if (updateKeyPair[key] instanceof Element) { if (updateKeyPair[key].type === "checkbox") { - if (updateKeyPair[key].checked !== defaults[key]) { - parsedData[groupName][key] = updateKeyPair[key].checked; - } + parsedData[groupName][key] = updateKeyPair[key].checked; } else { var val = isNaN(updateKeyPair[key].value) ? updateKeyPair[key].value : parseInt(updateKeyPair[key].value); - if (val !== defaults[key]) { - parsedData[groupName][key] = val; - } + parsedData[groupName][key] = val; } } else { parsedData[groupName][key] = updateKeyPair[key]; } + } else if (defaults[key] !== null && defaults[key] !== "null") { + parsedData[groupName][key] = defaults[key]; } }); if (Object.keys(parsedData[groupName]).length === 0) {