Synth

Trait Synth 

Source
pub trait Synth: Processor {
    // Required methods
    fn handle_events(&mut self, context: &impl HandleEventsContext);
    fn process(
        &mut self,
        context: &impl ProcessContext,
        output: &mut impl BufferMut,
    );
}
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(&mut self, context: &impl HandleEventsContext)

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

Source

fn process( &mut self, context: &impl ProcessContext, output: &mut impl BufferMut, )

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.

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§