make audio echo a menu option instead of forcing with mirror

This commit is contained in:
Stephen Birarda 2013-05-29 11:35:32 -07:00
parent a3a5241672
commit 5d74a865e8
4 changed files with 8 additions and 11 deletions

View file

@ -965,11 +965,7 @@ void Application::pair() {
PairingHandler::sendPairRequest(); PairingHandler::sendPairRequest();
} }
void Application::setHead(bool head) { void Application::setHead(bool head) {
#ifndef _WIN32
_audio.setMixerLoopbackFlag(head);
#endif
if (head) { if (head) {
_myCamera.setMode(CAMERA_MODE_MIRROR); _myCamera.setMode(CAMERA_MODE_MIRROR);
_myCamera.setModeShiftRate(100.0f); _myCamera.setModeShiftRate(100.0f);
@ -1133,6 +1129,8 @@ void Application::initMenu() {
QMenu* optionsMenu = menuBar->addMenu("Options"); QMenu* optionsMenu = menuBar->addMenu("Options");
(_lookingInMirror = optionsMenu->addAction("Mirror", this, SLOT(setHead(bool)), Qt::Key_H))->setCheckable(true); (_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); optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true);
(_gyroLook = optionsMenu->addAction("Gyro Look"))->setCheckable(true); (_gyroLook = optionsMenu->addAction("Gyro Look"))->setCheckable(true);
_gyroLook->setChecked(true); _gyroLook->setChecked(true);

View file

@ -64,6 +64,7 @@ public:
Avatar* getAvatar() { return &_myAvatar; } Avatar* getAvatar() { return &_myAvatar; }
VoxelSystem* getVoxels() { return &_voxels; } VoxelSystem* getVoxels() { return &_voxels; }
Environment* getEnvironment() { return &_environment; } Environment* getEnvironment() { return &_environment; }
QAction* getEchoAudioMode() { return _echoAudioMode; }
private slots: private slots:
@ -137,7 +138,8 @@ private:
QMainWindow* _window; QMainWindow* _window;
QGLWidget* _glWidget; 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* _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* _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 QAction* _showHeadMouse; // Whether the have the mouse near edge of screen move your view

View file

@ -19,6 +19,7 @@
#include <PacketHeaders.h> #include <PacketHeaders.h>
#include <AgentList.h> #include <AgentList.h>
#include <AgentTypes.h> #include <AgentTypes.h>
#include <QAction>
#include "Application.h" #include "Application.h"
#include "Audio.h" #include "Audio.h"
@ -158,7 +159,7 @@ int audioCallback (const void* inputBuffer,
correctedYaw += 360; correctedYaw += 360;
} }
if (parentAudio->_mixerLoopbackFlag) { if (Application::getInstance()->getEchoAudioMode()->isChecked()) {
correctedYaw = correctedYaw > 0 correctedYaw = correctedYaw > 0
? correctedYaw + AGENT_LOOPBACK_MODIFIER ? correctedYaw + AGENT_LOOPBACK_MODIFIER
: correctedYaw - AGENT_LOOPBACK_MODIFIER; : correctedYaw - AGENT_LOOPBACK_MODIFIER;
@ -310,7 +311,6 @@ Audio::Audio(Oscilloscope* scope) :
NUM_AUDIO_CHANNELS * (SAMPLE_RATE / 1000.0)), NUM_AUDIO_CHANNELS * (SAMPLE_RATE / 1000.0)),
_wasStarved(0), _wasStarved(0),
_lastInputLoudness(0), _lastInputLoudness(0),
_mixerLoopbackFlag(false),
_lastVelocity(0), _lastVelocity(0),
_lastAcceleration(0), _lastAcceleration(0),
_totalPacketsReceived(0), _totalPacketsReceived(0),

View file

@ -24,8 +24,6 @@ public:
void render(int screenWidth, int screenHeight); void render(int screenWidth, int screenHeight);
void setMixerLoopbackFlag(bool mixerLoopbackFlag) { _mixerLoopbackFlag = mixerLoopbackFlag; }
float getLastInputLoudness() const { return _lastInputLoudness; }; float getLastInputLoudness() const { return _lastInputLoudness; };
void setLastAcceleration(glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; }; void setLastAcceleration(glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; };
@ -52,7 +50,6 @@ private:
short _jitterBufferSamples; short _jitterBufferSamples;
int _wasStarved; int _wasStarved;
float _lastInputLoudness; float _lastInputLoudness;
bool _mixerLoopbackFlag;
glm::vec3 _lastVelocity; glm::vec3 _lastVelocity;
glm::vec3 _lastAcceleration; glm::vec3 _lastAcceleration;
int _totalPacketsReceived; int _totalPacketsReceived;