diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index eab1e40af0..156332579a 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,19 @@ Rectangle { checked = Qt.binding(function() { return AudioScriptingInterface.muted; }); // restore binding } } + + AudioControls.CheckBox { + id: stereoMic + spacing: muteMic.spacing; + text: qsTr("use stereo for stereo devices"); + checked: false; + onClicked: { + var success = Audio.setIsStereoInput(checked); + if (!success) { + checked = !checked; + } + } + } } RowLayout { @@ -204,6 +218,8 @@ Rectangle { text: devicename onPressed: { if (!checked) { + stereoMic.checked = false; + Audio.setIsStereoInput(false); // the next selected audio device might not support stereo AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1); } } diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 873d294303..e2dae92a94 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -1397,9 +1397,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); @@ -1419,6 +1421,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 3e6e83b598..053202f583 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -192,7 +192,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 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(); 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) {