pub enum BlockType<S>where
S: Sample,{
Show 19 variants
FileInput(FileInputBlock<S>),
FileOutput(FileOutputBlock<S>),
Output(OutputBlock<S>),
Oscillator(OscillatorBlock<S>),
AmbisonicDecoder(AmbisonicDecoderBlock<S>),
BinauralDecoder(BinauralDecoderBlock<S>),
ChannelMerger(ChannelMergerBlock<S>),
ChannelRouter(ChannelRouterBlock<S>),
ChannelSplitter(ChannelSplitterBlock<S>),
DcBlocker(DcBlockerBlock<S>),
Gain(GainBlock<S>),
LowPassFilter(LowPassFilterBlock<S>),
MatrixMixer(MatrixMixerBlock<S>),
Mixer(MixerBlock<S>),
Overdrive(OverdriveBlock<S>),
Panner(PannerBlock<S>),
Vca(VcaBlock<S>),
Envelope(EnvelopeBlock<S>),
Lfo(LfoBlock<S>),
}Expand description
Type-erased container for all block implementations.
Wraps concrete block types so they can be stored uniformly in a graph. Each variant corresponds to a specific DSP block type.
Variants§
FileInput(FileInputBlock<S>)
Reads audio from a file via a Reader.
FileOutput(FileOutputBlock<S>)
Writes audio to a file via a Writer.
Output(OutputBlock<S>)
Terminal output block that collects final audio.
Oscillator(OscillatorBlock<S>)
Waveform oscillator (sine, saw, square, triangle).
AmbisonicDecoder(AmbisonicDecoderBlock<S>)
Decodes ambisonics B-format to speaker layout.
BinauralDecoder(BinauralDecoderBlock<S>)
Decodes ambisonics B-format to stereo for headphones.
ChannelMerger(ChannelMergerBlock<S>)
Merges individual mono inputs into multi-channel output.
ChannelRouter(ChannelRouterBlock<S>)
Routes channels (mono to stereo, stereo to mono, etc.).
ChannelSplitter(ChannelSplitterBlock<S>)
Splits multi-channel input into individual mono outputs.
DcBlocker(DcBlockerBlock<S>)
Removes DC offset from the signal.
Gain(GainBlock<S>)
Adjusts signal level in decibels.
LowPassFilter(LowPassFilterBlock<S>)
SVF-based low-pass filter.
MatrixMixer(MatrixMixerBlock<S>)
NxM mixing matrix for flexible channel routing.
Mixer(MixerBlock<S>)
Channel-wise mixer that sums multiple sources per channel.
Overdrive(OverdriveBlock<S>)
Asymmetric soft-clipping distortion.
Panner(PannerBlock<S>)
Stereo panning with equal-power law.
Vca(VcaBlock<S>)
Voltage controlled amplifier (multiplies audio by control signal).
Envelope(EnvelopeBlock<S>)
ADSR envelope generator.
Lfo(LfoBlock<S>)
Low-frequency oscillator for modulation.
Implementations§
Source§impl<S> BlockType<S>where
S: Sample,
impl<S> BlockType<S>where
S: Sample,
Sourcepub fn process(
&mut self,
inputs: &[&[S]],
outputs: &mut [&mut [S]],
modulation_values: &[S],
context: &DspContext,
)
pub fn process( &mut self, inputs: &[&[S]], outputs: &mut [&mut [S]], modulation_values: &[S], context: &DspContext, )
Perform the calculation of the underlying Block.
Sourcepub fn input_count(&self) -> usize
pub fn input_count(&self) -> usize
Get the input count of the underlying Block.
Sourcepub fn output_count(&self) -> usize
pub fn output_count(&self) -> usize
Get the output count of the underlying Block.
Sourcepub fn modulation_outputs(&self) -> &[ModulationOutput]
pub fn modulation_outputs(&self) -> &[ModulationOutput]
Get the modulation outputs (if any) of the underlying Block.
Sourcepub fn channel_config(&self) -> ChannelConfig
pub fn channel_config(&self) -> ChannelConfig
Get the channel config of the underlying Block.
Sourcepub fn set_smoothing(&mut self, sample_rate: f64, ramp_time_ms: f64)
pub fn set_smoothing(&mut self, sample_rate: f64, ramp_time_ms: f64)
Configure smoothing time for parameter changes.
Only affects blocks that have internal parameter smoothing. Blocks without smoothing will ignore this call.
Sourcepub fn set_parameter(
&mut self,
parameter_name: &str,
parameter: Parameter<S>,
) -> Result<(), String>
pub fn set_parameter( &mut self, parameter_name: &str, parameter: Parameter<S>, ) -> Result<(), String>
Set a given Parameter of the underlying Block.
Sourcepub fn is_modulator(&self) -> bool
pub fn is_modulator(&self) -> bool
Returns true if this block is a modulator (LFO or Envelope).
Sourcepub fn is_output(&self) -> bool
pub fn is_output(&self) -> bool
Returns true if this block is an output-type block (Output or FileOutput).
Sourcepub fn category(&self) -> BlockCategory
pub fn category(&self) -> BlockCategory
Returns the category of this block.
Sourcepub fn get_modulated_parameters(&self) -> Vec<(&'static str, BlockId)>
pub fn get_modulated_parameters(&self) -> Vec<(&'static str, BlockId)>
Returns all modulated parameters and their source block IDs.
Returns a list of (parameter_name, source_block_id) for each parameter that is modulated by another block.
§Note
This method allocates and is NOT realtime-safe. Only call during graph setup or from non-audio threads.