pub struct OutputPort<'a> { /* private fields */ }Expand description
An output audio port.
Implementations§
Source§impl<'a> OutputPort<'a>
impl<'a> OutputPort<'a>
Sourcepub fn channels(
&mut self,
) -> Result<SampleType<OutputChannels<'a, f32>, OutputChannels<'a, f64>>, BufferError>
pub fn channels( &mut self, ) -> Result<SampleType<OutputChannels<'a, f32>, OutputChannels<'a, f64>>, BufferError>
Retrieves the output port’s channels.
Because each port can hold either f32 or f64 sample data, this method returns a
SampleType enum of the input channels, to indicate which one the port holds.
§Errors
This method returns a BufferError::InvalidChannelBuffer if the host provided neither
f32 or f64 buffer type, which is invalid per the CLAP specification.
§Example
use clack_plugin::process::audio::{OutputChannels, OutputPort, SampleType};
let mut port: OutputPort = /* ... */
// Decide what to do using by matching against every possible configuration
match port.channels().unwrap() {
SampleType::F32(buf) => { /* Process the 32-bit buffer */ },
SampleType::F64(buf) => { /* Process the 64-bit buffer */ },
SampleType::Both(buf32, buf64) => { /* We have both buffers available */ }
}
// If we're only interested in a single buffer type,
// we can use SampleType's helper methods:
let channels: OutputChannels<f32> = port.channels().unwrap().into_f32().unwrap();Sourcepub fn frames_count(&self) -> u32
pub fn frames_count(&self) -> u32
Returns the number of frames to process in this block.
This will always match the number of samples of every audio channel buffer.
Sourcepub fn channel_count(&self) -> u32
pub fn channel_count(&self) -> u32
The number of channels in this port.
Sourcepub fn constant_mask(&self) -> ConstantMask
pub fn constant_mask(&self) -> ConstantMask
The constant mask for this port.
Sourcepub fn set_constant_mask(&mut self, new_mask: ConstantMask)
pub fn set_constant_mask(&mut self, new_mask: ConstantMask)
Sets the constant mask for this port.
Auto Trait Implementations§
impl<'a> !UnwindSafe for OutputPort<'a>
impl<'a> Freeze for OutputPort<'a>
impl<'a> RefUnwindSafe for OutputPort<'a>
impl<'a> Send for OutputPort<'a>
impl<'a> Sync for OutputPort<'a>
impl<'a> Unpin for OutputPort<'a>
impl<'a> UnsafeUnpin for OutputPort<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more