Merge branch 'master' of github.com:highfidelity/hifi into shadowControlsOffZvork

This commit is contained in:
NissimHadar 2018-03-06 15:22:40 -08:00
commit dbf1be5de3
8 changed files with 34 additions and 14 deletions

View file

@ -112,6 +112,7 @@ Rectangle {
// mute is in its own row // mute is in its own row
RowLayout { RowLayout {
spacing: (margins.sizeCheckBox - 10.5) * 3;
AudioControls.CheckBox { AudioControls.CheckBox {
id: muteMic id: muteMic
text: qsTr("Mute microphone"); text: qsTr("Mute microphone");
@ -123,6 +124,19 @@ Rectangle {
checked = Qt.binding(function() { return AudioScriptingInterface.muted; }); // restore binding 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 { RowLayout {
@ -204,6 +218,8 @@ Rectangle {
text: devicename text: devicename
onPressed: { onPressed: {
if (!checked) { if (!checked) {
stereoMic.checked = false;
Audio.setIsStereoInput(false); // the next selected audio device might not support stereo
AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1); AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1);
} }
} }

View file

@ -1397,9 +1397,11 @@ void AudioClient::setNoiseReduction(bool enable) {
} }
void AudioClient::setIsStereoInput(bool isStereoInput) { bool AudioClient::setIsStereoInput(bool isStereoInput) {
if (isStereoInput != _isStereoInput) { bool stereoInputChanged = false;
if (isStereoInput != _isStereoInput && _inputDeviceInfo.supportedChannelCounts().contains(2)) {
_isStereoInput = isStereoInput; _isStereoInput = isStereoInput;
stereoInputChanged = true;
if (_isStereoInput) { if (_isStereoInput) {
_desiredInputFormat.setChannelCount(2); _desiredInputFormat.setChannelCount(2);
@ -1419,6 +1421,8 @@ void AudioClient::setIsStereoInput(bool isStereoInput) {
// restart the input device // restart the input device
switchInputToAudioDevice(_inputDeviceInfo); switchInputToAudioDevice(_inputDeviceInfo);
} }
return stereoInputChanged;
} }
bool AudioClient::outputLocalInjector(const AudioInjectorPointer& injector) { bool AudioClient::outputLocalInjector(const AudioInjectorPointer& injector) {

View file

@ -192,7 +192,7 @@ public slots:
void toggleMute(); void toggleMute();
bool isMuted() { return _muted; } bool isMuted() { return _muted; }
virtual void setIsStereoInput(bool stereo) override; virtual bool setIsStereoInput(bool stereo) override;
void setNoiseReduction(bool isNoiseGateEnabled); void setNoiseReduction(bool isNoiseGateEnabled);
bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; } bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; }

View file

@ -41,7 +41,7 @@ public:
public slots: public slots:
virtual bool shouldLoopbackInjectors() { return false; } virtual bool shouldLoopbackInjectors() { return false; }
virtual void setIsStereoInput(bool stereo) = 0; virtual bool setIsStereoInput(bool stereo) = 0;
}; };
Q_DECLARE_METATYPE(AbstractAudioInterface*) Q_DECLARE_METATYPE(AbstractAudioInterface*)

View file

@ -60,8 +60,10 @@ ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound
} }
} }
void AudioScriptingInterface::setStereoInput(bool stereo) { bool AudioScriptingInterface::setStereoInput(bool stereo) {
bool stereoInputChanged = false;
if (_localAudioInterface) { if (_localAudioInterface) {
_localAudioInterface->setIsStereoInput(stereo); stereoInputChanged = _localAudioInterface->setIsStereoInput(stereo);
} }
return stereoInputChanged;
} }

View file

@ -35,7 +35,7 @@ protected:
// FIXME: there is no way to play a positionless sound // FIXME: there is no way to play a positionless sound
Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position); Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position);
Q_INVOKABLE void setStereoInput(bool stereo); Q_INVOKABLE bool setStereoInput(bool stereo);
signals: signals:
void mutedByMixer(); /// the client has been muted by the mixer void mutedByMixer(); /// the client has been muted by the mixer

View file

@ -43,6 +43,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
this.totalVariance = 0; this.totalVariance = 0;
this.highVarianceCount = 0; this.highVarianceCount = 0;
this.veryhighVarianceCount = 0; this.veryhighVarianceCount = 0;
this.orderedPluginNames = [];
this.tabletID = null; this.tabletID = null;
this.blacklist = []; this.blacklist = [];
this.pointerManager = new PointerManager(); this.pointerManager = new PointerManager();

View file

@ -321,22 +321,19 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
} }
var keys = Object.keys(updateKeyPair); var keys = Object.keys(updateKeyPair);
keys.forEach(function (key) { keys.forEach(function (key) {
delete parsedData[groupName][key];
if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") { if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") {
if (updateKeyPair[key] instanceof Element) { if (updateKeyPair[key] instanceof Element) {
if (updateKeyPair[key].type === "checkbox") { if (updateKeyPair[key].type === "checkbox") {
if (updateKeyPair[key].checked !== defaults[key]) {
parsedData[groupName][key] = updateKeyPair[key].checked; parsedData[groupName][key] = updateKeyPair[key].checked;
}
} else { } else {
var val = isNaN(updateKeyPair[key].value) ? updateKeyPair[key].value : parseInt(updateKeyPair[key].value); 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 { } else {
parsedData[groupName][key] = updateKeyPair[key]; 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) { if (Object.keys(parsedData[groupName]).length === 0) {