[][src]Struct bae_rs::sample_format::stereo::Stereo

pub struct Stereo {
    pub left: SampleT,
    pub right: SampleT,
}

Struct representing a stereophonic audio sample.

Fields

left: SampleT

Left sample value.

right: SampleT

Right sample value.

Methods

impl Stereo[src]

pub fn from_stereo(l: SampleT, r: SampleT) -> Stereo[src]

Returns a new Stereo object created from individual left and right audio samples.

Parameters

  • l - the left audio sample.
  • r - the right audio sapmle.

pub fn single_stereo(x: SampleT) -> Stereo[src]

Returns a new Stereo object where both left and right channels are copied from the passed sample value.

pub fn from_mono(x: SampleT) -> Stereo[src]

Creates a new Stereo object from a single monophonic sample. This function reduces the power of the given sample by half to reflect human hearing.

Parameters

  • x - the input sample.

pub fn as_mono(self) -> SampleT[src]

Converts the given stereophonic sample to a monophonic sample by summing the left and right samples and dividing by half power to get the full power monophonic sample.

Trait Implementations

impl Add<Stereo> for Stereo[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<Stereo> for Stereo[src]

impl Clone for Stereo[src]

impl Copy for Stereo[src]

impl Default for Stereo[src]

impl From<[u8; 2]> for Stereo[src]

fn from(v: [u8; 2]) -> Self[src]

Converts the array of 2 bytes into a Stereo object. It is assumed that the bytes are 8-bit unsigned audio samples.

Parameters

  • v - The raw bytes to convert from.

impl From<[u8; 4]> for Stereo[src]

fn from(v: [u8; 4]) -> Self[src]

Converts the array of 4 bytes into a Stereo object. It is assumed that the bytes are 16-bit signed audio samples.

Parameters

  • v - The raw bytes to convert from.

impl From<[u8; 6]> for Stereo[src]

fn from(v: [u8; 6]) -> Self[src]

Converts the array of 6 bytes into a Stereo object. It is assumed that the bytes are 24-bit signed audio samples.

Parameters

  • v - The raw bytes to convert from.

impl From<f32> for Stereo[src]

fn from(s: SampleT) -> Self[src]

Copies the given sample to the left and right channels. If you want to use the half-power conversion, use Stereo::from_mono.

impl Into<Vec<u8>> for Stereo[src]

fn into(self) -> Vec<u8>[src]

Converts the Stereo into a vector of bytes.

impl Mul<Stereo> for Stereo[src]

type Output = Stereo

The resulting type after applying the * operator.

impl Mul<Stereo> for SampleT[src]

type Output = Stereo

The resulting type after applying the * operator.

impl Mul<Stereo> for MathT[src]

type Output = Stereo

The resulting type after applying the * operator.

impl Mul<f32> for Stereo[src]

type Output = Stereo

The resulting type after applying the * operator.

impl Mul<f64> for Stereo[src]

type Output = Stereo

Output type of the multiplication

fn mul(self, rhs: MathT) -> Self::Output[src]

Multiplies a sample by a value. E.g. scaling the sample by a gain amount.

impl MulAssign<Stereo> for Stereo[src]

impl MulAssign<f32> for Stereo[src]

impl MulAssign<f64> for Stereo[src]

impl Neg for Stereo[src]

type Output = Self

The resulting type after applying the - operator.

impl Panner<Stereo, f32> for Stereo[src]

impl Sub<Stereo> for Stereo[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<Stereo> for Stereo[src]

Auto Trait Implementations

impl RefUnwindSafe for Stereo

impl Send for Stereo

impl Sync for Stereo

impl Unpin for Stereo

impl UnwindSafe for Stereo

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,