From 97d283cc5f3d18628a69e55334c8e91e5a3d65b5 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 6 Mar 2018 16:17:27 -0800 Subject: [PATCH 1/5] use correct api call for audio and correct function call to set stereo input mode --- interface/resources/qml/hifi/audio/Audio.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index 156332579a..684a732286 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -131,7 +131,7 @@ Rectangle { text: qsTr("use stereo for stereo devices"); checked: false; onClicked: { - var success = Audio.setIsStereoInput(checked); + var success = AudioScriptingInterface.setStereoInput(checked); if (!success) { checked = !checked; } @@ -219,7 +219,7 @@ Rectangle { onPressed: { if (!checked) { stereoMic.checked = false; - Audio.setIsStereoInput(false); // the next selected audio device might not support stereo + AudioScriptingInterface.setStereoInput(false); // the next selected audio device might not support stereo AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1); } } From 13767beece24de41649b9d408961009b296562ed Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 7 Mar 2018 08:19:36 -0800 Subject: [PATCH 2/5] Caps change --- 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 684a732286..b598e26954 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("use stereo for stereo devices"); + text: qsTr("Use stereo for stereo devices"); checked: false; onClicked: { var success = AudioScriptingInterface.setStereoInput(checked); From c49d0557fca907d00cdef01b46ee5608448bbb28 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 9 Mar 2018 09:29:37 -0800 Subject: [PATCH 3/5] fixing check box issues --- interface/resources/qml/hifi/audio/Audio.qml | 2 +- libraries/audio-client/src/AudioClient.h | 1 + libraries/audio/src/AbstractAudioInterface.h | 6 ++++-- libraries/script-engine/src/AudioScriptingInterface.cpp | 8 ++++++++ libraries/script-engine/src/AudioScriptingInterface.h | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index b598e26954..6e0131c86f 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -129,7 +129,7 @@ Rectangle { id: stereoMic spacing: muteMic.spacing; text: qsTr("Use stereo for stereo devices"); - checked: false; + checked: AudioScriptingInterface.isStereoEnabled(); onClicked: { var success = AudioScriptingInterface.setStereoInput(checked); if (!success) { diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 053202f583..1ec58c8507 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -193,6 +193,7 @@ public slots: bool isMuted() { return _muted; } virtual bool setIsStereoInput(bool stereo) override; + virtual bool isStereoEnabled() override { return _isStereoInput; } void setNoiseReduction(bool isNoiseGateEnabled); bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; } diff --git a/libraries/audio/src/AbstractAudioInterface.h b/libraries/audio/src/AbstractAudioInterface.h index ba1e733f13..20ab1a80ec 100644 --- a/libraries/audio/src/AbstractAudioInterface.h +++ b/libraries/audio/src/AbstractAudioInterface.h @@ -28,7 +28,7 @@ class AbstractAudioInterface : public QObject { Q_OBJECT public: AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {}; - + static void emitAudioPacket(const void* audioData, size_t bytes, quint16& sequenceNumber, bool isStereo, const Transform& transform, glm::vec3 avatarBoundingBoxCorner, glm::vec3 avatarBoundingBoxScale, PacketType packetType, QString codecName = QString("")); @@ -40,8 +40,10 @@ public: public slots: virtual bool shouldLoopbackInjectors() { return false; } - + virtual bool setIsStereoInput(bool stereo) = 0; + + virtual bool isStereoEnabled() = 0; }; Q_DECLARE_METATYPE(AbstractAudioInterface*) diff --git a/libraries/script-engine/src/AudioScriptingInterface.cpp b/libraries/script-engine/src/AudioScriptingInterface.cpp index dd8d284c12..9bf275ddbf 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.cpp +++ b/libraries/script-engine/src/AudioScriptingInterface.cpp @@ -67,3 +67,11 @@ bool AudioScriptingInterface::setStereoInput(bool stereo) { } return stereoInputChanged; } + +bool AudioScriptingInterface::isStereoEnabled() { + bool stereoEnabled = false; + if (_localAudioInterface) { + stereoEnabled = _localAudioInterface->isStereoEnabled(); + } + return stereoEnabled; +} diff --git a/libraries/script-engine/src/AudioScriptingInterface.h b/libraries/script-engine/src/AudioScriptingInterface.h index d46430ccce..08357536b7 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.h +++ b/libraries/script-engine/src/AudioScriptingInterface.h @@ -36,6 +36,7 @@ protected: Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position); Q_INVOKABLE bool setStereoInput(bool stereo); + Q_INVOKABLE bool isStereoEnabled(); signals: void mutedByMixer(); /// the client has been muted by the mixer From 3a39fca26819d64b0ac82232fb163d3f01436cb4 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 9 Mar 2018 10:09:51 -0800 Subject: [PATCH 4/5] made requested changes --- interface/resources/qml/hifi/audio/Audio.qml | 4 ++-- libraries/audio-client/src/AudioClient.h | 2 +- libraries/audio/src/AbstractAudioInterface.h | 2 +- libraries/script-engine/src/AudioScriptingInterface.cpp | 4 ++-- libraries/script-engine/src/AudioScriptingInterface.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index 6e0131c86f..776bebf374 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -128,8 +128,8 @@ Rectangle { AudioControls.CheckBox { id: stereoMic spacing: muteMic.spacing; - text: qsTr("Use stereo for stereo devices"); - checked: AudioScriptingInterface.isStereoEnabled(); + text: qsTr("Use stereo for input device"); + checked: AudioScriptingInterface.isStereoInput(); onClicked: { var success = AudioScriptingInterface.setStereoInput(checked); if (!success) { diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 1ec58c8507..3bfbdb49ce 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -193,7 +193,7 @@ public slots: bool isMuted() { return _muted; } virtual bool setIsStereoInput(bool stereo) override; - virtual bool isStereoEnabled() override { return _isStereoInput; } + virtual bool isStereoInput() override { return _isStereoInput; } void setNoiseReduction(bool isNoiseGateEnabled); bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; } diff --git a/libraries/audio/src/AbstractAudioInterface.h b/libraries/audio/src/AbstractAudioInterface.h index 20ab1a80ec..30cbceeb0e 100644 --- a/libraries/audio/src/AbstractAudioInterface.h +++ b/libraries/audio/src/AbstractAudioInterface.h @@ -43,7 +43,7 @@ public slots: virtual bool setIsStereoInput(bool stereo) = 0; - virtual bool isStereoEnabled() = 0; + virtual bool isStereoInput() = 0; }; Q_DECLARE_METATYPE(AbstractAudioInterface*) diff --git a/libraries/script-engine/src/AudioScriptingInterface.cpp b/libraries/script-engine/src/AudioScriptingInterface.cpp index 9bf275ddbf..f248c20d41 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.cpp +++ b/libraries/script-engine/src/AudioScriptingInterface.cpp @@ -68,10 +68,10 @@ bool AudioScriptingInterface::setStereoInput(bool stereo) { return stereoInputChanged; } -bool AudioScriptingInterface::isStereoEnabled() { +bool AudioScriptingInterface::isStereoInput() { bool stereoEnabled = false; if (_localAudioInterface) { - stereoEnabled = _localAudioInterface->isStereoEnabled(); + stereoEnabled = _localAudioInterface->isStereoInput(); } return stereoEnabled; } diff --git a/libraries/script-engine/src/AudioScriptingInterface.h b/libraries/script-engine/src/AudioScriptingInterface.h index 08357536b7..be2b4ebc8c 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.h +++ b/libraries/script-engine/src/AudioScriptingInterface.h @@ -36,7 +36,7 @@ protected: Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position); Q_INVOKABLE bool setStereoInput(bool stereo); - Q_INVOKABLE bool isStereoEnabled(); + Q_INVOKABLE bool isStereoInput(); signals: void mutedByMixer(); /// the client has been muted by the mixer From e21c4988fb8035209c3e2ad034a870ac5fa68628 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 9 Mar 2018 10:11:25 -0800 Subject: [PATCH 5/5] stereo checkbox text change --- 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 776bebf374..ba50b7f238 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("Use stereo for input device"); + text: qsTr("Enable stereo input"); checked: AudioScriptingInterface.isStereoInput(); onClicked: { var success = AudioScriptingInterface.setStereoInput(checked);