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
25032503 }
25042504 }
25052505
2506− const int AUDIO_METER_WIDTH = 300;
2506+ const int AUDIO_METER_WIDTH = 200;
25072507 const int AUDIO_METER_INSET = 2;
25082508 const int AUDIO_METER_SCALE_WIDTH = AUDIO_METER_WIDTH - 2 * AUDIO_METER_INSET;
25092509 const int AUDIO_METER_HEIGHT = 8;
25102510 const int AUDIO_METER_Y = _glWidget->height() - 40;
25112511 const int AUDIO_METER_X = 25;
25122512 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+ }
25142522 bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));
25152523
25162524 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