diff options
| author | 2022-01-15 20:28:17 -0600 | |
|---|---|---|
| committer | 2022-01-15 20:28:37 -0600 | |
| commit | 850896a52bdc2ff8a555d6e702eb5638c30a084e (patch) | |
| tree | 1ed004d413a174d4fd09e87565843ecf586fbfcc /src/audio_core/stream.cpp | |
| parent | yuzu: Add volume up/down hotkeys (diff) | |
| download | yuzu-850896a52bdc2ff8a555d6e702eb5638c30a084e.tar.gz yuzu-850896a52bdc2ff8a555d6e702eb5638c30a084e.tar.xz yuzu-850896a52bdc2ff8a555d6e702eb5638c30a084e.zip | |
audio/stream: Adjust volume scale factor
Diffstat (limited to 'src/audio_core/stream.cpp')
| -rw-r--r-- | src/audio_core/stream.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index 5a30f55a7..0abc989b2 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp | |||
| @@ -79,8 +79,8 @@ static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) { | |||
| 79 | return; | 79 | return; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | // Implementation of a volume slider with a dynamic range of 60 dB | 82 | // Perceived volume is not the same as the volume level |
| 83 | const float volume_scale_factor = volume == 0 ? 0 : std::exp(6.90775f * volume) * 0.001f; | 83 | const float volume_scale_factor = (0.85f * ((volume * volume) - volume)) + volume; |
| 84 | for (auto& sample : samples) { | 84 | for (auto& sample : samples) { |
| 85 | sample = static_cast<s16>(sample * volume_scale_factor); | 85 | sample = static_cast<s16>(sample * volume_scale_factor); |
| 86 | } | 86 | } |