Struct audio::wrap::Interleaved

source ·
pub struct Interleaved<T> { /* private fields */ }
Expand description

A wrapper for an interleaved audio buffer.

See wrap::interleaved.

Implementations§

source§

impl<T> Interleaved<T>
where T: Slice,

source

pub fn into_inner(self) -> T

Convert back into the wrapped value.

Examples
let buf = audio::wrap::interleaved(&[1, 2, 3, 4], 2);
assert_eq!(buf.into_inner(), &[1, 2, 3, 4]);
source

pub fn iter(&self) -> IterChannels<'_, T::Item>

Construct an iterator over the interleaved wrapper.

Examples
let buf = audio::wrap::interleaved(&[1, 2, 3, 4], 2);
let mut it = buf.iter();

assert_eq!(it.next().unwrap(), [1, 3]);
assert_eq!(it.next().unwrap(), [2, 4]);
source§

impl<T> Interleaved<T>
where T: SliceMut,

source

pub fn iter_mut(&mut self) -> IterChannelsMut<'_, T::Item>

Construct an iterator over the interleaved wrapper.

Trait Implementations§

source§

impl<T> Buf for Interleaved<T>
where T: Slice,

§

type Sample = <T as Slice>::Item

The type of a single sample.
§

type Channel<'this> = InterleavedChannel<'this, <Interleaved<T> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, <Interleaved<T> as Buf>::Sample> where Self: 'this

An iterator over available channels.
source§

fn frames_hint(&self) -> Option<usize>

A typical number of frames for each channel in the buffer, if known. Read more
source§

fn channels(&self) -> usize

The number of channels in the buffer. Read more
source§

fn get_channel(&self, channel: usize) -> Option<Self::Channel<'_>>

Return a handler to the buffer associated with the channel. Read more
source§

fn iter_channels(&self) -> Self::IterChannels<'_>

Construct an iterator over all the channels in the audio buffer. Read more
source§

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Construct a wrapper around this buffer that skips the first n frames. Read more
source§

fn tail(self, n: usize) -> Tail<Self>
where Self: Sized,

Construct a wrapper around this buffer that skips to the last n frames. Read more
source§

fn limit(self, limit: usize) -> Limit<Self>
where Self: Sized,

Construct a wrapper around this buffer which stops after limit frames. Read more
source§

impl<T> BufMut for Interleaved<T>
where T: SliceMut,

§

type ChannelMut<'this> = InterleavedChannelMut<'this, <T as Slice>::Item> where Self: 'this

The type of the mutable channel container.
§

type IterChannelsMut<'this> = IterChannelsMut<'this, <Interleaved<T> as Buf>::Sample> where Self: 'this

A mutable iterator over available channels.
source§

fn get_channel_mut(&mut self, channel: usize) -> Option<Self::ChannelMut<'_>>

Return a mutable handler to the buffer associated with the channel. Read more
source§

fn copy_channel(&mut self, from: usize, to: usize)

Copy one channel into another. Read more
source§

fn iter_channels_mut(&mut self) -> Self::IterChannelsMut<'_>

Construct a mutable iterator over available channels. Read more
source§

impl<T> ExactSizeBuf for Interleaved<T>
where T: Slice,

source§

fn frames(&self) -> usize

The number of frames in a buffer. Read more
source§

impl<T> InterleavedBuf for Interleaved<T>
where T: Slice,

§

type Sample = <T as Slice>::Item

The type of a single sample.
source§

fn as_interleaved(&self) -> &[Self::Sample]

Access the underlying raw interleaved buffer. Read more
source§

impl<T> InterleavedBufMut for Interleaved<T>
where T: SliceMut,

source§

fn as_interleaved_mut(&mut self) -> &mut [Self::Sample]

Access the underlying interleaved mutable buffer. Read more
source§

fn as_interleaved_mut_ptr(&mut self) -> NonNull<Self::Sample>

Access a pointer to the underlying interleaved mutable buffer. Read more
source§

unsafe fn set_interleaved_topology(&mut self, channels: usize, frames: usize)

Specify the topology of the underlying interleaved buffer. Read more
source§

impl<T> ReadBuf for Interleaved<T>
where T: Default + SliceIndex,

source§

fn remaining(&self) -> usize

Get the number of frames remaining that can be read from the buffer. Read more
source§

fn advance(&mut self, n: usize)

Advance the read number of frames by n. Read more
source§

fn has_remaining(&self) -> bool

Test if there are any remaining frames to read. Read more
source§

impl<T> ResizableBuf for Interleaved<&mut [T]>
where T: Copy,

source§

fn try_reserve(&mut self, capacity: usize) -> bool

Ensure that the audio buffer has space for at least the given capacity of contiguous memory. The capacity is specified in number of Samples. Read more
source§

fn resize_frames(&mut self, frames: usize)

Resize the number of per-channel frames in the buffer. Read more
source§

fn resize_topology(&mut self, channels: usize, frames: usize)

Resize the buffer to match the given topology. Read more
source§

impl<T> UniformBuf for Interleaved<T>
where T: Slice,

§

type Frame<'this> = InterleavedFrame<'this, <T as Slice>::Item> where Self: 'this

The type the channel assumes when coerced into a reference.
§

type IterFrames<'this> = InterleavedFramesIter<'this, <T as Slice>::Item> where Self: 'this

A borrowing iterator over the channel.
source§

fn get_frame(&self, frame: usize) -> Option<Self::Frame<'_>>

Get a single frame at the given offset. Read more
source§

fn iter_frames(&self) -> Self::IterFrames<'_>

Construct an iterator over all the frames in the audio buffer. Read more
source§

impl<T> WriteBuf for Interleaved<&mut [T]>
where T: Copy,

source§

fn remaining_mut(&self) -> usize

Remaining number of frames that can be written. Read more
source§

fn advance_mut(&mut self, n: usize)

Advance the number of frames that have been written. Read more
source§

fn has_remaining_mut(&self) -> bool

Test if this buffer has remaining mutable frames that can be written. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Interleaved<T>
where T: RefUnwindSafe,

§

impl<T> Send for Interleaved<T>
where T: Send,

§

impl<T> Sync for Interleaved<T>
where T: Sync,

§

impl<T> Unpin for Interleaved<T>
where T: Unpin,

§

impl<T> UnwindSafe for Interleaved<T>
where T: UnwindSafe,

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>,

§

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>,

§

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.