5#include "sffdn/attributes.h"
6#include "sffdn/audio_buffer.h"
7#include "sffdn/audio_processor.h"
8#include "sffdn/filterbank.h"
9#include "sffdn/oscillator.h"
10#include "sffdn/types.h"
110 float Tick(
float input) noexcept SFFDN_NONBLOCKING;
130 float Rectify(
float input) const noexcept SFFDN_NONBLOCKING;
132 std::unique_ptr<DcBlocker> dc_blocker_;
135 float compensation_gain_;
138 float prev_input_{0.f};
184 float GetD() const noexcept SFFDN_NONBLOCKING;
187 float Tick(
float input) noexcept SFFDN_NONBLOCKING;
209 float prev_positive_{0.f};
210 float prev_prev_positive_{0.f};
211 float prev_negative_{0.f};
251 float Tick(
float input) noexcept SFFDN_NONBLOCKING;
292 float alpha,
float sample_rate, uint32_t channel_count, uint32_t active_channel_count = 0);
308 float d, uint32_t channel_count, uint32_t active_channel_count = 0);
328 uint32_t channel_count,
329 uint32_t active_channel_count = 0);
A class representing an audio buffer with multiple channels of non-interleaved audio data.
Definition audio_buffer.h:20
Base class for audio processors.
Definition audio_processor.h:24
A controllable full-wave rectifier, with optional antiderivative antialiasing.
Definition nonlinear.h:72
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept SFFDN_NONBLOCKING override
Processes the audio buffer.
void SetAlpha(float alpha)
Sets the distortion amount.
uint32_t InputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of input channels this processor expects.
float GetAlpha() const noexcept SFFDN_NONBLOCKING
Returns the distortion amount.
float GetCompensationGain() const noexcept SFFDN_NONBLOCKING
Returns the power compensation gain of the current distortion amount.
void Clear() override
Clears the antialiasing state and the dc blocker.
static constexpr float kAntialiasingEpsilon
Threshold below which the denominator of the antialiasing approximation is considered ill-conditioned...
Definition nonlinear.h:81
float Tick(float input) noexcept SFFDN_NONBLOCKING
Processes a single sample.
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the processor.
uint32_t OutputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of output channels this processor produces.
ControllableFullWaveRectifier(const ControllableFullWaveRectifierOptions &options={})
Constructs a controllable full-wave rectifier.
Implements a bank of filters.
Definition filterbank.h:19
A ring modulator.
Definition nonlinear.h:235
uint32_t OutputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of output channels this processor produces.
float GetFrequency() const noexcept SFFDN_NONBLOCKING
Returns the modulation frequency, in cycles per sample.
RingModulator(const RingModulatorOptions &options={})
Constructs a ring modulator.
uint32_t InputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of input channels this processor expects.
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the processor.
void Clear() override
Restores the configured initial phase.
float GetAmplitude() const noexcept SFFDN_NONBLOCKING
Returns the linear gain applied to the modulating sinusoid.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept SFFDN_NONBLOCKING override
Processes the audio buffer.
float Tick(float input) noexcept SFFDN_NONBLOCKING
Processes a single sample.
A signal-dependent fractional delay filter.
Definition nonlinear.h:169
float GetD() const noexcept SFFDN_NONBLOCKING
Returns the interpolation weight.
uint32_t OutputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of output channels this processor produces.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept SFFDN_NONBLOCKING override
Processes the audio buffer.
uint32_t InputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of input channels this processor expects.
void SetD(float d)
Sets the interpolation weight.
void Clear() override
Clears the delay state.
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the processor.
SignalDependentFractionalDelay(const SignalDependentFractionalDelayOptions &options={})
Constructs a signal-dependent fractional delay.
float Tick(float input) noexcept SFFDN_NONBLOCKING
Processes a single sample.
A sine wave oscillator.
Definition oscillator.h:33
Options for configuring a controllable full-wave rectifier.
Definition types.h:401
Options for configuring a multichannel bank of controllable full-wave rectifiers.
Definition types.h:419
Options for configuring a multichannel bank of ring modulators.
Definition types.h:465
Options for configuring a multichannel bank of signal-dependent fractional delays.
Definition types.h:439
Options for configuring a ring modulator.
Definition types.h:450
Options for configuring a signal-dependent fractional delay.
Definition types.h:429
std::unique_ptr< FilterBank > MakeMultichannelControllableFullWaveRectifier(const MultichannelControllableFullWaveRectifierOptions &options)
Builds a bank of controllable full-wave rectifiers, one per channel.
std::unique_ptr< FilterBank > MakeMultichannelSignalDependentFractionalDelay(const MultichannelSignalDependentFractionalDelayOptions &options)
Builds a bank of signal-dependent fractional delays, one per channel.
MultichannelSignalDependentFractionalDelayOptions MakeMultichannelSignalDependentFractionalDelayOptions(float d, uint32_t channel_count, uint32_t active_channel_count=0)
Returns the options of a bank of signal-dependent fractional delays covering every channel.
MultichannelControllableFullWaveRectifierOptions MakeMultichannelControllableFullWaveRectifierOptions(float alpha, float sample_rate, uint32_t channel_count, uint32_t active_channel_count=0)
Returns the options of a bank of controllable full-wave rectifiers covering every channel.
MultichannelRingModulatorOptions MakeMultichannelRingModulatorOptions(float frequency, float amplitude, uint32_t channel_count, uint32_t active_channel_count=0)
Returns the options of a decorrelated bank of ring modulators.
std::unique_ptr< FilterBank > MakeMultichannelRingModulator(const MultichannelRingModulatorOptions &options)
Builds a bank of ring modulators, one per channel.