Trait rsynth::backend::HostInterface[][src]

pub trait HostInterface {
    fn output_initialized(&self) -> bool;

    fn stop(&mut self) { ... }
}

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

fn output_initialized(&self) -> bool[src]

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 crate::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.
    }
}
Loading content...

Provided methods

fn stop(&mut self)[src]

Stop processing. For backends that do not support stopping, this is a no-op. For back-ends that do support stopping and that implement the Stop trait, this stops the processing.

Loading content...

Implementors

impl HostInterface for HostCallback[src]

impl<'c, 'mp, 'mw> HostInterface for JackHost<'c, 'mp, 'mw>[src]

impl<W> HostInterface for MidiWriterWrapper<W> where
    W: MidiWriter
[src]

Loading content...