pub struct RaylibAudio(/* private fields */);
Expand description
This token is used to indicate audio is initialized. It’s also used to create Wave
, Sound
, Music
, AudioStream
, and SoundAlias
.
All of those have a lifetime that is bound to RaylibAudio. The compiler will disallow you from using them without ensuring that the RaylibAudio
is present while doing so.
Implementations§
Source§impl RaylibAudio
impl RaylibAudio
Sourcepub fn init_audio_device() -> Result<RaylibAudio, RaylibAudioInitError>
pub fn init_audio_device() -> Result<RaylibAudio, RaylibAudioInitError>
Initializes audio device and context.
Sourcepub fn is_audio_device_ready(&self) -> bool
pub fn is_audio_device_ready(&self) -> bool
Checks if audio device is ready.
Sourcepub fn get_master_volume(&self) -> f32
pub fn get_master_volume(&self) -> f32
Get master volume (listener)
Sourcepub fn set_master_volume(&self, volume: f32)
pub fn set_master_volume(&self, volume: f32)
Sets master volume (listener).
Sourcepub fn set_audio_stream_buffer_size_default(&self, size: i32)
pub fn set_audio_stream_buffer_size_default(&self, size: i32)
Sets default audio buffer size for new audio streams.
Sourcepub fn new_sound<'aud>(&'aud self, filename: &str) -> Result<Sound<'aud>, Error>
pub fn new_sound<'aud>(&'aud self, filename: &str) -> Result<Sound<'aud>, Error>
Loads a new sound from file.
Sourcepub fn new_sound_from_wave<'aud>(
&'aud self,
wave: &Wave<'_>,
) -> Result<Sound<'aud>, Error>
pub fn new_sound_from_wave<'aud>( &'aud self, wave: &Wave<'_>, ) -> Result<Sound<'aud>, Error>
Loads sound from wave data.
Sourcepub fn new_wave<'aud>(&'aud self, filename: &str) -> Result<Wave<'aud>, Error>
pub fn new_wave<'aud>(&'aud self, filename: &str) -> Result<Wave<'aud>, Error>
Loads wave data from file into RAM.
Sourcepub fn new_wave_from_memory<'aud>(
&'aud self,
filetype: &str,
bytes: &[u8],
) -> Result<Wave<'aud>, Error>
pub fn new_wave_from_memory<'aud>( &'aud self, filetype: &str, bytes: &[u8], ) -> Result<Wave<'aud>, Error>
Load wave from memory buffer, fileType refers to extension: i.e. ‘.wav’
Sourcepub fn new_music<'aud>(&'aud self, filename: &str) -> Result<Music<'aud>, Error>
pub fn new_music<'aud>(&'aud self, filename: &str) -> Result<Music<'aud>, Error>
Loads music stream from file.
Sourcepub fn new_music_from_memory<'aud>(
&'aud self,
filetype: &str,
bytes: &Vec<u8>,
) -> Result<Music<'aud>, Error>
pub fn new_music_from_memory<'aud>( &'aud self, filetype: &str, bytes: &Vec<u8>, ) -> Result<Music<'aud>, Error>
Load music stream from data
Sourcepub fn new_audio_stream<'aud>(
&'aud self,
sample_rate: u32,
sample_size: u32,
channels: u32,
) -> AudioStream<'aud>
pub fn new_audio_stream<'aud>( &'aud self, sample_rate: u32, sample_size: u32, channels: u32, ) -> AudioStream<'aud>
Initializes audio stream (to stream raw PCM data).
Trait Implementations§
Source§impl Clone for RaylibAudio
impl Clone for RaylibAudio
Source§fn clone(&self) -> RaylibAudio
fn clone(&self) -> RaylibAudio
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RaylibAudio
impl Debug for RaylibAudio
Auto Trait Implementations§
impl Freeze for RaylibAudio
impl RefUnwindSafe for RaylibAudio
impl Send for RaylibAudio
impl Sync for RaylibAudio
impl Unpin for RaylibAudio
impl UnwindSafe for RaylibAudio
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