Skip to main content

GenericAudioBufferRef

Enum GenericAudioBufferRef 

Source
pub enum GenericAudioBufferRef<'a> {
    U8(&'a AudioBuffer<u8>),
    U16(&'a AudioBuffer<u16>),
    U24(&'a AudioBuffer<u24>),
    U32(&'a AudioBuffer<u32>),
    S8(&'a AudioBuffer<i8>),
    S16(&'a AudioBuffer<i16>),
    S24(&'a AudioBuffer<i24>),
    S32(&'a AudioBuffer<i32>),
    F32(&'a AudioBuffer<f32>),
    F64(&'a AudioBuffer<f64>),
}
Expand description

A non-owning immutable reference wrapper for an AudioBuffer of any standard sample format.

Calls on this wrapper are dispatched to the underlying, wrapped, buffer and are semantically identical.

Variants§

§

U8(&'a AudioBuffer<u8>)

An immutable unsigned 8-bit integer audio buffer reference.

§

U16(&'a AudioBuffer<u16>)

An immutable unsigned 16-bit integer audio buffer reference.

§

U24(&'a AudioBuffer<u24>)

An immutable unsigned 24-bit integer audio buffer reference.

§

U32(&'a AudioBuffer<u32>)

An immutable unsigned 32-bit integer audio buffer reference.

§

S8(&'a AudioBuffer<i8>)

An immutable signed 8-bit integer audio buffer reference.

§

S16(&'a AudioBuffer<i16>)

An immutable signed 16-bit integer audio buffer reference.

§

S24(&'a AudioBuffer<i24>)

An immutable signed 24-bit integer audio buffer reference.

§

S32(&'a AudioBuffer<i32>)

An immutable signed 32-bit integer audio buffer reference.

§

F32(&'a AudioBuffer<f32>)

An immutable single precision (32-bit) floating point audio buffer reference.

§

F64(&'a AudioBuffer<f64>)

An immutable double precision (64-bit) floating point audio buffer reference.

Implementations§

Source§

impl GenericAudioBufferRef<'_>

Source

pub fn spec(&self) -> &AudioSpec

Get the audio specification.

Source

pub fn num_planes(&self) -> usize

Get the total number of audio planes.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no audio frames.

Source

pub fn frames(&self) -> usize

Gets the number of audio frames in the buffer.

Source

pub fn is_unused(&self) -> bool

Returns true if the referenced AudioBuffer is unused.

An unused AudioBuffer has either a capacity of 0, or no channels.

Source

pub fn capacity(&self) -> usize

Gets the total capacity of the buffer. The capacity is the maximum number of audio frames the buffer can store.

Source

pub fn samples_interleaved(&self) -> usize

Get the total number of samples contained in all audio planes.

Source

pub fn samples_planar(&self) -> usize

Get the total number of samples contained in each audio plane.

Source

pub fn copy_to<Sout, Dst>(&self, dst: &mut Dst)
where Sout: ConvertibleSample, Dst: AudioMut<Sout>,

Copy audio to a mutable audio slice while doing any necessary sample format conversions.

Source

pub fn copy_to_slice_interleaved<Sout, Dst>(&self, dst: Dst)
where Sout: ConvertibleSample, Dst: AsMut<[Sout]>,

Copy all audio frames to a slice of samples in interleaved order.

See AudioBuffer::copy_to_slice_interleaved for full details.

Source

pub fn copy_to_slice_planar<Sout, Dst>(&self, dst: &mut [Dst])
where Sout: ConvertibleSample, Dst: AsMut<[Sout]>,

Copy all audio planes to discrete slices.

See AudioBuffer::copy_to_slice_planar for full details.

Source

pub fn copy_to_vec_interleaved<Sout>(&self, dst: &mut Vec<Sout>)
where Sout: ConvertibleSample,

Copy all audio frames to a vector of samples in interleaved order.

See AudioBuffer::copy_to_vec_interleaved for full details.

Source

pub fn copy_to_vecs_planar<Sout>(&self, dst: &mut Vec<Vec<Sout>>)
where Sout: ConvertibleSample,

Copy all audio planes to discrete vectors.

See AudioBuffer::copy_to_vecs_planar for full details.

Source

pub fn copy_bytes_interleaved_as<Sout, Dst>(&self, dst: Dst)
where Sout: SampleBytes + ConvertibleSample, Dst: AsMut<[u8]>,

Copy interleaved audio to the destination byte slice after converting to a different sample format.

See AudioBuffer::copy_bytes_interleaved_as for full details.

Source

pub fn copy_bytes_planar_as<Sout, Dst>(&self, dst: &mut [Dst])
where Sout: SampleBytes + ConvertibleSample, Dst: AsMut<[u8]>,

Copy planar audio as bytes to a destination slice per plane after converting to a different sample format.

See AudioBuffer::copy_bytes_planar_as for full details.

Source

pub fn copy_bytes_interleaved<Dst>(&self, dst: Dst)
where Dst: AsMut<[u8]>,

Copy interleaved audio to the destination byte slice.

See AudioBuffer::copy_bytes_interleaved for full details.

Source

pub fn copy_bytes_planar<Dst>(&self, dst: &mut [Dst])
where Dst: AsMut<[u8]>,

Copy planar audio as bytes to a destination slice per plane.

See AudioBuffer::copy_bytes_planar for full details.

Source

pub fn copy_bytes_to_vec_interleaved(&self, dst: &mut Vec<u8>)

Copy interleaved audio to the destination byte vector.

See AudioBuffer::copy_bytes_to_vec_interleaved for full details.

Source

pub fn copy_bytes_to_vec_interleaved_as<Sout>(&self, dst: &mut Vec<u8>)

Copy interleaved audio to the destination byte vector after converting to a different sample format.

See AudioBuffer::copy_bytes_to_vec_interleaved_as for full details.

Source

pub fn copy_bytes_to_vecs_planar(&self, dst: &mut Vec<Vec<u8>>)

Copy audio planes as bytes to discrete byte vectors.

See AudioBuffer::copy_bytes_to_vecs_planar for full details.

Source

pub fn copy_bytes_to_vecs_planar_as<Sout>(&self, dst: &mut Vec<Vec<u8>>)

Copy audio planes as bytes to discrete byte vectors after converting to a different sample format.

See AudioBuffer::copy_bytes_to_vecs_planar_as for full details.

Source

pub fn byte_len_as<Sout>(&self) -> usize

Get the length in bytes of all samples if converted to a new sample format.

Source

pub fn byte_len_per_plane_as<Sout>(&self) -> usize

Get the length in bytes of all samples in a single plane if converted to a new sample format.

Source

pub fn byte_len_per_frame_as<Sout>(&self) -> usize

Get the length of bytes of a single interleaved audio frame if converted to a new sample format.

Source

pub fn byte_len(&self) -> usize

Get the length in bytes of all samples.

Source

pub fn byte_len_per_plane(&self) -> usize

Get the length in bytes of all samples in a single plane.

Source

pub fn byte_len_per_frame(&self) -> usize

Get the length of bytes of a single interleaved audio frame.

Trait Implementations§

Source§

impl<'a> Clone for GenericAudioBufferRef<'a>

Source§

fn clone(&self) -> GenericAudioBufferRef<'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> From<&'a AudioBuffer<f32>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<f32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<f64>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<f64>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<i16>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<i16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<i24>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<i24>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<i32>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<i32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<i8>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<i8>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<u16>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<u16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<u24>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<u24>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<u32>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<u32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a AudioBuffer<u8>> for GenericAudioBufferRef<'a>

Source§

fn from(value: &'a AudioBuffer<u8>) -> Self

Converts to this type from the input type.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<f32>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<f64>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<i16>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<i24>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<i32>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<i8>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<u16>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<u24>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<u32>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<GenericAudioBufferRef<'a>> for &'a AudioBuffer<u8>

Source§

type Error = ()

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

fn try_from(value: GenericAudioBufferRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

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.