diff --git a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.woff b/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.woff deleted file mode 100644 index 6d46970136..0000000000 Binary files a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.woff and /dev/null differ diff --git a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.eot b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.eot similarity index 83% rename from interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.eot rename to interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.eot index 6cdc2487a6..88936e6c51 100644 Binary files a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.eot and b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.eot differ diff --git a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.svg b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.svg similarity index 96% rename from interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.svg rename to interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.svg index de91dcae71..a3a1aac8a9 100644 --- a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.svg +++ b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.svg @@ -14,7 +14,6 @@ - @@ -97,7 +96,6 @@ - @@ -137,7 +135,6 @@ - @@ -156,4 +153,10 @@ + + + + + + diff --git a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.ttf b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.ttf similarity index 83% rename from interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.ttf rename to interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.ttf index c27553333b..dae388d2eb 100644 Binary files a/interface/resources/fonts/hifi-glyphs-1.34/fonts/hifi-glyphs.ttf and b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.ttf differ diff --git a/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.woff b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.woff new file mode 100644 index 0000000000..09d5b93f69 Binary files /dev/null and b/interface/resources/fonts/hifi-glyphs-1.38/fonts/hifi-glyphs.woff differ diff --git a/interface/resources/fonts/hifi-glyphs-1.34/icons-reference.html b/interface/resources/fonts/hifi-glyphs-1.38/icons-reference.html similarity index 97% rename from interface/resources/fonts/hifi-glyphs-1.34/icons-reference.html rename to interface/resources/fonts/hifi-glyphs-1.38/icons-reference.html index 1c75e9e235..147087a4cf 100644 --- a/interface/resources/fonts/hifi-glyphs-1.34/icons-reference.html +++ b/interface/resources/fonts/hifi-glyphs-1.38/icons-reference.html @@ -12,7 +12,7 @@

HiFi Glyphs

-

This font was created for use in High Fidelity

+

This font was created withFontastic

CSS mapping

  • @@ -43,10 +43,6 @@
  • -
  • -
    - -
  • @@ -375,10 +371,6 @@
  • -
  • -
    - -
  • @@ -535,10 +527,6 @@
  • -
  • -
    - -
  • @@ -611,6 +599,30 @@
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +

Character mapping

    @@ -642,10 +654,6 @@
    -
  • -
    - -
  • @@ -974,10 +982,6 @@
  • -
  • -
    - -
  • @@ -1134,10 +1138,6 @@
  • -
  • -
    - -
  • @@ -1210,6 +1210,30 @@
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
  • +
  • +
    + +
- + \ No newline at end of file diff --git a/interface/resources/fonts/hifi-glyphs-1.34/styles.css b/interface/resources/fonts/hifi-glyphs-1.38/styles.css similarity index 97% rename from interface/resources/fonts/hifi-glyphs-1.34/styles.css rename to interface/resources/fonts/hifi-glyphs-1.38/styles.css index 59e38d455c..f6a096189b 100644 --- a/interface/resources/fonts/hifi-glyphs-1.34/styles.css +++ b/interface/resources/fonts/hifi-glyphs-1.38/styles.css @@ -59,9 +59,6 @@ .icon-headphones:before { content: "\68"; } -.icon-mic:before { - content: "\69"; -} .icon-upload:before { content: "\6a"; } @@ -308,9 +305,6 @@ .icon-voxels:before { content: "\e005"; } -.icon-lock:before { - content: "\e006"; -} .icon-visible:before { content: "\e007"; } @@ -428,9 +422,6 @@ .icon-password:before { content: "\e029"; } -.icon-rez:before { - content: "\e025"; -} .icon-keyboard-collapse:before { content: "\e02b"; } @@ -485,3 +476,21 @@ .icon-oculus:before { content: "\e036"; } +.icon-check-circled:before { + content: "\e037"; +} +.icon-rez-01:before { + content: "\e025"; +} +.icon-locked:before { + content: "\e006"; +} +.icon-unlocked:before { + content: "\e039"; +} +.icon-mic:before { + content: "\69"; +} +.icon-92-lock-01:before { + content: "\e038"; +} diff --git a/interface/resources/fonts/hifi-glyphs.ttf b/interface/resources/fonts/hifi-glyphs.ttf index aaeb1d2ace..dae388d2eb 100644 Binary files a/interface/resources/fonts/hifi-glyphs.ttf and b/interface/resources/fonts/hifi-glyphs.ttf differ diff --git a/interface/resources/qml/controlsUit/Switch.qml b/interface/resources/qml/controlsUit/Switch.qml index 0961ef2500..4e1c21c456 100644 --- a/interface/resources/qml/controlsUit/Switch.qml +++ b/interface/resources/qml/controlsUit/Switch.qml @@ -27,6 +27,7 @@ Item { property string labelGlyphOnText: ""; property int labelGlyphOnSize: 32; property alias checked: originalSwitch.checked; + property string backgroundOnColor: "#252525"; signal onCheckedChanged; signal clicked; @@ -40,10 +41,10 @@ Item { onClicked: rootSwitch.clicked(); hoverEnabled: true - topPadding: 3; + topPadding: 1; leftPadding: 3; rightPadding: 3; - bottomPadding: 3; + bottomPadding: 1; onHoveredChanged: { if (hovered) { @@ -54,7 +55,7 @@ Item { } background: Rectangle { - color: "#252525"; + color: checked ? backgroundOnColor : "#252525"; implicitWidth: rootSwitch.switchWidth; implicitHeight: rootSwitch.height; radius: rootSwitch.switchRadius; diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index 242ca5ab57..646fc881e1 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -376,7 +376,7 @@ Item { } FiraSansRegular { id: nameCardConnectionInfoText - visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard + visible: selected && !isMyCard && pal.activeTab == "connectionsTab" width: parent.width height: displayNameTextPixelSize size: displayNameTextPixelSize - 4 @@ -412,7 +412,7 @@ Item { } FiraSansRegular { id: nameCardRemoveConnectionText - visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard + visible: selected && !isMyCard && pal.activeTab == "connectionsTab" width: parent.width height: displayNameTextPixelSize size: displayNameTextPixelSize - 4 @@ -425,7 +425,7 @@ Item { } HifiControls.Button { id: visitConnectionButton - visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard + visible: selected && !isMyCard && pal.activeTab == "connectionsTab" text: "Visit" enabled: thisNameCard.placeName !== "" anchors.verticalCenter: nameCardRemoveConnectionImage.verticalCenter @@ -450,7 +450,7 @@ Item { // Style radius: 4 color: "#c5c5c5" - visible: (isMyCard || (selected && pal.activeTab == "nearbyTab")) && isPresent + visible: (!isMyCard && (selected && pal.activeTab == "nearbyTab")) && isPresent // Rectangle for the zero-gain point on the VU meter Rectangle { id: vuMeterZeroGain @@ -481,7 +481,7 @@ Item { id: vuMeterBase // Anchors anchors.fill: parent - visible: isMyCard || selected + visible: !isMyCard && selected // Style color: parent.color radius: parent.radius @@ -489,7 +489,7 @@ Item { // Rectangle for the VU meter audio level Rectangle { id: vuMeterLevel - visible: isMyCard || selected + visible: !isMyCard && selected // Size width: (thisNameCard.audioLevel) * parent.width // Style @@ -525,7 +525,7 @@ Item { anchors.verticalCenter: nameCardVUMeter.verticalCenter; anchors.left: nameCardVUMeter.left; // Properties - visible: (isMyCard || (selected && pal.activeTab == "nearbyTab")) && isPresent; + visible: (!isMyCard && (selected && pal.activeTab == "nearbyTab")) && isPresent; minimumValue: -60.0 maximumValue: 20.0 stepSize: 5 @@ -572,19 +572,7 @@ Item { implicitHeight: 16 } } - RalewayRegular { - // The slider for my card is special, it controls the master gain - id: gainSliderText; - visible: isMyCard; - text: "master volume"; - size: hifi.fontSizes.tabularData; - anchors.left: parent.right; - anchors.leftMargin: 8; - color: hifi.colors.baseGrayHighlight; - horizontalAlignment: Text.AlignLeft; - verticalAlignment: Text.AlignTop; - } - } + } function updateGainFromQML(avatarUuid, sliderValue, isReleased) { if (Users.getAvatarGain(avatarUuid) != sliderValue) { diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index c8dd83cd62..efbf663838 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -11,12 +11,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -import QtQuick 2.5 +import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import stylesUit 1.0 -import controlsUit 1.0 as HifiControls +import controlsUit 1.0 as HifiControlsUit import "../../windows" import "./" as AudioControls @@ -26,7 +26,11 @@ Rectangle { HifiConstants { id: hifi; } property var eventBridge; + // leave as blank, this is user's volume for the avatar mixer + property var myAvatarUuid: "" property string title: "Audio Settings" + property int switchHeight: 16 + property int switchWidth: 40 signal sendToScript(var message); color: hifi.colors.baseGray; @@ -38,7 +42,7 @@ Rectangle { property bool isVR: AudioScriptingInterface.context === "VR" - property real rightMostInputLevelPos: 0 + property real rightMostInputLevelPos: 450 //placeholder for control sizes and paddings //recalculates dynamically in case of UI size is changed QtObject { @@ -80,16 +84,16 @@ Rectangle { }); } - function disablePeakValues() { - root.showPeaks = false; - AudioScriptingInterface.devices.input.peakValuesEnabled = false; + function updateMyAvatarGainFromQML(sliderValue, isReleased) { + if (Users.getAvatarGain(myAvatarUuid) != sliderValue) { + Users.setAvatarGain(myAvatarUuid, sliderValue); + } } Component.onCompleted: enablePeakValues(); - Component.onDestruction: disablePeakValues(); - onVisibleChanged: visible ? enablePeakValues() : disablePeakValues(); Column { + id: column spacing: 12; anchors.top: bar.bottom anchors.bottom: parent.bottom @@ -98,65 +102,68 @@ Rectangle { Separator { } - RalewayRegular { - x: margins.paddings + muteMic.boxSize + muteMic.spacing; - size: 16; - color: "white"; - text: qsTr("Input Device Settings") - } - - ColumnLayout { - x: margins.paddings; - spacing: 16; + RowLayout { + x: 2 * margins.paddings; + spacing: columnOne.width; width: parent.width; // mute is in its own row - RowLayout { - spacing: (margins.sizeCheckBox - 10.5) * 3; - AudioControls.CheckBox { - id: muteMic - text: qsTr("Mute microphone"); - spacing: margins.sizeCheckBox - boxSize - isRedCheck: true; + ColumnLayout { + id: columnOne + spacing: 24; + x: margins.paddings + HifiControlsUit.Switch { + id: muteMic; + height: root.switchHeight; + switchWidth: root.switchWidth; + labelTextOn: "Mute microphone"; + backgroundOnColor: "#E3E3E3"; checked: AudioScriptingInterface.muted; - onClicked: { + onCheckedChanged: { AudioScriptingInterface.muted = checked; checked = Qt.binding(function() { return AudioScriptingInterface.muted; }); // restore binding } } - AudioControls.CheckBox { - id: stereoMic - spacing: muteMic.spacing; - text: qsTr("Enable stereo input"); + HifiControlsUit.Switch { + id: stereoInput; + height: root.switchHeight; + switchWidth: root.switchWidth; + labelTextOn: qsTr("Stereo input"); + backgroundOnColor: "#E3E3E3"; checked: AudioScriptingInterface.isStereoInput; - onClicked: { + onCheckedChanged: { AudioScriptingInterface.isStereoInput = checked; checked = Qt.binding(function() { return AudioScriptingInterface.isStereoInput; }); // restore binding } } } - RowLayout { - spacing: muteMic.spacing*2; //make it visually distinguish - AudioControls.CheckBox { - spacing: muteMic.spacing - text: qsTr("Enable noise reduction"); + ColumnLayout { + spacing: 24; + HifiControlsUit.Switch { + height: root.switchHeight; + switchWidth: root.switchWidth; + labelTextOn: "Noise Reduction"; + backgroundOnColor: "#E3E3E3"; checked: AudioScriptingInterface.noiseReduction; - onClicked: { + onCheckedChanged: { AudioScriptingInterface.noiseReduction = checked; checked = Qt.binding(function() { return AudioScriptingInterface.noiseReduction; }); // restore binding } } - AudioControls.CheckBox { - spacing: muteMic.spacing - text: qsTr("Show audio level meter"); + + HifiControlsUit.Switch { + id: audioLevelSwitch + height: root.switchHeight; + switchWidth: root.switchWidth; + labelTextOn: qsTr("Audio Level Meter"); + backgroundOnColor: "#E3E3E3"; checked: AvatarInputs.showAudioTools; - onClicked: { + onCheckedChanged: { AvatarInputs.showAudioTools = checked; checked = Qt.binding(function() { return AvatarInputs.showAudioTools; }); // restore binding } - onXChanged: rightMostInputLevelPos = x + width } } } @@ -171,7 +178,7 @@ Rectangle { HiFiGlyphs { width: margins.sizeCheckBox text: hifi.glyphs.mic; - color: hifi.colors.primaryHighlight; + color: hifi.colors.white; anchors.left: parent.left anchors.leftMargin: -size/4 //the glyph has empty space at left about 25% anchors.verticalCenter: parent.verticalCenter; @@ -183,8 +190,8 @@ Rectangle { anchors.left: parent.left anchors.leftMargin: margins.sizeCheckBox size: 16; - color: hifi.colors.lightGrayText; - text: qsTr("CHOOSE INPUT DEVICE"); + color: hifi.colors.white; + text: qsTr("Choose input device"); } } @@ -210,7 +217,7 @@ Rectangle { width: parent.width - inputLevel.width clip: true checkable: !checked - checked: bar.currentIndex === 0 ? selectedDesktop : selectedHMD; + checked: bar.currentIndex === 0 ? selectedDesktop : selectedHMD; boxSize: margins.sizeCheckBox / 2 isRound: true text: devicename @@ -222,7 +229,7 @@ Rectangle { } } } - InputPeak { + AudioControls.InputPeak { id: inputLevel anchors.right: parent.right peak: model.peak; @@ -233,6 +240,13 @@ Rectangle { } } } + AudioControls.LoopbackAudio { + x: margins.paddings + + visible: (bar.currentIndex === 1 && isVR) || + (bar.currentIndex === 0 && !isVR); + anchors { left: parent.left; leftMargin: margins.paddings } + } Separator {} @@ -247,7 +261,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter; width: margins.sizeCheckBox text: hifi.glyphs.unmuted; - color: hifi.colors.primaryHighlight; + color: hifi.colors.white; size: 36; } @@ -257,8 +271,8 @@ Rectangle { anchors.leftMargin: margins.sizeCheckBox anchors.verticalCenter: parent.verticalCenter; size: 16; - color: hifi.colors.lightGrayText; - text: qsTr("CHOOSE OUTPUT DEVICE"); + color: hifi.colors.white; + text: qsTr("Choose output device"); } } @@ -293,7 +307,68 @@ Rectangle { } } } - PlaySampleSound { + + Item { + id: gainContainer + x: margins.paddings; + width: parent.width - margins.paddings*2 + height: gainSliderTextMetrics.height + + HifiControlsUit.Slider { + id: gainSlider + anchors.right: parent.right + height: parent.height + width: 200 + minimumValue: -60.0 + maximumValue: 20.0 + stepSize: 5 + value: Users.getAvatarGain(myAvatarUuid) + onValueChanged: { + updateMyAvatarGainFromQML(value, false); + } + onPressedChanged: { + if (!pressed) { + updateMyAvatarGainFromQML(value, false); + } + } + + MouseArea { + anchors.fill: parent + onWheel: { + // Do nothing. + } + onDoubleClicked: { + gainSlider.value = 0.0 + } + onPressed: { + // Pass through to Slider + mouse.accepted = false + } + onReleased: { + // the above mouse.accepted seems to make this + // never get called, nonetheless... + mouse.accepted = false + } + } + } + TextMetrics { + id: gainSliderTextMetrics + text: gainSliderText.text + font: gainSliderText.font + } + RalewayRegular { + // The slider for my card is special, it controls the master gain + id: gainSliderText; + text: "Avatar volume"; + size: 16; + anchors.left: parent.left; + color: hifi.colors.white; + horizontalAlignment: Text.AlignLeft; + verticalAlignment: Text.AlignTop; + } + } + + AudioControls.PlaySampleSound { x: margins.paddings visible: (bar.currentIndex === 1 && isVR) || diff --git a/interface/resources/qml/hifi/audio/LoopbackAudio.qml b/interface/resources/qml/hifi/audio/LoopbackAudio.qml new file mode 100644 index 0000000000..8ec0ffc496 --- /dev/null +++ b/interface/resources/qml/hifi/audio/LoopbackAudio.qml @@ -0,0 +1,67 @@ +// +// LoopbackAudio.qml +// qml/hifi/audio +// +// Created by Seth Alves on 2019-2-18 +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +import QtQuick 2.7 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControlsUit + +RowLayout { + property bool audioLoopedBack: AudioScriptingInterface.getServerEcho(); + function startAudioLoopback() { + if (!audioLoopedBack) { + audioLoopedBack = true; + AudioScriptingInterface.setServerEcho(true); + } + } + function stopAudioLoopback() { + if (audioLoopedBack) { + audioLoopedBack = false; + AudioScriptingInterface.setServerEcho(false); + } + } + + HifiConstants { id: hifi; } + + Timer { + id: loopbackTimer + interval: 8000; + running: false; + repeat: false; + onTriggered: { + stopAudioLoopback(); + } + } + + HifiControlsUit.Button { + text: audioLoopedBack ? qsTr("STOP TESTING YOUR VOICE") : qsTr("TEST YOUR VOICE"); + color: audioLoopedBack ? hifi.buttons.red : hifi.buttons.blue; + onClicked: { + if (audioLoopedBack) { + loopbackTimer.stop(); + stopAudioLoopback(); + } else { + loopbackTimer.restart(); + startAudioLoopback(); + } + } + } + + RalewayRegular { + Layout.leftMargin: 2; + size: 14; + color: "white"; + font.italic: true + text: audioLoopedBack ? qsTr("Speak in your input") : ""; + } +} diff --git a/interface/resources/qml/hifi/audio/PlaySampleSound.qml b/interface/resources/qml/hifi/audio/PlaySampleSound.qml index cfe55af9c4..b9d9727dab 100644 --- a/interface/resources/qml/hifi/audio/PlaySampleSound.qml +++ b/interface/resources/qml/hifi/audio/PlaySampleSound.qml @@ -14,7 +14,7 @@ import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import stylesUit 1.0 -import controlsUit 1.0 as HifiControls +import controlsUit 1.0 as HifiControlsUit RowLayout { property var sound: null; @@ -55,32 +55,9 @@ RowLayout { HifiConstants { id: hifi; } - Button { - id: control - background: Rectangle { - implicitWidth: 20; - implicitHeight: 20; - radius: hifi.buttons.radius; - gradient: Gradient { - GradientStop { - position: 0.2; - color: isPlaying ? hifi.buttons.colorStart[hifi.buttons.blue] : hifi.buttons.colorStart[hifi.buttons.black]; - } - GradientStop { - position: 1.0; - color: isPlaying ? hifi.buttons.colorFinish[hifi.buttons.blue] : hifi.buttons.colorFinish[hifi.buttons.black]; - } - } - } - contentItem: HiFiGlyphs { - // absolutely position due to asymmetry in glyph -// x: isPlaying ? 0 : 1; -// y: 1; - size: 14; - color: (control.pressed || control.hovered) ? (isPlaying ? "black" : hifi.colors.primaryHighlight) : "white"; - text: isPlaying ? hifi.glyphs.stop_square : hifi.glyphs.playback_play; - } - + HifiControlsUit.Button { + text: isPlaying ? qsTr("STOP TESTING YOUR SOUND") : qsTr("TEST YOUR SOUND"); + color: isPlaying ? hifi.buttons.red : hifi.buttons.blue; onClicked: isPlaying ? stopSound() : playSound(); } @@ -88,7 +65,7 @@ RowLayout { Layout.leftMargin: 2; size: 14; color: "white"; - text: isPlaying ? qsTr("Stop sample sound") : qsTr("Play sample sound"); + font.italic: true + text: isPlaying ? qsTr("Listen to your output") : ""; } - } diff --git a/interface/src/scripting/Audio.h b/interface/src/scripting/Audio.h index e4dcba9130..fcf3c181da 100644 --- a/interface/src/scripting/Audio.h +++ b/interface/src/scripting/Audio.h @@ -192,7 +192,7 @@ signals: * }); */ void mutedChanged(bool isMuted); - + /**jsdoc * Triggered when the audio input noise reduction is enabled or disabled. * @function Audio.noiseReductionChanged diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 8c50a195ee..b2e6167ffa 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -1531,7 +1531,6 @@ void AudioClient::setNoiseReduction(bool enable, bool emitSignal) { } } - bool AudioClient::setIsStereoInput(bool isStereoInput) { bool stereoInputChanged = false; if (isStereoInput != _isStereoInput && _inputDeviceInfo.supportedChannelCounts().contains(2)) { diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 29036b7c71..87e0f68e72 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -210,13 +210,13 @@ public slots: void setNoiseReduction(bool isNoiseGateEnabled, bool emitSignal = true); bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; } - bool getLocalEcho() { return _shouldEchoLocally; } - void setLocalEcho(bool localEcho) { _shouldEchoLocally = localEcho; } - void toggleLocalEcho() { _shouldEchoLocally = !_shouldEchoLocally; } + virtual bool getLocalEcho() override { return _shouldEchoLocally; } + virtual void setLocalEcho(bool localEcho) override { _shouldEchoLocally = localEcho; } + virtual void toggleLocalEcho() override { _shouldEchoLocally = !_shouldEchoLocally; } - bool getServerEcho() { return _shouldEchoToServer; } - void setServerEcho(bool serverEcho) { _shouldEchoToServer = serverEcho; } - void toggleServerEcho() { _shouldEchoToServer = !_shouldEchoToServer; } + virtual bool getServerEcho() override { return _shouldEchoToServer; } + virtual void setServerEcho(bool serverEcho) override { _shouldEchoToServer = serverEcho; } + virtual void toggleServerEcho() override { _shouldEchoToServer = !_shouldEchoToServer; } void processReceivedSamples(const QByteArray& inputBuffer, QByteArray& outputBuffer); void sendMuteEnvironmentPacket(); diff --git a/libraries/audio/src/AbstractAudioInterface.h b/libraries/audio/src/AbstractAudioInterface.h index 0f075ab224..e9e40e95f9 100644 --- a/libraries/audio/src/AbstractAudioInterface.h +++ b/libraries/audio/src/AbstractAudioInterface.h @@ -45,9 +45,16 @@ public slots: virtual bool shouldLoopbackInjectors() { return false; } virtual bool setIsStereoInput(bool stereo) = 0; - virtual bool isStereoInput() = 0; + virtual bool getLocalEcho() = 0; + virtual void setLocalEcho(bool localEcho) = 0; + virtual void toggleLocalEcho() = 0; + + virtual bool getServerEcho() = 0; + virtual void setServerEcho(bool serverEcho) = 0; + virtual void toggleServerEcho() = 0; + signals: void isStereoInputChanged(bool isStereo); }; diff --git a/libraries/script-engine/src/AudioScriptingInterface.cpp b/libraries/script-engine/src/AudioScriptingInterface.cpp index 8e54d2d5de..65d71e46e6 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.cpp +++ b/libraries/script-engine/src/AudioScriptingInterface.cpp @@ -88,3 +88,43 @@ bool AudioScriptingInterface::isStereoInput() { } return stereoEnabled; } + +bool AudioScriptingInterface::getServerEcho() { + bool serverEchoEnabled = false; + if (_localAudioInterface) { + serverEchoEnabled = _localAudioInterface->getServerEcho(); + } + return serverEchoEnabled; +} + +void AudioScriptingInterface::setServerEcho(bool serverEcho) { + if (_localAudioInterface) { + QMetaObject::invokeMethod(_localAudioInterface, "setServerEcho", Q_ARG(bool, serverEcho)); + } +} + +void AudioScriptingInterface::toggleServerEcho() { + if (_localAudioInterface) { + QMetaObject::invokeMethod(_localAudioInterface, "toggleServerEcho"); + } +} + +bool AudioScriptingInterface::getLocalEcho() { + bool localEchoEnabled = false; + if (_localAudioInterface) { + localEchoEnabled = _localAudioInterface->getLocalEcho(); + } + return localEchoEnabled; +} + +void AudioScriptingInterface::setLocalEcho(bool localEcho) { + if (_localAudioInterface) { + QMetaObject::invokeMethod(_localAudioInterface, "setLocalEcho", Q_ARG(bool, localEcho)); + } +} + +void AudioScriptingInterface::toggleLocalEcho() { + if (_localAudioInterface) { + QMetaObject::invokeMethod(_localAudioInterface, "toggleLocalEcho"); + } +} diff --git a/libraries/script-engine/src/AudioScriptingInterface.h b/libraries/script-engine/src/AudioScriptingInterface.h index d2f886d2dd..a6801dcdcb 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.h +++ b/libraries/script-engine/src/AudioScriptingInterface.h @@ -66,6 +66,39 @@ public: _localAudioInterface->getAudioSolo().reset(); } + /**jsdoc + * @function Audio.getServerEcho + */ + Q_INVOKABLE bool getServerEcho(); + + /**jsdoc + * @function Audio.setServerEcho + * @parm {boolean} serverEcho + */ + Q_INVOKABLE void setServerEcho(bool serverEcho); + + /**jsdoc + * @function Audio.toggleServerEcho + */ + Q_INVOKABLE void toggleServerEcho(); + + /**jsdoc + * @function Audio.getLocalEcho + */ + Q_INVOKABLE bool getLocalEcho(); + + /**jsdoc + * @function Audio.setLocalEcho + * @parm {boolean} localEcho + */ + Q_INVOKABLE void setLocalEcho(bool localEcho); + + /**jsdoc + * @function Audio.toggleLocalEcho + */ + Q_INVOKABLE void toggleLocalEcho(); + + protected: AudioScriptingInterface() = default; diff --git a/scripts/system/audioMuteOverlay.js b/scripts/system/audioMuteOverlay.js index 731d62017d..c597f75bca 100644 --- a/scripts/system/audioMuteOverlay.js +++ b/scripts/system/audioMuteOverlay.js @@ -14,7 +14,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -(function() { // BEGIN LOCAL_SCOPE +(function () { // BEGIN LOCAL_SCOPE var utilsPath = Script.resolvePath('../developer/libraries/utils.js'); Script.include(utilsPath); @@ -67,7 +67,7 @@ } function hasOverlay() { - return Overlays.getProperty(overlayID, "position") !== undefined; + return Overlays.getProperty(overlayID, "position") !== undefined; } function updateOverlay() { @@ -101,4 +101,4 @@ Audio.muted.disconnect(onMuteToggled); Script.update.disconnect(update); } -}()); // END LOCAL_SCOPE +}()); // END LOCAL_SCOPE \ No newline at end of file