diff options
author | Robert Adam <dev@robert-adam.de> | 2021-05-15 18:28:52 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-05-15 18:37:29 +0300 |
commit | 685480ef75dc567121ece519833e12821b4703fd (patch) | |
tree | e26f93e5f2ee24226791ffe7431aaa9b61ab4fa2 /src | |
parent | 694ca16a6a38bea44c8a7e31a0c122fc1c767759 (diff) |
DOCS: Adde comments to AudioOutput::calcGain
Diffstat (limited to 'src')
-rw-r--r-- | src/mumble/AudioOutput.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp index 3216ee286..33ebf6c5d 100644 --- a/src/mumble/AudioOutput.cpp +++ b/src/mumble/AudioOutput.cpp @@ -95,6 +95,7 @@ AudioOutput::~AudioOutput() { // close, we'll hear it full intensity from the left side, and "bloom" intensity from the right side. float AudioOutput::calcGain(float dotproduct, float distance) { + // dotproduct is in the range [-1, 1], thus we renormalize it to the range [0, 1] float dotfactor = (dotproduct + 1.0f) / 2.0f; float att; @@ -103,6 +104,8 @@ float AudioOutput::calcGain(float dotproduct, float distance) { if (Global::get().s.fAudioMaxDistVolume > 0.99f) { att = qMin(1.0f, dotfactor + Global::get().s.fAudioBloom); } else if (distance < Global::get().s.fAudioMinDistance) { + // Fade in blooming as soon as the sound source enters fAudioMinDistance and increase it to its full + // capability when the audio source is at the same position as the local player float bloomfac = Global::get().s.fAudioBloom * (1.0f - distance / Global::get().s.fAudioMinDistance); att = qMin(1.0f, bloomfac + dotfactor); |