Samples

Struct Samples 

Source
pub struct Samples<T: Sample> {
    pub samples: Vec<T>,
    pub metadata: SamplesMetadata,
}
Expand description

A sample container of LPcm samples ready to be send to audio streams

Fields§

§samples: Vec<T>

A an ordered vector of all the samples, if there are multiple channels, each channel will have their own sample

ex: 1 channel: [s1, s2, s3]

2 channels: [s-left1, s-right1, s-left-2, s-right-2, s-left-3, s-right-3]

§metadata: SamplesMetadata

The metadata of the Samples, dictates how they are consumed and modified. There is no guarenty that the metadata reflects the actual intended metadata.

Implementations§

Source§

impl<T: Sample> Samples<T>

Source

pub fn new(samples: Vec<T>, metadata: SamplesMetadata) -> Samples<T>

Creates a new Samples struct

Source§

impl Samples<IntermediateSampleType>

Source

pub fn into_t_samples<T: Sample + FromSample<IntermediateSampleType>>( self, ) -> Samples<T>

Turns the samples into the desired sample type, does not clone

Trait Implementations§

Source§

impl<T: Clone + Sample> Clone for Samples<T>

Source§

fn clone(&self) -> Samples<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Sample> Debug for Samples<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Samples<f32>> for SampleType

Source§

fn from(_value: &Samples<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<f64>> for SampleType

Source§

fn from(_value: &Samples<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<i16>> for SampleType

Source§

fn from(_value: &Samples<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<i32>> for SampleType

Source§

fn from(_value: &Samples<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<i64>> for SampleType

Source§

fn from(_value: &Samples<i64>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<i8>> for SampleType

Source§

fn from(_value: &Samples<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<u16>> for SampleType

Source§

fn from(_value: &Samples<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<u32>> for SampleType

Source§

fn from(_value: &Samples<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<u64>> for SampleType

Source§

fn from(_value: &Samples<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<&Samples<u8>> for SampleType

Source§

fn from(_value: &Samples<u8>) -> Self

Converts to this type from the input type.
Source§

impl<T: Sample> SamplesTrait for Samples<T>

Source§

fn into_generic_representation_samples(self) -> Samples<IntermediateSampleType>

Transforms the samples into IntermediateSampleType, does not clone
Source§

fn generic_representation_samples(&self) -> Samples<IntermediateSampleType>

Makes a clone of the samples in the IntermediateSampleType
Source§

fn metadata(&self) -> Box<dyn AudioMetadataTrait>

Gets the metadata of the samples

Auto Trait Implementations§

§

impl<T> Freeze for Samples<T>

§

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

§

impl<T> Send for Samples<T>

§

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

§

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

§

impl<T> UnwindSafe for Samples<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> 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<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> 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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,