Struct vst::host::HostBuffer
source · pub struct HostBuffer<T: Float> { /* private fields */ }Expand description
Used for constructing AudioBuffer instances on the host.
This struct contains all necessary allocations for an AudioBuffer apart
from the actual sample arrays. This way, the inner processing loop can
be allocation free even if AudioBuffer instances are repeatedly created.
let mut host_buffer: HostBuffer<f32> = HostBuffer::new(2, 2);
let inputs = vec![vec![0.0; 1000]; 2];
let mut outputs = vec![vec![0.0; 1000]; 2];
let mut audio_buffer = host_buffer.bind(&inputs, &mut outputs);
plugin.process(&mut audio_buffer);Implementations§
source§impl<T: Float> HostBuffer<T>
impl<T: Float> HostBuffer<T>
sourcepub fn new(input_count: usize, output_count: usize) -> HostBuffer<T>
pub fn new(input_count: usize, output_count: usize) -> HostBuffer<T>
Create a HostBuffer for a given number of input and output channels.
sourcepub fn from_info(info: &Info) -> HostBuffer<T>
pub fn from_info(info: &Info) -> HostBuffer<T>
Create a HostBuffer for the number of input and output channels
specified in an Info struct.
sourcepub fn bind<'a, I, O>(
&'a mut self,
input_arrays: &[I],
output_arrays: &mut [O]
) -> AudioBuffer<'a, T>where
I: AsRef<[T]> + 'a,
O: AsMut<[T]> + 'a,
pub fn bind<'a, I, O>(
&'a mut self,
input_arrays: &[I],
output_arrays: &mut [O]
) -> AudioBuffer<'a, T>where
I: AsRef<[T]> + 'a,
O: AsMut<[T]> + 'a,
Bind sample arrays to the HostBuffer to create an AudioBuffer to pass to a plugin.
Panics
This function will panic if more inputs or outputs are supplied than the HostBuffer
was created for, or if the sample arrays do not all have the same length.
sourcepub fn input_count(&self) -> usize
pub fn input_count(&self) -> usize
Number of input channels supported by this HostBuffer.
sourcepub fn output_count(&self) -> usize
pub fn output_count(&self) -> usize
Number of output channels supported by this HostBuffer.