dasp_sample::types::i24

Struct I24

Source
pub struct I24(/* private fields */);

Implementations§

Source§

impl I24

Source

pub fn new(val: i32) -> Option<Self>

Construct a new sample if the given value is within range.

Returns None if val is out of range.

Source

pub fn new_unchecked(s: i32) -> Self

Constructs a new sample without checking for overflowing.

This should only be used if the user can guarantee the sample will be within range and they require the extra performance.

If this function is used, the sample crate can’t guarantee that the returned sample or any interacting samples will remain within their MIN and MAX bounds.

Source

pub fn inner(self) -> i32

Return the internal value used to represent the sample type.

Trait Implementations§

Source§

impl Add for I24

Source§

type Output = I24

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl BitAnd for I24

Source§

type Output = I24

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Self) -> Self

Performs the & operation. Read more
Source§

impl BitOr for I24

Source§

type Output = I24

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self

Performs the | operation. Read more
Source§

impl BitXor for I24

Source§

type Output = I24

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Self) -> Self

Performs the ^ operation. Read more
Source§

impl Clone for I24

Source§

fn clone(&self) -> I24

Returns a copy 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 Debug for I24

Source§

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

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

impl Default for I24

Source§

fn default() -> I24

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

impl Div for I24

Source§

type Output = I24

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
Source§

impl From<I20> for I24

Source§

fn from(other: I20) -> Self

Converts to this type from the input type.
Source§

impl From<I24> for I48

Source§

fn from(other: I24) -> Self

Converts to this type from the input type.
Source§

impl From<U20> for I24

Source§

fn from(other: U20) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for I24

Source§

fn from(other: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for I24

Source§

fn from(val: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for I24

Source§

fn from(other: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for I24

Source§

fn from(other: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for I24

Source§

fn from(other: u8) -> Self

Converts to this type from the input type.
Source§

impl FromSample<I24> for I48

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for U24

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for U48

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for f32

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for f64

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for i16

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for i32

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for i64

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for i8

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for u16

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for u32

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for u64

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I24> for u8

Source§

fn from_sample_(s: I24) -> Self

Source§

impl FromSample<I48> for I24

Source§

fn from_sample_(s: I48) -> Self

Source§

impl FromSample<U24> for I24

Source§

fn from_sample_(s: U24) -> Self

Source§

impl FromSample<U48> for I24

Source§

fn from_sample_(s: U48) -> Self

Source§

impl FromSample<f32> for I24

Source§

fn from_sample_(s: f32) -> Self

Source§

impl FromSample<f64> for I24

Source§

fn from_sample_(s: f64) -> Self

Source§

impl FromSample<i16> for I24

Source§

fn from_sample_(s: i16) -> Self

Source§

impl FromSample<i32> for I24

Source§

fn from_sample_(s: i32) -> Self

Source§

impl FromSample<i64> for I24

Source§

fn from_sample_(s: i64) -> Self

Source§

impl FromSample<i8> for I24

Source§

fn from_sample_(s: i8) -> Self

Source§

impl FromSample<u16> for I24

Source§

fn from_sample_(s: u16) -> Self

Source§

impl FromSample<u32> for I24

Source§

fn from_sample_(s: u32) -> Self

Source§

impl FromSample<u64> for I24

Source§

fn from_sample_(s: u64) -> Self

Source§

impl FromSample<u8> for I24

Source§

fn from_sample_(s: u8) -> Self

Source§

impl Mul for I24

Source§

type Output = I24

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
Source§

impl Neg for I24

Source§

type Output = I24

The resulting type after applying the - operator.
Source§

fn neg(self) -> I24

Performs the unary - operation. Read more
Source§

impl Not for I24

Source§

type Output = I24

The resulting type after applying the ! operator.
Source§

fn not(self) -> I24

Performs the unary ! operation. Read more
Source§

impl Ord for I24

Source§

fn cmp(&self, other: &I24) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for I24

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for I24

Source§

fn partial_cmp(&self, other: &I24) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem for I24

Source§

type Output = I24

The resulting type after applying the % operator.
Source§

fn rem(self, other: Self) -> Self

Performs the % operation. Read more
Source§

impl Sample for I24

Source§

const EQUILIBRIUM: Self = types::i24::EQUILIBRIUM

The equilibrium value for the wave that this Sample type represents. This is normally the value that is equal distance from both the min and max ranges of the sample. Read more
Source§

type Signed = I24

When summing two samples of a signal together, it is necessary for both samples to be represented in some signed format. This associated Addition type represents the format to which Self should be converted for optimal Addition performance. Read more
Source§

type Float = f32

When multiplying two samples of a signal together, it is necessary for both samples to be represented in some signed, floating-point format. This associated Multiplication type represents the format to which Self should be converted for optimal Multiplication performance. Read more
Source§

const IDENTITY: Self::Float = <Self::Float as FloatSample>::IDENTITY

The multiplicative identity of the signal. Read more
Source§

fn to_sample<S>(self) -> S
where Self: ToSample<S>,

Convert self to any type that implements FromSample<Self>. Read more
Source§

fn from_sample<S>(s: S) -> Self
where Self: FromSample<S>,

Create a Self from any type that implements ToSample<Self>. Read more
Source§

fn to_signed_sample(self) -> Self::Signed

Converts self to the equivalent Sample in the associated Signed format. Read more
Source§

fn to_float_sample(self) -> Self::Float

Converts self to the equivalent Sample in the associated Float format. Read more
Source§

fn add_amp(self, amp: Self::Signed) -> Self

Adds (or “offsets”) the amplitude of the Sample by the given signed amplitude. Read more
Source§

fn mul_amp(self, amp: Self::Float) -> Self

Multiplies (or “scales”) the amplitude of the Sample by the given float amplitude. Read more
Source§

impl Shl for I24

Source§

type Output = I24

The resulting type after applying the << operator.
Source§

fn shl(self, other: Self) -> Self

Performs the << operation. Read more
Source§

impl Shr for I24

Source§

type Output = I24

The resulting type after applying the >> operator.
Source§

fn shr(self, other: Self) -> Self

Performs the >> operation. Read more
Source§

impl Sub for I24

Source§

type Output = I24

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl Copy for I24

Source§

impl Eq for I24

Source§

impl SignedSample for I24

Source§

impl StructuralPartialEq for I24

Auto Trait Implementations§

§

impl Freeze for I24

§

impl RefUnwindSafe for I24

§

impl Send for I24

§

impl Sync for I24

§

impl Unpin for I24

§

impl UnwindSafe for I24

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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>,