mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibDSP: Fix potential slicing issue in volume_from_envelope
Use pointer or reference to avoid slicing from "PitchedEnvelope" to "Envelope". This was found by SonarCloud.
This commit is contained in:
parent
a225b26d88
commit
55aecf5381
Notes:
sideshowbarker
2024-07-17 23:23:09 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/55aecf5381d Pull-request: https://github.com/SerenityOS/serenity/pull/11124 Reviewed-by: https://github.com/itamar8910 ✅ Reviewed-by: https://github.com/kleinesfilmroellchen ✅
@ -50,7 +50,7 @@ struct Envelope {
|
||||
|
||||
constexpr void reset() { envelope = -1; }
|
||||
|
||||
constexpr operator EnvelopeState()
|
||||
constexpr operator EnvelopeState() const
|
||||
{
|
||||
if (!is_active())
|
||||
return EnvelopeState::Off;
|
||||
|
@ -64,7 +64,7 @@ Signal Classic::process_impl(Signal const& input_signal)
|
||||
}
|
||||
|
||||
// Linear ADSR envelope with no peak adjustment.
|
||||
double Classic::volume_from_envelope(Envelope envelope)
|
||||
double Classic::volume_from_envelope(Envelope const& envelope)
|
||||
{
|
||||
switch (static_cast<EnvelopeState>(envelope)) {
|
||||
case EnvelopeState::Off:
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
private:
|
||||
virtual Signal process_impl(Signal const&) override;
|
||||
|
||||
double volume_from_envelope(Envelope);
|
||||
double volume_from_envelope(Envelope const&);
|
||||
double wave_position(u8 note);
|
||||
double samples_per_cycle(u8 note);
|
||||
double sin_position(u8 note);
|
||||
|
Loading…
Reference in New Issue
Block a user