Skip to main content

InputPort

Struct InputPort 

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

An input audio port.

Implementations§

Source§

impl<'a> InputPort<'a>

Source

pub fn channels( &self, ) -> Result<SampleType<InputChannels<'a, f32>, InputChannels<'a, f64>>, BufferError>

Retrieves the input 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 nor f64 buffer type, which is invalid per the CLAP specification.

§Example
use clack_plugin::process::audio::{InputChannels, InputPort, SampleType};

let port: InputPort = /* ... */

// 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: InputChannels<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.

Trait Implementations§

Source§

impl<'a> Clone for InputPort<'a>

Source§

fn clone(&self) -> InputPort<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for InputPort<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for InputPort<'a>

§

impl<'a> RefUnwindSafe for InputPort<'a>

§

impl<'a> Send for InputPort<'a>

§

impl<'a> Sync for InputPort<'a>

§

impl<'a> Unpin for InputPort<'a>

§

impl<'a> UnsafeUnpin for InputPort<'a>

§

impl<'a> UnwindSafe for InputPort<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.