Struct Chunk

Source
pub struct Chunk {
    pub raw: *mut Mix_Chunk,
    pub owned: bool,
}
Expand description

The internal format for an audio chunk.

Fields§

§raw: *mut Mix_Chunk§owned: bool

Implementations§

Source§

impl Chunk

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Chunk, String>

Load file for use as a sample.

Source

pub fn from_raw_buffer<T: AudioFormatNum>( buffer: Box<[T]>, ) -> Result<Chunk, String>

Load chunk from a buffer containing raw audio data in the mixer format. The length of the buffer has to fit in 32-bit unsigned integer. The chunk takes ownership of the buffer.

It’s your responsibility to provide the audio data in the right format, as no conversion will take place when using this method.

Source

pub fn set_volume(&mut self, volume: i32) -> i32

Set chunk->volume to volume.

Source

pub fn get_volume(&self) -> i32

current volume for the chunk.

Trait Implementations§

Source§

impl Drop for Chunk

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Chunk

Source§

fn eq(&self, other: &Chunk) -> 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 StructuralPartialEq for Chunk

Auto Trait Implementations§

§

impl Freeze for Chunk

§

impl RefUnwindSafe for Chunk

§

impl !Send for Chunk

§

impl !Sync for Chunk

§

impl Unpin for Chunk

§

impl UnwindSafe for Chunk

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>,

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.