pub trait HostInterface {
// Required method
fn output_initialized(&self) -> bool;
// Provided method
fn stop(&mut self) { ... }
}Expand description
Defines an interface for communicating with the host or server of the backend, e.g. the VST host when using VST or the Jack server when using Jack.
Required Methods§
Sourcefn output_initialized(&self) -> bool
fn output_initialized(&self) -> bool
Return whether the output buffers are zero-initialized.
Returns false when in doubt.
§Example
The following example illustrates how output_initialized() can be used in
combination with the set method on AudioBufferOut to initialize the output
buffers to zero in an implementation of the [ContextualAudioRenderer] trait.
use rsynth::ContextualAudioRenderer;
use rsynth::backend::HostInterface;
use rsynth::buffer::AudioBufferInOut;
struct MyPlugin { /* ... */ }
impl<H> ContextualAudioRenderer<f32, H> for MyPlugin
where H: HostInterface
{
fn render_buffer(
&mut self,
buffer: &mut AudioBufferInOut<f32>,
context: &mut H)
{
if ! context.output_initialized() {
buffer.outputs().set(0.0);
}
// The rest of the audio rendering.
}
}