summaryrefslogtreecommitdiff
path: root/servers/audio_server.cpp
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 /servers/audio_server.cpp
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 'servers/audio_server.cpp')
-rw-r--r--servers/audio_server.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index d4f7876b4b..16c6a26595 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -401,6 +401,7 @@ void AudioServer::_mix_step() {
for (int k = 0; k < bus->channels.size(); k++) {
if (!bus->channels[k].active) {
+ bus->channels.write[k].peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
continue;
}
@@ -434,7 +435,7 @@ void AudioServer::_mix_step() {
}
}
- bus->channels.write[k].peak_volume = AudioFrame(Math::linear2db(peak.l + 0.0000000001), Math::linear2db(peak.r + 0.0000000001));
+ bus->channels.write[k].peak_volume = AudioFrame(Math::linear2db(peak.l + AUDIO_PEAK_OFFSET), Math::linear2db(peak.r + AUDIO_PEAK_OFFSET));
if (!bus->channels[k].used) {
//see if any audio is contained, because channel was not used