[][src]Struct sdl2::mixer::Chunk

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

The internal format for an audio chunk.

Fields

raw: *mut Mix_Chunkowned: bool

Methods

impl Chunk[src]

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

Load file for use as a sample.

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

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.

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

Set chunk->volume to volume.

pub fn get_volume(&self) -> i32[src]

current volume for the chunk.

Trait Implementations

impl Drop for Chunk[src]

impl PartialEq<Chunk> for Chunk[src]

impl StructuralPartialEq for Chunk[src]

Auto Trait Implementations

impl RefUnwindSafe for Chunk

impl !Send for Chunk

impl !Sync for Chunk

impl Unpin for Chunk

impl UnwindSafe for Chunk

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.