Add volume curve setting (#658)

* Add volume curve setting

* Qt: Add missing translations
This commit is contained in:
wheremyfoodat
2024-12-03 14:16:57 +02:00
committed by GitHub
parent 545ac81d81
commit 5f822b32d5
7 changed files with 60 additions and 5 deletions

View File

@@ -134,6 +134,12 @@ void MiniAudioDevice::init(Samples& samples, bool safe) {
} else {
// If our volume is in [0.0, 1.0) then just multiply by the volume. No need to clamp, since there is no danger of our samples wrapping
// around due to overflow
// If we're applying cubic volume curve, raise volume to the power of 3
if (self->audioSettings.volumeCurve == AudioDeviceConfig::VolumeCurve::Cubic) {
audioVolume = audioVolume * audioVolume * audioVolume;
}
for (usize i = 0; i < samplesWritten; i += 2) {
s16 l = s16(float(sample[0]) * audioVolume);
s16 r = s16(float(sample[1]) * audioVolume);