mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
AudioServer: Explicitly cast between numeric types in the mixer
This commit is contained in:
parent
cb8e37d436
commit
746d3c1131
Notes:
sideshowbarker
2024-07-17 10:00:44 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/746d3c1131 Pull-request: https://github.com/SerenityOS/serenity/pull/14288 Reviewed-by: https://github.com/Hendiadyoin1
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue