Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer {
    // Required methods
    fn identity(&self) -> HostIdentity;
    fn render(&mut self, job: &RenderJob) -> Result<Rendered, RenderError>;
    fn render_init(&mut self, job: &RenderJob) -> Result<Rendered, RenderError>;
    fn save_state(&mut self) -> Result<Vec<u8>, RenderError>;

    // Provided method
    fn last_state_load(&self) -> Option<Seconds> { ... }
}
Expand description

Plays a RenderJob through one synth and returns the audio.

A backend loads the state, plays the recipe’s pre-roll (settle, warm-up note, settle) and throws it away, then renders the clip. The clip ends once the TailWatch says the tail is over.

Events go to the synth in the order of note_events. A note-on of a key that already sounds is sent as a second note-on, and each note-off of a key ends the oldest sounding note of that key, first in, first out, as the MIDI reader pairs them. How the synth voices a repeated key is the synth’s own rule.

Required Methods§

Source

fn identity(&self) -> HostIdentity

Returns what renders.

Source

fn render(&mut self, job: &RenderJob) -> Result<Rendered, RenderError>

Renders one job.

§Errors

Returns a RenderError when the state does not load, the plug-in fails or the audio is not valid.

Source

fn render_init(&mut self, job: &RenderJob) -> Result<Rendered, RenderError>

Renders the job’s notes with the plug-in’s own init patch: the job’s state is not loaded. Only a renderer that has loaded no state yet holds the init patch, so the load check calls this first.

§Errors

Returns RenderError::Host once a state has loaded, or RenderError::Engine for the open engine, and the errors of Renderer::render.

Source

fn save_state(&mut self) -> Result<Vec<u8>, RenderError>

Returns the state the plug-in saves now.

§Errors

Returns a RenderError when the plug-in fails.

Provided Methods§

Source

fn last_state_load(&self) -> Option<Seconds>

Returns how long the state load of the last render took, when the backend measures it. A render of the init patch loads no state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§