pub struct InputPort<'a> { /* private fields */ }Expand description
An input audio port.
Implementations§
Source§impl<'a> InputPort<'a>
impl<'a> InputPort<'a>
Sourcepub fn channels(
&self,
) -> Result<SampleType<InputChannels<'a, f32>, InputChannels<'a, f64>>, BufferError>
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();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.
Trait Implementations§
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> 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