conformal_component::synth

Trait Synth

Source
pub trait Synth: Processor {
    // Required methods
    fn handle_events<E: Iterator<Item = Data> + Clone, P: States>(
        &mut self,
        events: E,
        parameters: P,
    );
    fn process<E: Iterator<Item = Event> + Clone, P: BufferStates, O: BufferMut>(
        &mut self,
        events: Events<E>,
        parameters: P,
        output: &mut O,
    );
}
Expand description

A trait for synthesizers

A synthesizer is a processor that creates audio from a series of events, such as Note On, or Note Off.

Required Methods§

Source

fn handle_events<E: Iterator<Item = Data> + Clone, P: States>( &mut self, events: E, parameters: P, )

Handle parameter changes and events without processing any data. Must not allocate or block.

Note that parameters will include CONTROLLER_PARAMETERS related to controller state (e.g. pitch bend, mod wheel, etc.) above, in addition to all the parameters returned by crate::Component::parameter_infos.

Source

fn process<E: Iterator<Item = Event> + Clone, P: BufferStates, O: BufferMut>( &mut self, events: Events<E>, parameters: P, output: &mut O, )

Process a buffer of events into a buffer of audio. Must not allocate or block.

Note that events will be sorted by sample_offset

output will be received in an undetermined state and must be filled with audio by the processor during this call.

Note that parameters will include CONTROLLER_PARAMETERS related to controller state (e.g. pitch bend, mod wheel, etc.) above, in addition to all the parameters returned by crate::Component::parameter_infos.

In order to consume the parameters, you can use the crate::pzip macro to convert the parameters into an iterator of tuples that represent the state of the parameters at each sample.

The sample rate of the audio was provided in environment.sampling_rate in the call to crate::Component::create_processor.

Note that it’s guaranteed that output will be no longer than environment.max_samples_per_process_call provided in the call to crate::Component::create_processor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§