Struct ssloc::Audio

source ·
pub struct Audio { /* private fields */ }
Expand description

Audio data.

Implementations§

source§

impl Audio

source

pub fn channels(&self) -> usize

Number of channels in audio Data.

source

pub fn retain_channels(&mut self, filter: impl FnMut(usize) -> bool)

Only retain specified channels in self.

source

pub fn samples(&self) -> usize

Number of samples.

source

pub fn sample_rate(&self) -> F

Sample rate.

source

pub fn from_interleaved( sample_rate: F, channels: usize, data: impl IntoIterator<Item = impl Into<F>> ) -> Self

Create Self from interleaved sample.

source

pub fn from_channels( sample_rate: F, channels: impl IntoIterator<Item = impl IntoIterator<Item = impl Into<F>>> ) -> Self

Create Self from individual channels of audio data.

source

pub fn to_interleaved<T: FromPrimitive>(&self) -> impl Iterator<Item = T> + '_

Return samples in interleaved form.

source

pub fn from_pcm_bytes( format: PcmFormat, sample_rate: F, channels: usize, data: &[u8] ) -> Self

Produces wave data without header

Trait Implementations§

source§

impl ApproxEq for &Audio

§

type Margin = F64Margin

This type type defines a margin within which two values are to be considered approximately equal. It must implement Default so that approx_eq() can be called on unknown types.
source§

fn approx_eq<M: Into<Self::Margin>>(self, other: Self, margin: M) -> bool

This method tests that the self and other values are equal within margin of each other.
§

fn approx_ne<M>(self, other: Self, margin: M) -> boolwhere M: Into<Self::Margin>,

This method tests that the self and other values are not within margin of each other.
source§

impl Debug for Audio

source§

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

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

impl PartialEq<Audio> for Audio

source§

fn eq(&self, other: &Audio) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Audio

Auto Trait Implementations§

§

impl RefUnwindSafe for Audio

§

impl Send for Audio

§

impl Sync for Audio

§

impl Unpin for Audio

§

impl UnwindSafe for Audio

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.