30 float feedback = 0.5F, uint32_t feed_samples = 512);
32 using AudioBuffer::clone_to;
34 [[nodiscard]]
inline float get_feedback()
const {
return m_feedback_amount; }
36 void set_feedback(
float amount);
42 void process_default()
override;
44 void set_feed_samples(uint32_t samples);
51 std::shared_ptr<AudioBuffer> clone_to(uint32_t channel)
override;
65 inline void mark_written(uint64_t samples) { m_write_count += samples; }
68 std::shared_ptr<BufferProcessor> create_default_processor()
override;
74 uint64_t m_write_count { 0 };
110 using Combine = std::function<double(
double, std::span<const double>, std::span<double>)>;
115 using CombineStep = std::function<
Step(
double, std::span<const double>, std::span<double>)>;
125 using WindowKernel = std::function<double(std::span<double>, std::span<double>)>;
141 FeedbackProcessor(CombineStep combine,
const std::vector<double>& lags, std::vector<double> coefficients = {});
143 FeedbackProcessor(WindowKernel kernel,
const std::vector<double>& lags, std::vector<double> coefficients = {});
145 void processing_function(
const std::shared_ptr<Buffer>&
buffer)
override;
146 void on_attach(
const std::shared_ptr<Buffer>&
buffer)
override;
147 void on_detach(
const std::shared_ptr<Buffer>&
buffer)
override;
148 [[nodiscard]]
bool is_compatible_with(
const std::shared_ptr<Buffer>&
buffer)
const override;
157 void set_feed_samples(uint32_t samples);
161 void set_combine(Combine combine);
163 void set_combine(CombineStep combine);
165 void set_combine(WindowKernel kernel);
174 void set_interpolation(
size_t order);
190 void set_lag_source(
const std::shared_ptr<FeedbackBuffer>& source);
192 void clear_lag_source();
197 void set_lags(
const std::vector<double>& lags);
213 void set_coefficients(std::vector<double> coefficients);
218 [[nodiscard]] std::span<double> coefficients(
const std::shared_ptr<Buffer>&
buffer);
223 [[nodiscard]] std::shared_ptr<FeedbackProcessor> clone()
const;
227 double samples { 1.0 };
228 std::shared_ptr<const Kinesis::TimeMap>
map;
229 double max_samples { 1.0 };
240 uint64_t elapsed { 0 };
241 bool primed {
false };
244 State& state_for(
const std::shared_ptr<Buffer>&
buffer);
246 void recompute_capacity();
252 float m_feedback_amount { 0.5F };
253 uint32_t m_feed_samples { 512 };
254 bool m_default_combine {
false };
259 size_t m_order { 1 };
263 size_t m_capacity { 1 };
std::optional< glm::vec3 > position
std::shared_ptr< NetworkGeometryBuffer > buffer
Concrete audio implementation of the Buffer interface for double-precision audio data.
Central computational transformation interface for continuous buffer processing.
uint64_t get_write_count() const
Total samples pushed into the ring since construction.
uint32_t get_feed_samples() const
const Memory::HistoryBuffer< double > & get_history_buffer() const
Memory::HistoryBuffer< double > m_history
float get_feedback() const
Memory::HistoryBuffer< double > & get_history_buffer()
void mark_written(uint64_t samples)
Record that a processor pushed samples into the ring.
AudioBuffer that owns and publishes a history ring.
std::function< Step(double, std::span< const double >, std::span< double >)> CombineStep
Combiner returning an output and a carried value.
std::vector< Tap > m_taps
std::weak_ptr< FeedbackBuffer > m_lag_source
uint32_t get_feed_samples() const
std::unordered_map< const Buffer *, State > m_states
size_t get_interpolation() const
std::vector< double > m_coefficients
void set_feedback(float amount)
std::function< double(double, std::span< const double >, std::span< double >)> Combine
Combiner returning one value, written to the buffer and carried.
std::function< double(std::span< double >, std::span< double >)> WindowKernel
A function of one window and one array, as in Kinesis::Discrete::Kernels.
float get_feedback() const
Combines each sample with lagged values of its own carried stream.
History buffer for difference equations and recursive relations.
std::vector< double > coefs
std::vector< double > lag_prev
std::vector< double > values
std::vector< double > window
std::vector< double > lag_now
Result of a combiner that carries a different value than it outputs.
std::shared_ptr< const Kinesis::TimeMap > map
Typed, composable, stateless callable from domain D to range R.