sfFDN
Loading...
Searching...
No Matches
delaybank.h
1// Copyright (C) 2025 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.h"
8#include "sffdn/delay_interp.h"
9#include "sffdn/types.h"
10
11#include <cstdint>
12#include <span>
13#include <vector>
14
15namespace sfFDN
16{
17
26{
27 public:
33 DelayBank(const DelayBankOptions& config = {});
34
43 void SetDelays(const std::span<const float> delays, uint32_t block_size = 512);
44
49 std::vector<float> GetDelays() const;
50
56 uint32_t InputChannelCount() const override;
57
63 uint32_t OutputChannelCount() const override;
64
69 void Clear() override;
70
78 void Process(const AudioBuffer& input, AudioBuffer& output) noexcept override;
79
85 void AddNextInputs(const AudioBuffer& input);
86
93
97 std::unique_ptr<AudioProcessor> Clone() const override;
98
99 private:
100 std::vector<DelayInterp> delays_;
101 uint32_t block_size_{128};
103};
104} // 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
A bank of parallel delay lines, each with its own delay setting.
Definition delaybank.h:26
void SetDelays(const std::span< const float > delays, uint32_t block_size=512)
Sets the delay values for each channel in the delay bank.
void GetNextOutputs(AudioBuffer &output)
Retrieves the next output samples from each delay line in the bank.
std::vector< float > GetDelays() const
Returns the current delays for each delay line in the bank.
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the delay bank.
uint32_t InputChannelCount() const override
Returns the number of input channels this processor expects.
uint32_t OutputChannelCount() const override
Returns the number of output channels this processor produces.
void Clear() override
Clears the internal delay buffers.
void AddNextInputs(const AudioBuffer &input)
Adds the next input samples to each delay line in the bank.
DelayBank(const DelayBankOptions &config={})
Constructs a delay bank with a specified set of delays and block size.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept override
Processes a block of multi-channel audio.
DelayInterpolationType
Types of interpolation for fractional delay lengths.
Definition types.h:65
@ None
No interpolation. The delay length will be rounded to the nearest integer value.
Options for configuring a delay bank.
Definition types.h:198