diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-06-15 21:15:58 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-23 23:26:33 +0100 |
commit | 746d3c11312a285b4da84610c17500554e70fe56 (patch) | |
tree | 73a9fc628db6d524a45a328da581963c07cfc2cb /Userland/Services | |
parent | cb8e37d436bd477bc6517b9631832b1c8bd636d2 (diff) | |
download | serenity-746d3c11312a285b4da84610c17500554e70fe56.zip |
AudioServer: Explicitly cast between numeric types in the mixer
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/AudioServer/Mixer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index fc49e36204..240e493cd9 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -97,7 +97,7 @@ void Mixer::mix() if (queue->is_muted()) continue; sample.log_multiply(SAMPLE_HEADROOM); - sample.log_multiply(queue->volume()); + sample.log_multiply(static_cast<float>(queue->volume())); mixed_sample += sample; } } @@ -115,14 +115,14 @@ void Mixer::mix() if (m_main_volume < 0.01) mixed_sample = Audio::Sample { 0 }; else - mixed_sample.log_multiply(m_main_volume); + mixed_sample.log_multiply(static_cast<float>(m_main_volume)); mixed_sample.clip(); LittleEndian<i16> out_sample; - out_sample = mixed_sample.left * NumericLimits<i16>::max(); + out_sample = static_cast<i16>(mixed_sample.left * NumericLimits<i16>::max()); stream << out_sample; - out_sample = mixed_sample.right * NumericLimits<i16>::max(); + out_sample = static_cast<i16>(mixed_sample.right * NumericLimits<i16>::max()); stream << out_sample; } |