MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Filter.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
7enum coefficients : uint8_t {
10 ALL
11};
12
13/**
14 * @class FilterContext
15 * @brief Specialized context for filter node callbacks
16 *
17 * FilterContext extends the base NodeContext to provide filter-specific
18 * information to callbacks. It includes references to the filter's internal
19 * state, including input and output history buffers and coefficient vectors.
20 *
21 * This rich context enables callbacks to perform sophisticated analysis and
22 * monitoring of filter behavior, such as:
23 * - Detecting resonance conditions or instability
24 * - Analyzing filter response characteristics in real-time
25 * - Implementing adaptive processing based on filter state
26 * - Visualizing filter behavior through external interfaces
27 * - Recording filter state for later analysis or debugging
28 */
29class MAYAFLUX_API FilterContext : public NodeContext {
30public:
31 /**
32 * @brief Constructs a FilterContext with the current filter state
33 * @param value Current output sample value
34 * @param input_history Reference to the filter's input history buffer
35 * @param output_history Reference to the filter's output history buffer
36 * @param coefs_a Reference to the filter's feedback coefficients
37 * @param coefs_b Reference to the filter's feedforward coefficients
38 *
39 * Creates a context object that provides a complete snapshot of the
40 * filter's current state, including its most recent output value,
41 * history buffers, and coefficient vectors.
42 */
43 FilterContext(double value, const std::vector<double>& input_history, const std::vector<double>& output_history,
44 const std::vector<double>& coefs_a, const std::vector<double>& coefs_b)
45 : NodeContext(value, typeid(FilterContext).name())
46 , input_history(input_history)
47 , output_history(output_history)
48 , coefs_a(coefs_a)
49 , coefs_b(coefs_b)
50 {
51 }
52
53 /**
54 * @brief Current input history buffer
55 *
56 * Contains the most recent input samples processed by the filter,
57 * with the newest sample at index 0. The size of this buffer depends
58 * on the filter's feedforward path configuration.
59 */
60 const std::vector<double>& input_history;
61
62 /**
63 * @brief Current output history buffer
64 *
65 * Contains the most recent output samples processed by the filter,
66 * with the newest sample at index 0. The size of this buffer depends
67 * on the filter's feedback path configuration.
68 */
69 const std::vector<double>& output_history;
70
71 /**
72 * @brief Current coefficients for input
73 */
74 const std::vector<double>& coefs_a;
75
76 /**
77 * @brief Current coefficients for output
78 */
79 const std::vector<double>& coefs_b;
80};
81
82/**
83 * @class FilterContextGpu
84 * @brief GPU-augmented filter context for callbacks
85 *
86 * Extends FilterContext to include GPU-uploadable data, allowing
87 * callbacks to access both CPU-side filter state and GPU-resident
88 * data for advanced processing and visualization.
89 */
90class MAYAFLUX_API FilterContextGpu : public FilterContext, public GpuVectorData {
91public:
92 FilterContextGpu(double value, const std::vector<double>& input_history, const std::vector<double>& output_history,
93 const std::vector<double>& coefs_a, const std::vector<double>& coefs_b, std::span<const float> gpu_data)
94 : FilterContext(value, input_history, output_history, coefs_a, coefs_b)
95 , GpuVectorData(gpu_data)
96 {
97 }
98};
99
100/**
101 * @brief Parses a string representation of filter order into input/output shift configuration
102 * @param str String in format "N_M" where N is input order and M is output order
103 * @return Pair of integers representing input and output shift values
104 *
105 * This utility function converts a simple string representation of filter order
106 * into the corresponding shift configuration for the filter's internal buffers.
107 */
108std::pair<int, int> shift_parser(const std::string& str);
109
110/**
111 * @class Filter
112 * @brief Base class for computational signal transformers implementing difference equations
113 *
114 * The Filter class provides a comprehensive framework for implementing digital
115 * transformations based on difference equations. It transcends traditional audio
116 * filtering concepts, offering a flexible foundation for:
117 *
118 * - Complex resonant systems for generative synthesis
119 * - Computational physical modeling components
120 * - Recursive signal transformation algorithms
121 * - Data-driven transformation design from frequency responses
122 * - Dynamic coefficient modulation for emergent behaviors
123 *
124 * At its core, the Filter implements the general difference equation:
125 * y[n] = (b₀x[n] + b₁x[n-1] + ... + bₘx[n-m]) - (a₁y[n-1] + ... + aₙy[n-n])
126 *
127 * Where:
128 * - x[n] are input values
129 * - y[n] are output values
130 * - b coefficients apply to input values (feedforward)
131 * - a coefficients apply to previous output values (feedback)
132 *
133 * This mathematical structure can represent virtually any linear time-invariant system,
134 * making it a powerful tool for signal transformation across domains. The same
135 * equations can process audio, control data, or even be applied to visual or
136 * physical simulation parameters.
137 */
138class MAYAFLUX_API Filter : public Node {
139public:
140 /**
141 * @brief Constructor using string-based filter configuration
142 * @param input Source node providing input samples
143 * @param zindex_shifts String in format "N_M" specifying filter order
144 *
145 * Creates a filter with the specified input node and order configuration.
146 * The zindex_shifts parameter provides a simple way to define filter order
147 * using a string like "2_2" for a biquad filter.
148 */
149 Filter(const std::shared_ptr<Node>& input, const std::string& zindex_shifts);
150
151 /**
152 * @brief Constructor using explicit coefficient vectors
153 * @param input Source node providing input samples
154 * @param a_coef Feedback (denominator) coefficients
155 * @param b_coef Feedforward (numerator) coefficients
156 *
157 * Creates a filter with the specified input node and coefficient vectors.
158 * This allows direct specification of filter coefficients for precise
159 * control over filter behavior.
160 */
161 Filter(const std::shared_ptr<Node>& input, const std::vector<double>& a_coef, const std::vector<double>& b_coef);
162
163 /**
164 * @brief Constructor using explicit coefficient vectors (no input node)
165 * @param a_coef Feedback (denominator) coefficients
166 * @param b_coef Feedforward (numerator) coefficients
167 *
168 * Creates a filter with the specified coefficient vectors but no input node.
169 * This can be used in scenarios where the filter operates on external data
170 * or is part of a larger processing chain.
171 */
172 Filter(const std::vector<double>& a_coef, const std::vector<double>& b_coef);
173
174 /**
175 * @brief Virtual destructor
176 */
177 ~Filter() override = default;
178
179 /**
180 * @brief Gets the current processing latency of the filter
181 * @return Latency in samples
182 *
183 * The latency is determined by the maximum of the input and output
184 * buffer sizes, representing how many samples of delay the filter introduces.
185 */
186 [[nodiscard]] inline int get_current_latency() const
187 {
188 return std::max(m_shift_config.first, m_shift_config.second);
189 }
190
191 /**
192 * @brief Gets the current shift configuration
193 * @return Pair of integers representing input and output shift values
194 *
195 * Returns the current configuration for input and output buffer sizes.
196 */
197 [[nodiscard]] inline std::pair<int, int> get_current_shift() const
198 {
199 return m_shift_config;
200 }
201
202 /**
203 * @brief Updates the filter's shift configuration
204 * @param zindex_shifts String in format "N_M" specifying new filter order
205 *
206 * Reconfigures the filter with a new order specification, resizing
207 * internal buffers as needed.
208 */
209 inline void set_shift(std::string& zindex_shifts)
210 {
211 m_shift_config = shift_parser(zindex_shifts);
212 initialize_shift_buffers();
213 }
214
215 /**
216 * @brief Updates filter coefficients
217 * @param new_coefs New coefficient values
218 * @param type Which set of coefficients to update (input, output, or both)
219 *
220 * Provides a flexible way to update filter coefficients, allowing
221 * dynamic modification of filter characteristics during processing.
222 */
223 void set_coefs(const std::vector<double>& new_coefs, coefficients type = coefficients::ALL);
224
225 /**
226 * @brief Updates coefficients from another node's output
227 * @param length Number of coefficients to update
228 * @param source Node providing coefficient values
229 * @param type Which set of coefficients to update (input, output, or both)
230 *
231 * Enables cross-domain interaction by deriving transformation coefficients from
232 * another node's output. This creates dynamic relationships between different
233 * parts of the computational graph, allowing one signal path to influence
234 * the behavior of another - perfect for generative systems where parameters
235 * evolve based on the system's own output.
236 */
237 void update_coefs_from_node(int length, const std::shared_ptr<Node>& source, coefficients type = coefficients::ALL);
238
239 /**
240 * @brief Updates coefficients from the filter's own input
241 * @param length Number of coefficients to update
242 * @param type Which set of coefficients to update (input, output, or both)
243 *
244 * Creates a self-modifying transformation where the input signal itself
245 * influences the transformation characteristics. This enables complex
246 * emergent behaviors and feedback systems where the signal's own properties
247 * determine how it will be processed, leading to evolving, non-linear responses.
248 */
249 void update_coef_from_input(int length, coefficients type = coefficients::ALL);
250
251 /**
252 * @brief Modifies a specific coefficient
253 * @param index Index of the coefficient to modify
254 * @param value New value for the coefficient
255 * @param type Which set of coefficients to update (input, output, or both)
256 *
257 * Allows precise control over individual coefficients, useful for
258 * fine-tuning filter behavior or implementing parameter automation.
259 */
260 void add_coef(int index, double value, coefficients type = coefficients::ALL);
261
262 /**
263 * @brief Resets the filter's internal state
264 *
265 * Clears the input and output history buffers, effectively
266 * resetting the filter to its initial state. This is useful
267 * when switching between audio segments to prevent artifacts.
268 */
269 virtual void reset();
270
271 /**
272 * @brief Sets the filter's output gain
273 * @param new_gain New gain value
274 *
275 * Adjusts the overall output level of the filter without
276 * changing its frequency response characteristics.
277 */
278 inline void set_gain(double new_gain) { m_gain = new_gain; }
279
280 /**
281 * @brief Gets the current gain value
282 * @return Current gain value
283 */
284 [[nodiscard]] inline double get_gain() const { return m_gain; }
285
286 /**
287 * @brief Enables or disables filter bypass
288 * @param enable True to enable bypass, false to disable
289 *
290 * When bypass is enabled, the filter passes input directly to output
291 * without applying any filtering, useful for A/B testing or
292 * temporarily disabling filters.
293 */
294 inline void set_bypass(bool enable) { m_bypass_enabled = enable; }
295
296 /**
297 * @brief Checks if bypass is currently enabled
298 * @return True if bypass is enabled, false otherwise
299 */
300 [[nodiscard]] inline bool is_bypass_enabled() const { return m_bypass_enabled; }
301
302 /**
303 * @brief Gets the filter's order
304 * @return Maximum order of the filter
305 *
306 * The filter order is determined by the maximum of the input and output
307 * coefficient counts minus one, representing the highest power of z⁻¹
308 * in the filter's transfer function.
309 */
310 [[nodiscard]] inline int get_order() const { return std::max(m_coef_a.size() - 1, m_coef_b.size() - 1); }
311
312 /**
313 * @brief Gets the input history buffer
314 * @return Constant reference to the input history vector
315 *
316 * Provides access to the filter's internal input history buffer,
317 * useful for analysis and visualization.
318 */
319 [[nodiscard]] inline const std::vector<double>& get_input_history() const { return m_input_history; }
320
321 /**
322 * @brief Gets the output history buffer
323 * @return Constant reference to the output history vector
324 *
325 * Provides access to the filter's internal output history buffer,
326 * useful for analysis and visualization.
327 */
328 [[nodiscard]] inline const std::vector<double>& get_output_history() const { return m_output_history; }
329
330 /**
331 * @brief Normalizes filter coefficients
332 * @param type Which set of coefficients to normalize (input, output, or both)
333 *
334 * Scales coefficients to ensure a[0] = 1.0 and/or maintain consistent
335 * gain at DC or Nyquist, depending on the filter type.
336 */
337 void normalize_coefficients(coefficients type = coefficients::ALL);
338
339 /**
340 * @brief Calculates the complex frequency response at a specific frequency
341 * @param frequency Frequency in Hz to analyze
342 * @param sample_rate Sample rate in Hz
343 * @return Complex frequency response (magnitude and phase)
344 *
345 * Computes the transformation's complex response at the specified frequency.
346 * This mathematical analysis can be used for visualization, further algorithmic
347 * processing, or to inform cross-domain mappings between audio properties
348 * and other computational parameters.
349 */
350 [[nodiscard]] std::complex<double> get_frequency_response(double frequency, double sample_rate) const;
351
352 /**
353 * @brief Calculates the magnitude response at a specific frequency
354 * @param frequency Frequency in Hz to analyze
355 * @param sample_rate Sample rate in Hz
356 * @return Magnitude response in linear scale
357 *
358 * Computes the filter's magnitude response at the specified frequency,
359 * representing how much the filter amplifies or attenuates that frequency.
360 */
361 [[nodiscard]] double get_magnitude_response(double frequency, double sample_rate) const;
362
363 /**
364 * @brief Calculates the phase response at a specific frequency
365 * @param frequency Frequency in Hz to analyze
366 * @param sample_rate Sample rate in Hz
367 * @return Phase response in radians
368 *
369 * Computes the filter's phase response at the specified frequency,
370 * representing the phase shift introduced by the filter at that frequency.
371 */
372 [[nodiscard]] double get_phase_response(double frequency, double sample_rate) const;
373
374 /**
375 * @brief Processes a single sample through the filter
376 * @param input The input sample
377 * @return The filtered output sample
378 *
379 * This is the core processing method that implements the difference
380 * equation for a single sample. It must be implemented by derived
381 * filter classes to define their specific filtering behavior.
382 */
383 double process_sample(double input = 0.) override = 0;
384
385 /**
386 * @brief Calculates the phase response at a specific frequency
387 * @param frequency Frequency in Hz to analyze
388 * @param sample_rate Sample rate in Hz
389 * @return Phase response in radians
390 *
391 * Computes the filter's phase response at the specified frequency,
392 * representing the phase shift introduced by the filter at that frequency.
393 */
394 std::vector<double> process_batch(unsigned int num_samples) override;
395
396 /**
397 * @brief Sets the input node for the filter
398 * @param input_node Node providing input samples
399 *
400 * Connects the filter to a source of input samples, allowing
401 * filters to be chained together or connected to generators.
402 */
403 inline void set_input_node(const std::shared_ptr<Node>& input_node) { m_input_node = input_node; }
404
405 /**
406 * @brief Gets the input node for the filter
407 * @return Node providing input samples
408 */
409 inline std::shared_ptr<Node> get_input_node() { return m_input_node; }
410
411 /**
412 * @brief Updates the feedback (denominator) coefficients
413 * @param new_coefs New coefficient values
414 *
415 * Sets the 'a' coefficients in the difference equation, which
416 * are applied to previous output samples. The method ensures
417 * proper normalization and buffer sizing.
418 */
419 void setACoefficients(const std::vector<double>& new_coefs);
420
421 /**
422 * @brief Updates the feedforward (numerator) coefficients
423 * @param new_coefs New coefficient values
424 *
425 * Sets the 'b' coefficients in the difference equation, which
426 * are applied to current and previous input samples. The method
427 * ensures proper buffer sizing.
428 */
429 void setBCoefficients(const std::vector<double>& new_coefs);
430
431 /**
432 * @brief Gets the feedback (denominator) coefficients
433 * @return Constant reference to the 'a' coefficient vector
434 *
435 * Provides access to the filter's feedback coefficients for
436 * analysis and visualization.
437 */
438 [[nodiscard]] inline const std::vector<double>& getACoefficients() const { return m_coef_a; }
439
440 /**
441 * @brief Gets the feedforward (numerator) coefficients
442 * @return Constant reference to the 'b' coefficient vector
443 *
444 * Provides access to the filter's feedforward coefficients for
445 * analysis and visualization.
446 */
447 [[nodiscard]] inline const std::vector<double>& getBCoefficients() const { return m_coef_b; }
448
449 /**
450 * @brief Provide external buffer context for input history
451 * @param context View into buffer data to use instead of internal input accumulation
452 */
453 inline void set_input_context(std::span<double> context)
454 {
455 m_external_input_context = context;
456 m_use_external_input_context = true;
457 }
458
459 /**
460 * @brief Clear external input context, resume internal accumulation
461 */
463 {
464 m_use_external_input_context = false;
465 m_external_input_context = {};
466 }
467
468 [[nodiscard]] inline bool using_external_input_context() const
469 {
470 return m_use_external_input_context;
471 }
472
473protected:
474 /**
475 * @brief Modifies a specific coefficient in a coefficient buffer
476 * @param index Index of the coefficient to modify
477 * @param value New value for the coefficient
478 * @param buffer Reference to the coefficient buffer to modify
479 *
480 * Internal implementation for adding or modifying a coefficient
481 * in either the 'a' or 'b' coefficient vectors.
482 */
483 void add_coef_internal(uint64_t index, double value, std::vector<double>& buffer);
484
485 /**
486 * @brief Initializes the input and output history buffers
487 *
488 * Resizes the history buffers based on the current shift configuration
489 * and initializes them to zero. Called during construction and when
490 * the filter configuration changes.
491 */
492 virtual void initialize_shift_buffers();
493
494 /**
495 * @brief Updates the input history buffer with a new sample
496 * @param current_sample The new input sample
497 *
498 * Shifts the input history buffer and adds the new sample at the
499 * beginning. This maintains the history of input samples needed
500 * for the filter's feedforward path.
501 */
502 virtual void update_inputs(double current_sample);
503
504 /**
505 * @brief Updates the output history buffer with a new sample
506 * @param current_sample The new output sample
507 *
508 * Shifts the output history buffer and adds the new sample at the
509 * beginning. This maintains the history of output samples needed
510 * for the filter's feedback path.
511 */
512 virtual void update_outputs(double current_sample);
513
514 /**
515 * @brief Creates a filter-specific context object
516 * @param value The current output sample value
517 * @return A unique pointer to a FilterContext object
518 *
519 * Creates a FilterContext object that contains information about the filter's
520 * current state, including the current sample value, input/output history buffers,
521 * and coefficients. This context is passed to callbacks and conditions to provide
522 * them with the information they need to execute properly.
523 *
524 * The FilterContext allows callbacks to access filter-specific information
525 * beyond just the current sample value, enabling more sophisticated monitoring
526 * and analysis of filter behavior.
527 */
528 std::unique_ptr<NodeContext> create_context(double value) override;
529
530 /**
531 * @brief Notifies all registered callbacks with the current filter context
532 * @param value The current output sample value
533 *
534 * This method is called by the filter implementation when a new output value
535 * is produced. It creates a FilterContext object using create_context(), then
536 * calls all registered callbacks with that context.
537 *
538 * For unconditional callbacks (registered with on_tick()), the callback
539 * is always called. For conditional callbacks (registered with on_tick_if()),
540 * the callback is called only if its condition returns true.
541 *
542 * Filter implementations should call this method at appropriate points in their
543 * processing flow to trigger callbacks, typically after computing a new output value.
544 */
545 void notify_tick(double value) override;
546
547 /**
548 * @brief Builds input history from external context or internal accumulation
549 * @param current_sample Current input sample being processed
550 */
551 void build_input_history(double current_sample);
552
553 /**
554 * @brief The most recent sample value generated by this oscillator
555 *
556 * This value is updated each time process_sample() is called and can be
557 * accessed via get_last_output() without triggering additional processing.
558 * It's useful for monitoring the oscillator's state and for implementing
559 * feedback loops.
560 */
561 // double m_last_output;
562
563 /**
564 * @brief Input node providing samples to filter
565 *
566 * The filter processes samples from this node, allowing filters
567 * to be chained together or connected to generators.
568 */
569 std::shared_ptr<Node> m_input_node;
570
571 /**
572 * @brief Configuration for input and output buffer sizes
573 *
574 * Defines how many past input and output samples are stored,
575 * based on the filter's order.
576 */
577 std::pair<int, int> m_shift_config;
578
579 /**
580 * @brief Buffer storing previous input samples
581 *
582 * Maintains a history of input samples needed for the filter's
583 * feedforward path (b coefficients).
584 */
585 std::vector<double> m_input_history;
586
587 /**
588 * @brief Buffer storing previous output samples
589 *
590 * Maintains a history of output samples needed for the filter's
591 * feedback path (a coefficients).
592 */
593 std::vector<double> m_output_history;
594
595 /**
596 * @brief External input context for input history
597 *
598 * If set, the filter uses this external context for input history
599 * instead of its internal buffer. This allows sharing input history
600 * across multiple filters or nodes or from AudioBuffer sources.
601 */
602 std::span<double> m_external_input_context;
603
604 /**
605 * @brief Feedback (denominator) coefficients
606 *
607 * The 'a' coefficients in the difference equation, applied to
608 * previous output samples. a[0] is typically normalized to 1.0.
609 */
610 std::vector<double> m_coef_a;
611
612 /**
613 * @brief Feedforward (numerator) coefficients
614 *
615 * The 'b' coefficients in the difference equation, applied to
616 * current and previous input samples.
617 */
618 std::vector<double> m_coef_b;
619
620 /**
621 * @brief Overall gain factor applied to the filter output
622 *
623 * Provides a simple way to adjust the filter's output level
624 * without changing its frequency response characteristics.
625 */
626 double m_gain = 1.0;
627
628 /**
629 * @brief Flag to bypass filter processing
630 *
631 * When enabled, the filter passes input directly to output
632 * without applying any filtering.
633 */
634 bool m_bypass_enabled {};
635
636 std::vector<double> m_saved_input_history;
637 std::vector<double> m_saved_output_history;
638
639 bool m_state_saved {};
640
641 bool m_use_external_input_context {};
642};
643}
FilterContextGpu(double value, const std::vector< double > &input_history, const std::vector< double > &output_history, const std::vector< double > &coefs_a, const std::vector< double > &coefs_b, std::span< const float > gpu_data)
Definition Filter.hpp:92
GPU-augmented filter context for callbacks.
Definition Filter.hpp:90
const std::vector< double > & coefs_b
Current coefficients for output.
Definition Filter.hpp:79
const std::vector< double > & input_history
Current input history buffer.
Definition Filter.hpp:60
const std::vector< double > & coefs_a
Current coefficients for input.
Definition Filter.hpp:74
FilterContext(double value, const std::vector< double > &input_history, const std::vector< double > &output_history, const std::vector< double > &coefs_a, const std::vector< double > &coefs_b)
Constructs a FilterContext with the current filter state.
Definition Filter.hpp:43
const std::vector< double > & output_history
Current output history buffer.
Definition Filter.hpp:69
Specialized context for filter node callbacks.
Definition Filter.hpp:29
void set_gain(double new_gain)
Sets the filter's output gain.
Definition Filter.hpp:278
std::vector< double > m_saved_output_history
Definition Filter.hpp:637
void set_input_context(std::span< double > context)
Provide external buffer context for input history.
Definition Filter.hpp:453
std::vector< double > m_coef_b
Feedforward (numerator) coefficients.
Definition Filter.hpp:618
std::vector< double > m_output_history
Buffer storing previous output samples.
Definition Filter.hpp:593
const std::vector< double > & get_input_history() const
Gets the input history buffer.
Definition Filter.hpp:319
const std::vector< double > & getBCoefficients() const
Gets the feedforward (numerator) coefficients.
Definition Filter.hpp:447
int get_order() const
Gets the filter's order.
Definition Filter.hpp:310
std::pair< int, int > get_current_shift() const
Gets the current shift configuration.
Definition Filter.hpp:197
bool is_bypass_enabled() const
Checks if bypass is currently enabled.
Definition Filter.hpp:300
void set_shift(std::string &zindex_shifts)
Updates the filter's shift configuration.
Definition Filter.hpp:209
std::shared_ptr< Node > m_input_node
The most recent sample value generated by this oscillator.
Definition Filter.hpp:569
std::vector< double > m_saved_input_history
Definition Filter.hpp:636
const std::vector< double > & getACoefficients() const
Gets the feedback (denominator) coefficients.
Definition Filter.hpp:438
~Filter() override=default
Virtual destructor.
void set_input_node(const std::shared_ptr< Node > &input_node)
Sets the input node for the filter.
Definition Filter.hpp:403
int get_current_latency() const
Gets the current processing latency of the filter.
Definition Filter.hpp:186
double get_gain() const
Gets the current gain value.
Definition Filter.hpp:284
std::vector< double > m_input_history
Buffer storing previous input samples.
Definition Filter.hpp:585
void clear_input_context()
Clear external input context, resume internal accumulation.
Definition Filter.hpp:462
std::pair< int, int > m_shift_config
Configuration for input and output buffer sizes.
Definition Filter.hpp:577
std::span< double > m_external_input_context
External input context for input history.
Definition Filter.hpp:602
const std::vector< double > & get_output_history() const
Gets the output history buffer.
Definition Filter.hpp:328
std::vector< double > m_coef_a
Feedback (denominator) coefficients.
Definition Filter.hpp:610
double process_sample(double input=0.) override=0
Processes a single sample through the filter.
void set_bypass(bool enable)
Enables or disables filter bypass.
Definition Filter.hpp:294
std::shared_ptr< Node > get_input_node()
Gets the input node for the filter.
Definition Filter.hpp:409
bool using_external_input_context() const
Definition Filter.hpp:468
Base class for computational signal transformers implementing difference equations.
Definition Filter.hpp:138
GPU-uploadable 1D array data interface.
Base context class for node callbacks.
Definition Node.hpp:30
Base interface for all computational processing nodes.
Definition Node.hpp:109
std::pair< int, int > shift_parser(const std::string &str)
Parses a string representation of filter order into input/output shift configuration.
Definition Filter.cpp:7