devela::_dep::symphonia::core::sample

Trait Sample

pub trait Sample:
    Sized
    + Copy
    + Clone
    + Add<Output = Self>
    + Sub<Output = Self>
    + Default
    + PartialOrd
    + PartialEq {
    const FORMAT: SampleFormat;
    const EFF_BITS: u32;
    const MID: Self;

    // Required method
    fn clamped(self) -> Self;
}
Available on crate feature dep_symphonia only.
Expand description

Sample provides a common interface for manipulating sample’s regardless of the underlying data type. Additionally, Sample provides information regarding the format of underlying data types representing the sample when in memory, but also when exported.

Required Associated Constants§

const FORMAT: SampleFormat

A unique enum value representing the sample format. This constant may be used to dynamically choose how to process the sample at runtime.

const EFF_BITS: u32

The effective number of bits of the valid (clamped) sample range. Quantifies the dynamic range of the sample format in bits.

const MID: Self

The mid-point value between the maximum and minimum sample value. If a sample is set to this value it is silent.

Required Methods§

fn clamped(self) -> Self

If the sample format does not use the full range of the underlying data type, returns the sample clamped to the valid range. Otherwise, returns the sample unchanged.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl Sample for f32

§

const FORMAT: SampleFormat = SampleFormat::F32

§

const EFF_BITS: u32 = 24u32

§

const MID: f32 = 0f32

§

fn clamped(self) -> f32

§

impl Sample for f64

§

const FORMAT: SampleFormat = SampleFormat::F64

§

const EFF_BITS: u32 = 53u32

§

const MID: f64 = 0f64

§

fn clamped(self) -> f64

§

impl Sample for i8

§

const FORMAT: SampleFormat = SampleFormat::S8

§

const EFF_BITS: u32 = 8u32

§

const MID: i8 = 0i8

§

fn clamped(self) -> i8

§

impl Sample for i16

§

const FORMAT: SampleFormat = SampleFormat::S16

§

const EFF_BITS: u32 = 16u32

§

const MID: i16 = 0i16

§

fn clamped(self) -> i16

§

impl Sample for i32

§

const FORMAT: SampleFormat = SampleFormat::S32

§

const EFF_BITS: u32 = 32u32

§

const MID: i32 = 0i32

§

fn clamped(self) -> i32

§

impl Sample for u8

§

const FORMAT: SampleFormat = SampleFormat::U8

§

const EFF_BITS: u32 = 8u32

§

const MID: u8 = 128u8

§

fn clamped(self) -> u8

§

impl Sample for u16

§

const FORMAT: SampleFormat = SampleFormat::U16

§

const EFF_BITS: u32 = 16u32

§

const MID: u16 = 32_768u16

§

fn clamped(self) -> u16

§

impl Sample for u32

§

const FORMAT: SampleFormat = SampleFormat::U32

§

const EFF_BITS: u32 = 32u32

§

const MID: u32 = 2_147_483_648u32

§

fn clamped(self) -> u32

Implementors§

§

impl Sample for i24

§

const FORMAT: SampleFormat = SampleFormat::S24

§

const EFF_BITS: u32 = 24u32

§

const MID: i24

§

impl Sample for u24

§

const FORMAT: SampleFormat = SampleFormat::U24

§

const EFF_BITS: u32 = 24u32

§

const MID: u24