From 7ce380a3337619f727251042672da4223e5fef1c Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 27 Feb 2014 18:02:53 -0800 Subject: [PATCH] relocate mute button, audio scope --- interface/src/Application.cpp | 5 ++--- interface/src/Audio.cpp | 11 +++-------- interface/src/Audio.h | 3 ++- interface/src/Util.cpp | 23 ----------------------- interface/src/Util.h | 2 -- 5 files changed, 7 insertions(+), 37 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6f1ce7792d..762ada8eea 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2487,14 +2487,13 @@ void Application::displayOverlay() { } if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { + _audio.renderMuteIcon(1, _glWidget->height() - 50); if (Menu::getInstance()->isOptionChecked(MenuOption::Oscilloscope)) { - int oscilloscopeTop = Menu::getInstance()->isOptionChecked(MenuOption::Mirror) ? 130 : 25; + int oscilloscopeTop = _glWidget->height() - 135; _audioScope.render(25, oscilloscopeTop); } } - //noiseTest(_glWidget->width(), _glWidget->height()); - if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) { _myAvatar->renderHeadMouse(); } diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 5a6c819b79..66c8dbd5d0 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -40,10 +40,7 @@ static const float AUDIO_CALLBACK_MSECS = (float) NETWORK_BUFFER_LENGTH_SAMPLES_ static const int NUMBER_OF_NOISE_SAMPLE_FRAMES = 300; // Mute icon configration -static const int ICON_SIZE = 24; -static const int ICON_LEFT = 0; -static const int ICON_TOP = 115; -static const int ICON_TOP_MIRROR = 220; +static const int MUTE_ICON_SIZE = 24; Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* parent) : AbstractAudioInterface(parent), @@ -706,11 +703,9 @@ void Audio::handleAudioByteArray(const QByteArray& audioByteArray) { // or send to the mixer and use delayed loopback } -void Audio::renderToolIcon(int screenHeight) { +void Audio::renderMuteIcon(int x, int y) { - int iconTop = Menu::getInstance()->isOptionChecked(MenuOption::Mirror) ? ICON_TOP_MIRROR : ICON_TOP; - - _iconBounds = QRect(ICON_LEFT, iconTop, ICON_SIZE, ICON_SIZE); + _iconBounds = QRect(x, y, MUTE_ICON_SIZE, MUTE_ICON_SIZE); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, _micTextureId); diff --git a/interface/src/Audio.h b/interface/src/Audio.h index bd28876732..6960ea718c 100644 --- a/interface/src/Audio.h +++ b/interface/src/Audio.h @@ -68,6 +68,8 @@ public: void init(QGLWidget *parent = 0); bool mousePressEvent(int x, int y); + void renderMuteIcon(int x, int y); + public slots: void start(); void addReceivedAudioToBuffer(const QByteArray& audioByteArray); @@ -146,7 +148,6 @@ private: // Add sounds that we want the user to not hear themselves, by adding on top of mic input signal void addProceduralSounds(int16_t* monoInput, int numSamples); - void renderToolIcon(int screenHeight); }; diff --git a/interface/src/Util.cpp b/interface/src/Util.cpp index 2e1ed98b87..998de58e94 100644 --- a/interface/src/Util.cpp +++ b/interface/src/Util.cpp @@ -226,29 +226,6 @@ void drawVector(glm::vec3 * vector) { } -// Render a 2D set of squares using perlin/fractal noise -void noiseTest(int w, int h) { - const float CELLS = 500; - const float NOISE_SCALE = 10.0; - float xStep = (float) w / CELLS; - float yStep = (float) h / CELLS; - glBegin(GL_QUADS); - for (float x = 0; x < (float)w; x += xStep) { - for (float y = 0; y < (float)h; y += yStep) { - // Generate a vector varying between 0-1 corresponding to the screen location - glm::vec2 position(NOISE_SCALE * x / (float) w, NOISE_SCALE * y / (float) h); - // Set the cell color using the noise value at that location - float color = glm::perlin(position); - glColor4f(color, color, color, 1.0); - glVertex2f(x, y); - glVertex2f(x + xStep, y); - glVertex2f(x + xStep, y + yStep); - glVertex2f(x, y + yStep); - } - } - glEnd(); -} - void renderWorldBox() { // Show edge of world float red[] = {1, 0, 0}; diff --git a/interface/src/Util.h b/interface/src/Util.h index a89a01e71a..28bc6b3fcf 100644 --- a/interface/src/Util.h +++ b/interface/src/Util.h @@ -35,8 +35,6 @@ void drawtext(int x, int y, float scale, float rotate, float thick, int mono, void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec, float r=1.0, float g=1.0, float b=1.0); -void noiseTest(int w, int h); - void drawVector(glm::vec3* vector); void printVector(glm::vec3 vec);