Struct audio::wrap::Dynamic

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

A wrapper for an external dynamic audio buffer.

See wrap::dynamic.

Implementations§

source§

impl<T> Dynamic<T>

source

pub fn as_ref(&self) -> &T

Get a reference to the inner value.

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

pub fn as_mut(&mut self) -> &mut T

Get a mutable reference to the inner value.

Examples
let mut buf = audio::wrap::dynamic(vec![vec![1, 2, 3, 4]]);
*buf.as_mut() = vec![vec![5, 6, 7, 8]];
assert_eq!(buf.as_ref(), &[vec![5, 6, 7, 8]]);
source

pub fn into_inner(self) -> T

Get the inner wrapper value.

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

Trait Implementations§

source§

impl<T> Buf for Dynamic<&[Vec<T>]>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<&[Vec<T>]> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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, const N: usize> Buf for Dynamic<&[Vec<T>; N]>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<&[Vec<T>; N]> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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> Buf for Dynamic<&Vec<Vec<T>>>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<&Vec<Vec<T>>> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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> Buf for Dynamic<&mut [Vec<T>]>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<&mut [Vec<T>]> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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, const N: usize> Buf for Dynamic<&mut [Vec<T>; N]>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<&mut [Vec<T>; N]> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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> Buf for Dynamic<&mut Vec<Vec<T>>>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<&mut Vec<Vec<T>>> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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, const N: usize> Buf for Dynamic<[Vec<T>; N]>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<[Vec<T>; N]> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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> Buf for Dynamic<Vec<Vec<T>>>
where T: Copy,

§

type Sample = T

The type of a single sample.
§

type Channel<'this> = LinearChannel<'this, <Dynamic<Vec<Vec<T>>> as Buf>::Sample> where Self: 'this

The type of the channel container.
§

type IterChannels<'this> = IterChannels<'this, T> 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 Dynamic<&mut [Vec<T>]>
where T: Copy,

§

type ChannelMut<'this> = LinearChannelMut<'this, T> where Self: 'this

The type of the mutable channel container.
§

type IterChannelsMut<'this> = IterChannelsMut<'this, T> 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, const N: usize> BufMut for Dynamic<&mut [Vec<T>; N]>
where T: Copy,

§

type ChannelMut<'this> = LinearChannelMut<'this, T> where Self: 'this

The type of the mutable channel container.
§

type IterChannelsMut<'this> = IterChannelsMut<'this, T> 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> BufMut for Dynamic<&mut Vec<Vec<T>>>
where T: Copy,

§

type ChannelMut<'this> = LinearChannelMut<'this, T> where Self: 'this

The type of the mutable channel container.
§

type IterChannelsMut<'this> = IterChannelsMut<'this, T> 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, const N: usize> BufMut for Dynamic<[Vec<T>; N]>
where T: Copy,

§

type ChannelMut<'this> = LinearChannelMut<'this, T> where Self: 'this

The type of the mutable channel container.
§

type IterChannelsMut<'this> = IterChannelsMut<'this, T> 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> BufMut for Dynamic<Vec<Vec<T>>>
where T: Copy,

§

type ChannelMut<'this> = LinearChannelMut<'this, T> where Self: 'this

The type of the mutable channel container.
§

type IterChannelsMut<'this> = IterChannelsMut<'this, T> 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> ResizableBuf for Dynamic<Vec<Vec<T>>>
where T: Sample,

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Dynamic<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.