1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! # Macros for creating DSP algorithms
//!
//! This module provides macros for conveniently creating DSP algorithms
//! that implement traits from `crate::algorithm` using `Transcendental` from `rill_core`.
//!
//! ## Available macros
//!
//! - `simple_algorithm!` - for simple algorithms without parameters
//! - `parameterized_algorithm!` - for algorithms with parameters
//! - `filter_algorithm!` - for filters (with coefficients)
//! - `effect_algorithm!` - for effects (with dry/wet)
//! - `generator_algorithm!` - for generators
//!
//! ## Example
//!
//! ```
//! use rill_core_dsp::simple_algorithm;
//! use rill_core::math::Transcendental;
//!
//! simple_algorithm! {
//! /// Simple gain
//! #[derive(Debug, Clone, Copy)]
//! pub struct Gain<T: Transcendental> {
//! params: {
//! /// Gain coefficient
//! gain: T = T::from_f32(1.0),
//! },
//! state: {
//! /// Last output value (for statistics)
//! last_output: T = T::ZERO,
//! },
//! process: |this, input| {
//! let output = input * this.gain;
//! this.last_output = output;
//! output
//! }
//! }
//! }
//! ```
/// Prelude for convenient macro imports