Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -2494,7 +2494,7 @@ void Application::displayOverlay() { · 2493 unmodified lines | ||
| 2494 | 2494 | renderCollisionOverlay(_glWidget->width(), _glWidget->height(), _audio.getCollisionSoundMagnitude()); |
| 2495 | 2495 | } |
| 2496 | 2496 | } |
| 2497 | − | |
| 2497 | + | |
| 2498 | 2498 | if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { |
| 2499 | 2499 | _audio.renderMuteIcon(1, _glWidget->height() - 50); |
| 2500 | 2500 | if (Menu::getInstance()->isOptionChecked(MenuOption::Oscilloscope)) { |
| @@ -2502,6 +2502,42 @@ void Application::displayOverlay() { · 1 unmodified line | ||
| 2502 | 2502 | _audioScope.render(25, oscilloscopeTop); |
| 2503 | 2503 | } |
| 2504 | 2504 | } |
| 2505 | + | |
| 2506 | + const int AUDIO_METER_WIDTH = 300; | |
| 2507 | + const int AUDIO_METER_INSET = 2; | |
| 2508 | + const int AUDIO_METER_SCALE_WIDTH = AUDIO_METER_WIDTH - 2 * AUDIO_METER_INSET; | |
| 2509 | + const int AUDIO_METER_HEIGHT = 8; | |
| 2510 | + const int AUDIO_METER_Y = _glWidget->height() - 40; | |
| 2511 | + const int AUDIO_METER_X = 25; | |
| 2512 | + const float CLIPPING_INDICATOR_TIME = 1.0f; | |
| 2513 | + float audioLevel = log10(_audio.getLastInputLoudness() + 1.0) / log10(32767.0) * (float)AUDIO_METER_SCALE_WIDTH; | |
| 2514 | + bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)); | |
| 2515 | + | |
| 2516 | + if (isClipping) { | |
| 2517 | + glColor3f(1, 0, 0); | |
| 2518 | + } else { | |
| 2519 | + glColor3f(0, 0, 0); | |
| 2520 | + } | |
| 2521 | + glBegin(GL_QUADS); | |
| 2522 | + // Draw background Quad | |
| 2523 | + glVertex2i(AUDIO_METER_X, AUDIO_METER_Y); | |
| 2524 | + glVertex2i(AUDIO_METER_X + AUDIO_METER_WIDTH, AUDIO_METER_Y); | |
| 2525 | + glVertex2i(AUDIO_METER_X + AUDIO_METER_WIDTH, AUDIO_METER_Y + AUDIO_METER_HEIGHT); | |
| 2526 | + glVertex2i(AUDIO_METER_X, AUDIO_METER_Y + AUDIO_METER_HEIGHT); | |
| 2527 | + | |
| 2528 | + // Draw Meter Quad | |
| 2529 | + if (isClipping) { | |
| 2530 | + glColor3f(1, 1, 1); | |
| 2531 | + } else { | |
| 2532 | + glColor3f(0, 1, 1); | |
| 2533 | + } | |
| 2534 | + // Draw Meter quad | |
| 2535 | + glVertex2i(AUDIO_METER_X + AUDIO_METER_INSET, AUDIO_METER_Y + AUDIO_METER_INSET); | |
| 2536 | + glVertex2i(AUDIO_METER_X + AUDIO_METER_INSET + audioLevel, AUDIO_METER_Y + AUDIO_METER_INSET); | |
| 2537 | + glVertex2i(AUDIO_METER_X + AUDIO_METER_INSET + audioLevel, AUDIO_METER_Y + AUDIO_METER_HEIGHT - AUDIO_METER_INSET); | |
| 2538 | + glVertex2i(AUDIO_METER_X + AUDIO_METER_INSET, AUDIO_METER_Y + AUDIO_METER_HEIGHT - AUDIO_METER_INSET); | |
| 2539 | + | |
| 2540 | + glEnd(); | |
| 2505 | 2541 | |
| 2506 | 2542 | if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) { |
| 2507 | 2543 | _myAvatar->renderHeadMouse(); |