sfFDN
Loading...
Searching...
No Matches
feedback_matrix.h
1// Copyright (C) 2025 Alexandre St-Onge
2// SPDX-License-Identifier: MIT
3#pragma once
4
5#include "audio_processor.h"
6#include "matrix_gallery.h"
7
8#include <cstddef>
9#include <cstdint>
10#include <memory>
11#include <span>
12
13namespace sfFDN
14{
22{
23 public:
28
29 ~ScalarFeedbackMatrix() override;
30
36 bool SetMatrix(const std::span<const float> matrix);
37
44 bool GetMatrix(std::span<float> matrix) const;
45
54 void Process(const AudioBuffer& input, AudioBuffer& output) noexcept override;
55
59 uint32_t GetSize() const;
60
68 float GetCoefficient(uint32_t row, uint32_t col) const;
69
71 uint32_t InputChannelCount() const override;
72
74 uint32_t OutputChannelCount() const override;
75
79 void Clear() override;
80
84 std::unique_ptr<AudioProcessor> Clone() const override;
85
86 private:
87 uint32_t order_;
88 std::vector<float> matrix_data_;
89};
90
91} // 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 scalar feedback matrix processor.
Definition feedback_matrix.h:22
std::unique_ptr< AudioProcessor > Clone() const override
Creates a copy of the scalar feedback matrix.
uint32_t GetSize() const
Returns the size of the square matrix (number of rows/columns).
bool SetMatrix(const std::span< const float > matrix)
Sets the matrix coefficients.
uint32_t InputChannelCount() const override
Returns the number of input channels supported by the processor.
void Clear() override
Clears the internal state of the processor.
ScalarFeedbackMatrix(const ScalarFeedbackMatrixOptions &config)
Constructs a scalar feedback matrix.
bool GetMatrix(std::span< float > matrix) const
Get the Matrix object.
uint32_t OutputChannelCount() const override
Returns the number of output channels produced by the processor.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept override
Processes the input audio buffer through the feedback matrix.
float GetCoefficient(uint32_t row, uint32_t col) const
Get a specific coefficient from the matrix.
Options for configuring a scalar feedback matrix.
Definition types.h:127