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§
Sourcefn identity(&self) -> HostIdentity
fn identity(&self) -> HostIdentity
Returns what renders.
Sourcefn render(&mut self, job: &RenderJob) -> Result<Rendered, RenderError>
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.
Sourcefn render_init(&mut self, job: &RenderJob) -> Result<Rendered, RenderError>
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.
Sourcefn save_state(&mut self) -> Result<Vec<u8>, RenderError>
fn save_state(&mut self) -> Result<Vec<u8>, RenderError>
Provided Methods§
Sourcefn last_state_load(&self) -> Option<Seconds>
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".