macro_rules! wavecraft_processor {
($name:ident => Gain) => { ... };
($name:ident => Passthrough) => { ... };
($name:ident => Filter) => { ... };
($name:ident => Saturator) => { ... };
($name:ident => $inner:path) => { ... };
}Expand description
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
wavecraft_processor!(MyGain => Gain);§Generated Code
pub struct MyGain(wavecraft_processors::GainDsp);
impl Default for MyGain {
fn default() -> Self {
Self(wavecraft_processors::GainDsp::default())
}
}
impl wavecraft_dsp::Processor for MyGain {
type Params = <wavecraft_processors::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_processors::GainDspPassthrough→wavecraft_processors::PassthroughDspFilter→wavecraft_processors::UnifiedFilterDspSaturator→wavecraft_processors::SaturatorDsp
§Example
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();