From 5d74a865e85d2b619dd1cc1bdd5843a3340d0819 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 29 May 2013 11:35:32 -0700 Subject: [PATCH] make audio echo a menu option instead of forcing with mirror --- interface/src/Application.cpp | 8 +++----- interface/src/Application.h | 4 +++- interface/src/Audio.cpp | 4 ++-- interface/src/Audio.h | 3 --- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a8e62a68e7..f307efa470 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -965,11 +965,7 @@ void Application::pair() { PairingHandler::sendPairRequest(); } -void Application::setHead(bool head) { - #ifndef _WIN32 - _audio.setMixerLoopbackFlag(head); - #endif - +void Application::setHead(bool head) { if (head) { _myCamera.setMode(CAMERA_MODE_MIRROR); _myCamera.setModeShiftRate(100.0f); @@ -1133,6 +1129,8 @@ void Application::initMenu() { QMenu* optionsMenu = menuBar->addMenu("Options"); (_lookingInMirror = optionsMenu->addAction("Mirror", this, SLOT(setHead(bool)), Qt::Key_H))->setCheckable(true); + (_echoAudioMode = optionsMenu->addAction("Echo Audio"))->setCheckable(true); + optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true); (_gyroLook = optionsMenu->addAction("Gyro Look"))->setCheckable(true); _gyroLook->setChecked(true); diff --git a/interface/src/Application.h b/interface/src/Application.h index 35d49d275a..ac089b4dd4 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -64,6 +64,7 @@ public: Avatar* getAvatar() { return &_myAvatar; } VoxelSystem* getVoxels() { return &_voxels; } Environment* getEnvironment() { return &_environment; } + QAction* getEchoAudioMode() { return _echoAudioMode; } private slots: @@ -137,7 +138,8 @@ private: QMainWindow* _window; QGLWidget* _glWidget; - QAction* _lookingInMirror; // Are we currently rendering one's own head as if in mirror? + QAction* _lookingInMirror; // Are we currently rendering one's own head as if in mirror? + QAction* _echoAudioMode; // Are we asking the mixer to echo back our audio? QAction* _gyroLook; // Whether to allow the gyro data from head to move your view QAction* _mouseLook; // Whether the have the mouse near edge of screen move your view QAction* _showHeadMouse; // Whether the have the mouse near edge of screen move your view diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 8acb70ebcc..8b484e1fb8 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "Application.h" #include "Audio.h" @@ -158,7 +159,7 @@ int audioCallback (const void* inputBuffer, correctedYaw += 360; } - if (parentAudio->_mixerLoopbackFlag) { + if (Application::getInstance()->getEchoAudioMode()->isChecked()) { correctedYaw = correctedYaw > 0 ? correctedYaw + AGENT_LOOPBACK_MODIFIER : correctedYaw - AGENT_LOOPBACK_MODIFIER; @@ -310,7 +311,6 @@ Audio::Audio(Oscilloscope* scope) : NUM_AUDIO_CHANNELS * (SAMPLE_RATE / 1000.0)), _wasStarved(0), _lastInputLoudness(0), - _mixerLoopbackFlag(false), _lastVelocity(0), _lastAcceleration(0), _totalPacketsReceived(0), diff --git a/interface/src/Audio.h b/interface/src/Audio.h index 34a342a1d4..197daf0194 100644 --- a/interface/src/Audio.h +++ b/interface/src/Audio.h @@ -24,8 +24,6 @@ public: void render(int screenWidth, int screenHeight); - void setMixerLoopbackFlag(bool mixerLoopbackFlag) { _mixerLoopbackFlag = mixerLoopbackFlag; } - float getLastInputLoudness() const { return _lastInputLoudness; }; void setLastAcceleration(glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; }; @@ -52,7 +50,6 @@ private: short _jitterBufferSamples; int _wasStarved; float _lastInputLoudness; - bool _mixerLoopbackFlag; glm::vec3 _lastVelocity; glm::vec3 _lastAcceleration; int _totalPacketsReceived;