pub struct MixChunk<'device> { /* private fields */ }
Expand description

A chunk buffer of the audio data.

Implementations§

source§

impl<'device> MixChunk<'device>

source

pub fn new( _device: &'device MixDevice<'device>, file_name: &str ) -> Result<Self>

Constructs a chunk from the file name, or Err on failure.

§Panics

Panics if file_name is empty.

source

pub unsafe fn from_file_bytes_unchecked( _device: &'device MixDevice<'device>, file: &[u8] ) -> Self

Constructs a chunk from the wave file bytes.

§Safety

buf must be a valid WAVE format file bytes. Otherwise the Undefined Behavior occurs.

source

pub unsafe fn from_buf_unchecked( _device: &'device MixDevice<'device>, buf: &'device mut [u8] ) -> Self

Constructs a chunk from the raw wave buffer bytes.

§Safety

buf must be a valid WAVE format buffer bytes. Otherwise the Undefined Behavior occurs.

source

pub fn volume(&self) -> u32

Returns the output volume of the chunk. The volume is in 0..=128.

source

pub fn set_volume(&self, volume: u32)

Sets the output volume of the chunk. The volume is clamped to 0..=128.

Trait Implementations§

source§

impl Drop for MixChunk<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'device> !RefUnwindSafe for MixChunk<'device>

§

impl<'device> !Send for MixChunk<'device>

§

impl<'device> !Sync for MixChunk<'device>

§

impl<'device> Unpin for MixChunk<'device>

§

impl<'device> !UnwindSafe for MixChunk<'device>

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