Skip to main content

Stereo

Struct Stereo 

Source
pub struct Stereo {
    pub left: SampleT,
    pub right: SampleT,
}
Expand description

Struct representing a stereophonic audio sample.

Fields§

§left: SampleT

Left sample value.

§right: SampleT

Right sample value.

Implementations§

Source§

impl Stereo

Source

pub fn new() -> Self

Returns a new Stereo object with default <0,0> values.

Source

pub fn from(l: SampleT, r: SampleT) -> Self

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

§Parameters
  • l - the left audio sample.
  • r - the right audio sample.

Trait Implementations§

Source§

impl Add for Stereo

Source§

type Output = Stereo

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Stereo) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Stereo

Source§

fn add_assign(&mut self, rhs: Stereo)

Performs the += operation. Read more
Source§

impl Clone for Stereo

Source§

fn clone(&self) -> Stereo

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 Default for Stereo

Source§

fn default() -> Stereo

Returns the “default value” for a type. Read more
Source§

impl From<f32> for Stereo

Source§

fn from(s: SampleT) -> Self

Converts to this type from the input type.
Source§

impl Into<Vec<i16>> for Stereo

Source§

fn into(self) -> Vec<i16>

Converts this type into the (usually inferred) input type.
Source§

impl Into<Vec<i32>> for Stereo

Source§

fn into(self) -> Vec<i32>

Converts this type into the (usually inferred) input type.
Source§

impl Into<Vec<u8>> for Stereo

Source§

fn into(self) -> Vec<u8>

Converts this type into the (usually inferred) input type.
Source§

impl Into<f32> for Stereo

Source§

fn into(self) -> SampleT

Converts this type into the (usually inferred) input type.
Source§

impl Mul<f32> for Stereo

Source§

type Output = Stereo

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SampleT) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f64> for Stereo

Source§

type Output = Stereo

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for Stereo

Source§

type Output = Stereo

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Stereo) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<f32> for Stereo

Source§

fn mul_assign(&mut self, rhs: SampleT)

Performs the *= operation. Read more
Source§

impl MulAssign<f64> for Stereo

Source§

fn mul_assign(&mut self, rhs: MathT)

Performs the *= operation. Read more
Source§

impl MulAssign for Stereo

Source§

fn mul_assign(&mut self, rhs: Stereo)

Performs the *= operation. Read more
Source§

impl Neg for Stereo

Source§

type Output = Stereo

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Panner<f32> for Stereo

Pans a given sample between the left and right channels. The panning parameter g is a floating point value of the rang [-1,1], where -1 is panned full left and 1 is panned full right. If the given value is not within this range, it is clamped to it.

Source§

fn to_sample_format(s: SampleT, g: f32) -> Self

Converts the monophonic sample into a polyphonic sample.
Source§

impl Panner<f64> for Stereo

Source§

fn to_sample_format(s: SampleT, g: f64) -> Self

Converts the monophonic sample into a polyphonic sample.
Source§

impl SampleFormat for Stereo

Source§

fn from_sample(x: SampleT) -> Self

Creates an object from a single monophonic sample.
Source§

fn into_sample(self) -> SampleT

Converts the given polyphonic sample to a monophonic sample.
Source§

fn num_samples() -> usize

Returns the number of SampleT values held within a given SampleFormat. A common use for this would be for ensuring Vecs given to try_from have the correct size.
Source§

impl Sub for Stereo

Source§

type Output = Stereo

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Stereo) -> Self

Performs the - operation. Read more
Source§

impl SubAssign for Stereo

Source§

fn sub_assign(&mut self, rhs: Stereo)

Performs the -= operation. Read more
Source§

impl TryFrom<Vec<i16>> for Stereo

Source§

type Error = String

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

fn try_from(v: Vec<i16>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<i32>> for Stereo

Source§

type Error = String

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

fn try_from(v: Vec<i32>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<u8>> for Stereo

Source§

type Error = String

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

fn try_from(v: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Stereo

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

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

Source§

fn vzip(self) -> V