Enum BlockType

Source
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,

Source

pub fn process( &mut self, inputs: &[&[S]], outputs: &mut [&mut [S]], modulation_values: &[S], context: &DspContext, )

Perform the calculation of the underlying Block.

Source

pub fn input_count(&self) -> usize

Get the input count of the underlying Block.

Source

pub fn output_count(&self) -> usize

Get the output count of the underlying Block.

Source

pub fn modulation_outputs(&self) -> &[ModulationOutput]

Get the modulation outputs (if any) of the underlying Block.

Source

pub fn channel_config(&self) -> ChannelConfig

Get the channel config of the underlying Block.

Source

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.

Source

pub fn set_parameter( &mut self, parameter_name: &str, parameter: Parameter<S>, ) -> Result<(), String>

Set a given Parameter of the underlying Block.

Source

pub fn is_modulator(&self) -> bool

Returns true if this block is a modulator (LFO or Envelope).

Source

pub fn is_output(&self) -> bool

Returns true if this block is an output-type block (Output or FileOutput).

Source

pub fn category(&self) -> BlockCategory

Returns the category of this block.

Source

pub fn name(&self) -> &'static str

Returns the display name of this block type.

Source

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.

Trait Implementations§

Source§

impl<S> From<AmbisonicDecoderBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: AmbisonicDecoderBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<BinauralDecoderBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: BinauralDecoderBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<ChannelMergerBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: ChannelMergerBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<ChannelRouterBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: ChannelRouterBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<ChannelSplitterBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: ChannelSplitterBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<DcBlockerBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: DcBlockerBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<EnvelopeBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: EnvelopeBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<FileInputBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: FileInputBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<FileOutputBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: FileOutputBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<GainBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: GainBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<LfoBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: LfoBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<LowPassFilterBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: LowPassFilterBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<MatrixMixerBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: MatrixMixerBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<MixerBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: MixerBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<OscillatorBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: OscillatorBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<OutputBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: OutputBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<OverdriveBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: OverdriveBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<PannerBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: PannerBlock<S>) -> BlockType<S>

Converts to this type from the input type.
Source§

impl<S> From<VcaBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: VcaBlock<S>) -> BlockType<S>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<S> Freeze for BlockType<S>
where S: Freeze,

§

impl<S> !RefUnwindSafe for BlockType<S>

§

impl<S> Send for BlockType<S>

§

impl<S> Sync for BlockType<S>

§

impl<S> Unpin for BlockType<S>
where S: Unpin,

§

impl<S> !UnwindSafe for BlockType<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.