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
36 bool SetMatrix(std::span<const float> matrix);
37
45 bool GetMatrix(std::span<float> matrix) const;
46
55 void Process(const AudioBuffer& input, AudioBuffer& output) noexcept SFFDN_NONBLOCKING override;
56
60 uint32_t GetSize() const;
61
70 float GetCoefficient(uint32_t row, uint32_t col) const;
71
73 uint32_t InputChannelCount() const noexcept SFFDN_NONBLOCKING override;
74
76 uint32_t OutputChannelCount() const noexcept SFFDN_NONBLOCKING override;
77
81 void Clear() override;
82
86 std::unique_ptr<AudioProcessor> Clone() const override;
87
88 private:
89 uint32_t order_;
90 ScalarMatrixType matrix_type_;
91 std::vector<float> matrix_data_;
92};
93
94} // namespace sfFDN
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 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).
uint32_t OutputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of output channels produced by the processor.
void Process(const AudioBuffer &input, AudioBuffer &output) noexcept SFFDN_NONBLOCKING override
Processes the input audio buffer through the feedback matrix.
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
Retrieves the matrix coefficients.
bool SetMatrix(std::span< const float > matrix)
Sets the matrix coefficients.
uint32_t InputChannelCount() const noexcept SFFDN_NONBLOCKING override
Returns the number of input channels supported by the processor.
float GetCoefficient(uint32_t row, uint32_t col) const
Get a specific coefficient from the matrix.
ScalarMatrixType
Represents the type of a scalar matrix.
Definition types.h:52
Options for configuring a scalar feedback matrix.
Definition types.h:140