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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Declarative macros for Wavecraft DSP processors.
//!
//! This module provides the `wavecraft_processor!` macro for creating
//! named wrappers around built-in DSP processors.
//!
//! For the `wavecraft_plugin!` macro that generates nih-plug plugins,
//! see the `wavecraft-nih_plug` crate.
/// `wavecraft_processor!` — creates a named wrapper around a built-in DSP processor.
///
/// This macro generates a newtype struct that wraps a built-in processor type and
/// delegates the `Processor` trait implementation to the inner type.
///
/// # Syntax
///
/// ```text
/// wavecraft_processor!(MyGain => Gain);
/// ```
///
/// # Generated Code
///
/// ```text
/// pub struct MyGain(wavecraft_dsp::builtins::GainDsp);
///
/// impl Default for MyGain {
/// fn default() -> Self {
/// Self(wavecraft_dsp::builtins::GainDsp::default())
/// }
/// }
///
/// impl wavecraft_dsp::Processor for MyGain {
/// type Params = <wavecraft_dsp::builtins::GainDsp as wavecraft_dsp::Processor>::Params;
///
/// fn process(&mut self, buffer: &mut [&mut [f32]], transport: &wavecraft_dsp::Transport, params: &Self::Params) {
/// self.0.process(buffer, transport, params)
/// }
/// }
/// ```
///
/// # Built-in Processor Types
///
/// - `Gain` → `wavecraft_dsp::builtins::GainDsp`
/// - `Passthrough` → `wavecraft_dsp::builtins::PassthroughDsp`
///
/// # Example
///
/// ```rust,no_run
/// use wavecraft_core::wavecraft_processor;
/// use wavecraft_dsp::{Processor, Transport};
///
/// wavecraft_processor!(InputGain => Gain);
/// wavecraft_processor!(OutputGain => Gain);
///
/// let mut input = InputGain::default();
/// let mut output = OutputGain::default();
/// ```