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
impl Chunk
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Chunk, String>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Chunk, String>
Load file for use as a sample.
Sourcepub fn from_raw_buffer<T: AudioFormatNum>(
buffer: Box<[T]>,
) -> Result<Chunk, String>
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.
Sourcepub fn set_volume(&mut self, volume: i32) -> i32
pub fn set_volume(&mut self, volume: i32) -> i32
Set chunk->volume to volume.
Sourcepub fn get_volume(&self) -> i32
pub fn get_volume(&self) -> i32
current volume for the chunk.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more