sfFDN
Loading...
Searching...
No Matches
delay_time_varying.h
1// Copyright (C) 2026 Alexandre St-Onge
2// SPDX-License-Identifier: MIT
3#pragma once
4
5#include "sffdn/audio_buffer.h"
6#include "sffdn/audio_processor.h"
7#include "sffdn/delay_interp.h"
8#include "sffdn/oscillator.h"
9#include "sffdn/types.h"
10
11#include <span>
12#include <variant>
13
14namespace sfFDN
15{
16
21{
22 public:
27
29 void Clear() override;
30
34 void SetMaximumDelay(uint32_t delay);
35
39 void SetDelay(float delay);
40
44 float GetDelay() const;
45
49 void SetMod(const ModulationOptions& options);
50
55 float Tick(float input);
56
62 uint32_t InputChannelCount() const override;
63
69 uint32_t OutputChannelCount() const override;
70
75 void Process(const AudioBuffer& input, AudioBuffer& output) noexcept override;
76
80 std::unique_ptr<AudioProcessor> Clone() const override;
81
82 private:
83 void UpdateDelay();
84 DelayInterp delay_;
85 float base_delay_;
86
87 SineWave lfo_;
88};
89
90} // namespace sfFDN
A class representing an audio buffer with multiple channels of non-interleaved audio data.
Definition audio_buffer.h:18
Base class for audio processors.
Definition audio_processor.h:23
Delay line with interpolation.
Definition delay_interp.h:22
A delay line with time-varying delay.
Definition delay_time_varying.h:21
float GetDelay() const
Gets the current delay of the delay line.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept override
Processes the audio buffer.
float Tick(float input)
Processes a single sample.
void SetMod(const ModulationOptions &options)
Sets the modulation options for the delay line.
void SetMaximumDelay(uint32_t delay)
Sets the maximum delay for the delay line.
uint32_t OutputChannelCount() const override
Returns the number of output channels this processor produces.
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the processor.
DelayTimeVarying(const DelayOptions &config)
Constructs a delay line with time-varying delay.
void Clear() override
Clears the delay line.
uint32_t InputChannelCount() const override
Returns the number of input channels this processor expects.
void SetDelay(float delay)
Sets the delay for the delay line.
A sine wave oscillator.
Definition oscillator.h:24
Options for configuring delays.
Definition types.h:185
Options for configuring signal modulation.
Definition types.h:166