Skip to main content

OutputPort

Struct OutputPort 

Source
pub struct OutputPort<'a> { /* private fields */ }
Expand description

An output audio port.

Implementations§

Source§

impl<'a> OutputPort<'a>

Source

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();
Source

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.

Source

pub fn channel_count(&self) -> u32

The number of channels in this port.

Source

pub fn latency(&self) -> u32

The latency from the audio interface for this port, in samples.

Source

pub fn constant_mask(&self) -> ConstantMask

The constant mask for this port.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.