mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 17:00:57 +01:00
audio/stream: Adjust volume scale factor
This commit is contained in:
parent
c8b3a12856
commit
850896a52b
1 changed files with 2 additions and 2 deletions
|
@ -79,8 +79,8 @@ static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of a volume slider with a dynamic range of 60 dB
|
// Perceived volume is not the same as the volume level
|
||||||
const float volume_scale_factor = volume == 0 ? 0 : std::exp(6.90775f * volume) * 0.001f;
|
const float volume_scale_factor = (0.85f * ((volume * volume) - volume)) + volume;
|
||||||
for (auto& sample : samples) {
|
for (auto& sample : samples) {
|
||||||
sample = static_cast<s16>(sample * volume_scale_factor);
|
sample = static_cast<s16>(sample * volume_scale_factor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue