wavecraft_dsp/combinators/mod.rs
1//! Processor combinators for chaining DSP operations.
2
3mod chain;
4
5pub use chain::Chain;
6
7/// Combines processors into a serial signal chain.
8///
9/// This is the recommended macro for building DSP chains in Wavecraft.
10/// Use `SignalChain!` for consistency with the `wavecraft_plugin!` DSL.
11///
12/// # Single Processor (Zero Overhead)
13///
14/// ```rust,no_run
15/// use wavecraft_dsp::builtins::GainDsp;
16/// use wavecraft_dsp::SignalChain;
17///
18/// type Single = SignalChain![GainDsp]; // Compiles to just `GainDsp`, no wrapper
19/// ```
20///
21/// # Multiple Processors
22///
23/// ```rust,no_run
24/// use wavecraft_dsp::builtins::{GainDsp, PassthroughDsp};
25/// use wavecraft_dsp::SignalChain;
26///
27/// type Multiple = SignalChain![GainDsp, PassthroughDsp];
28/// ```
29#[macro_export]
30macro_rules! SignalChain {
31 // Single processor: no wrapping, zero overhead
32 ($single:ty) => {
33 $single
34 };
35 // Multiple: nest into Chain<A, Chain<B, ...>>
36 ($first:ty, $($rest:ty),+ $(,)?) => {
37 $crate::combinators::Chain<$first, $crate::SignalChain![$($rest),+]>
38 };
39}
40
41/// DEPRECATED: Use `SignalChain!` instead.
42///
43/// This macro is deprecated and will be removed in 0.10.0.
44/// Please use `SignalChain!` for consistency with the Wavecraft DSL.
45///
46/// # Migration
47///
48/// ```rust,no_run
49/// use wavecraft_dsp::builtins::GainDsp;
50/// use wavecraft_dsp::SignalChain;
51///
52/// // Old (deprecated):
53/// // type MyChain = Chain![GainDsp];
54///
55/// // New (recommended):
56/// type MyChain = SignalChain![GainDsp];
57/// ```
58#[deprecated(since = "0.9.0", note = "use `SignalChain!` instead")]
59#[macro_export]
60macro_rules! Chain {
61 ($($tt:tt)*) => {
62 $crate::SignalChain![$($tt)*]
63 };
64}