macro_rules! effect_algorithm {
(
$(#[$struct_meta:meta])*
$vis:vis struct $name:ident<$($generic:ident: $bound:path),+> {
params: {
$(
$(#[$param_meta:meta])*
$param_name:ident : $param_type:ty = $param_default:expr
),* $(,)?
},
state: {
$(
$(#[$state_meta:meta])*
$state_name:ident : $state_type:ty = $state_default:expr
),* $(,)?
},
wet: $wet_default:expr,
process: $process:expr
}
) => { ... };
}Expand description
Macro for creating an effect with dry/wet mix
ยงExample
use rill_core_dsp::effect_algorithm;
use rill_core::math::Transcendental;
effect_algorithm! {
/// Delay effect
#[derive(Debug, Clone, Copy)]
pub struct Delay<T: Transcendental> {
params: {
time: T = T::from_f32(0.3),
feedback: T = T::from_f32(0.5),
},
state: {
buffer: [T; 1024] = [T::ZERO; 1024],
pos: usize = 0,
},
wet: T::from_f32(0.5),
process: |this, input| {
// Process effect
input
}
}
}