Skip to main content

OutputChannels

Struct OutputChannels 

Source
pub struct OutputChannels<'a, S> { /* private fields */ }
Expand description

An OutputPort’s channels’ data buffers, which contains samples of a given type S.

The sample type S is always going to be either f32 or f64, as returned by OutputPort::channels.

Implementations§

Source§

impl<S> OutputChannels<'_, S>

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 raw_data(&self) -> &[*mut S]

Returns the raw pointer data, as provided by the host.

In CLAP’s API, hosts provide a port’s audio data as an array of raw pointers, each of which points to the start of a sample array of type S and of frames_count length.

Source

pub fn channel_count(&self) -> u32

The number of channels.

Source

pub fn channel(&self, channel_index: u32) -> Option<&[S]>

Retrieves the sample buffer of the channel at a given index, as a read-only slice.

Source

pub fn channel_mut(&mut self, channel_index: u32) -> Option<&mut [S]>

Retrieves the sample buffer of the channel at a given index, as a mutable slice.

Source

pub fn iter(&self) -> InputChannelsIter<'_, S> ⓘ

Gets a read-only iterator over all the port’s channels’ sample buffers.

Source

pub fn iter_mut(&mut self) -> OutputChannelsIter<'_, S> ⓘ

Gets an iterator over all the port’s channels’ writable sample buffers.

Source

pub fn split_at_mut( &mut self, mid: u32, ) -> (OutputChannels<'_, S>, OutputChannels<'_, S>)

Divides the output channels into two at an index.

The first will contain all channels with indices from [0, mid) (excluding the index mid itself) and the second will contain all channels with indices from [mid, channel_count).

Unlike slice::split_at_mut, this method does not panic if mid is larger than channel_count. The second OutputChannels will only be empty in this case.

Trait Implementations§

Source§

impl<'a, T> IntoIterator for &'a OutputChannels<'a, T>

Source§

type Item = &'a [T]

The type of the elements being iterated over.
Source§

type IntoIter = InputChannelsIter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a mut OutputChannels<'a, T>

Source§

type Item = &'a mut [T]

The type of the elements being iterated over.
Source§

type IntoIter = OutputChannelsIter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for OutputChannels<'a, T>

Source§

type Item = &'a mut [T]

The type of the elements being iterated over.
Source§

type IntoIter = OutputChannelsIter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'a, S> !Send for OutputChannels<'a, S>

§

impl<'a, S> !Sync for OutputChannels<'a, S>

§

impl<'a, S> !UnwindSafe for OutputChannels<'a, S>

§

impl<'a, S> Freeze for OutputChannels<'a, S>
where &'a mut [*mut S]: Freeze,

§

impl<'a, S> RefUnwindSafe for OutputChannels<'a, S>
where &'a mut [*mut S]: RefUnwindSafe,

§

impl<'a, S> Unpin for OutputChannels<'a, S>
where &'a mut [*mut S]: Unpin,

§

impl<'a, S> UnsafeUnpin for OutputChannels<'a, S>
where &'a mut [*mut S]: UnsafeUnpin,

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.