History

more audio level meter work, improved gun

Philip Rosedale committed 12 years ago

Commit 41e90171 parent ec6b71f2 files · +37 −11Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+10−2
@@ -2503,14 +2503,22 @@ void Application::displayOverlay() { · 2502 unmodified lines
2503 }2503 }
2504 }2504 }
2505 2505
2506 const int AUDIO_METER_WIDTH = 300;2506 const int AUDIO_METER_WIDTH = 200;
2507 const int AUDIO_METER_INSET = 2;2507 const int AUDIO_METER_INSET = 2;
2508 const int AUDIO_METER_SCALE_WIDTH = AUDIO_METER_WIDTH - 2 * AUDIO_METER_INSET;2508 const int AUDIO_METER_SCALE_WIDTH = AUDIO_METER_WIDTH - 2 * AUDIO_METER_INSET;
2509 const int AUDIO_METER_HEIGHT = 8;2509 const int AUDIO_METER_HEIGHT = 8;
2510 const int AUDIO_METER_Y = _glWidget->height() - 40;2510 const int AUDIO_METER_Y = _glWidget->height() - 40;
2511 const int AUDIO_METER_X = 25;2511 const int AUDIO_METER_X = 25;
2512 const float CLIPPING_INDICATOR_TIME = 1.0f;2512 const float CLIPPING_INDICATOR_TIME = 1.0f;
2513 float audioLevel = log10(_audio.getLastInputLoudness() + 1.0) / log10(32767.0) * (float)AUDIO_METER_SCALE_WIDTH;2513 const float LOG2 = log(2.f);
2514 float audioLevel = 0.f;
2515 float loudness = _audio.getLastInputLoudness() + 1.f;
2516 float log2loudness = log(loudness) / LOG2;
2517 if (loudness < 2048) {
2518 audioLevel = (log2loudness / 11.f) * (AUDIO_METER_SCALE_WIDTH / 5.f);
2519 } else {
2520 audioLevel = (log2loudness - 10.f) * (AUDIO_METER_SCALE_WIDTH / 5.f);
2521 }
2514 bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));2522 bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));
2515 2523
2516 if (isClipping) {2524 if (isClipping) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t