You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
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).
(cherry picked from commit a2b3a73e2d)
This commit is contained in:
committed by
Rémi Verschelde
parent
f9bf6fc3f3
commit
ae215451fc
@@ -411,9 +411,10 @@ void AudioServer::_mix_step() {
|
||||
}
|
||||
|
||||
for (int k = 0; k < bus->channels.size(); k++) {
|
||||
|
||||
if (!bus->channels[k].active)
|
||||
if (!bus->channels[k].active) {
|
||||
bus->channels.write[k].peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
|
||||
continue;
|
||||
}
|
||||
|
||||
AudioFrame *buf = bus->channels.write[k].buffer.ptrw();
|
||||
|
||||
@@ -446,7 +447,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
|
||||
|
||||
Reference in New Issue
Block a user