summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2021-02-02 11:25:40 +0100
committerPedro J. Estébanez <pedrojrulez@gmail.com>2021-02-02 11:30:32 +0100
commita2b3a73e2d0c2b9e9badeab28fef26565a9ec3f2 (patch)
treeaeb31302d739525f1bf348e04fd7fa678d0b1e1b /core
parent6ddfc8e7187bd2b25b5caa61dee8fdca05af6298 (diff)
Make audio bus channels' peak volume consistent
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).
Diffstat (limited to 'core')
-rw-r--r--core/math/audio_frame.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 5773da9211..a5616b8d79 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -47,6 +47,9 @@ static inline float undenormalise(volatile float f) {
return (v.i & 0x7f800000) < 0x08000000 ? 0.0f : f;
}
+static const float AUDIO_PEAK_OFFSET = 0.0000000001f;
+static const float AUDIO_MIN_PEAK_DB = -200.0f; // linear2db(AUDIO_PEAK_OFFSET)
+
struct AudioFrame {
//left and right samples
float l, r;