sfFDN
Loading...
Searching...
No Matches
partitioned_convolver.h
1// Copyright (C) 2025 Alexandre St-Onge
2// SPDX-License-Identifier: MIT
3#pragma once
4
5#include "audio_processor.h"
6
7#include <cstddef>
8#include <cstdint>
9#include <memory>
10#include <span>
11#include <string>
12
13namespace sfFDN
14{
19{
20 public:
30 PartitionedConvolver(uint32_t block_size, std::span<const float> fir, uint32_t rep_count = 8);
32
34 PartitionedConvolver& operator=(const PartitionedConvolver&) = delete;
35
38
43
49 void Process(const AudioBuffer& input, AudioBuffer& output) noexcept override;
50
54 uint32_t GetBlockSize() const;
55
58 void DumpInfo() const;
59
63 std::string GetShortInfo() const;
64
69 uint32_t InputChannelCount() const override
70 {
71 return 1; // PartitionedConvolver processes one channel at a time
72 }
73
78 uint32_t OutputChannelCount() const override
79 {
80 return 1; // PartitionedConvolver processes one channel at a time
81 }
82
86 void Clear() override;
87
91 std::unique_ptr<AudioProcessor> Clone() const override;
92
93 private:
94 class PartitionedConvolverImpl;
95 std::unique_ptr<PartitionedConvolverImpl> impl_;
96
97 PartitionedConvolver() = default; // Default constructor used in Clone()
98};
99
100} // 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 partitioned convolution engine that can filter audio signals with an FIR filter.
Definition partitioned_convolver.h:19
uint32_t InputChannelCount() const override
Gets the number of input channels supported.
Definition partitioned_convolver.h:69
std::string GetShortInfo() const
Gets a short string representation of the internal state of the convolver for debugging purposes.
void Clear() override
Clears the internal state of the processor.
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the PartitionedConvolver.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept override
Processes the audio buffer.
void DumpInfo() const
Dumps internal information to the standard output for debugging purposes.
uint32_t OutputChannelCount() const override
Gets the number of output channels supported.
Definition partitioned_convolver.h:78
uint32_t GetBlockSize() const
Gets the block size used for processing.
PartitionedConvolver(PartitionedConvolver &&) noexcept
Move constructor for the partitioned convolver.
PartitionedConvolver(uint32_t block_size, std::span< const float > fir, uint32_t rep_count=8)
Constructs a PartitionedConvolver.