1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 10:25:07 +00:00
serenity/Userland/Libraries/LibDSP/Effects.h
kleines Filmröllchen 9035d9e845 LibDSP+Piano: Convert DSP APIs to accept entire sample ranges
This has mainly performance benefits, so that we only need to call into
all processors once for every audio buffer segment. It requires
adjusting quite some logic in most processors and in Track, as we have
to consider a larger collection of notes and samples at each step.

There's some cautionary TODOs in the currently unused LibDSP tracks
because they don't do things properly yet.
2022-05-13 00:47:26 +02:00

44 lines
1.1 KiB
C++

/*
* Copyright (c) 2021-2022, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <LibDSP/Processor.h>
#include <LibDSP/ProcessorParameter.h>
#include <LibDSP/Transport.h>
namespace LibDSP::Effects {
// A simple digital delay effect using a delay buffer.
// This is based on Piano's old built-in delay.
class Delay : public EffectProcessor {
public:
Delay(NonnullRefPtr<Transport>);
private:
virtual void process_impl(Signal const&, Signal&) override;
void handle_delay_time_change();
ProcessorRangeParameter m_delay_decay;
ProcessorRangeParameter m_delay_time;
ProcessorRangeParameter m_dry_gain;
Vector<Sample> m_delay_buffer;
size_t m_delay_index { 0 };
};
// A simple effect that applies volume, mute and pan to its input signal.
// Convenient for attenuating signals in the middle of long chains.
class Mastering : public EffectProcessor {
public:
Mastering(NonnullRefPtr<Transport>);
private:
virtual void process_impl(Signal const&, Signal&) override;
};
}