Skip to main content

AudioSystem

Struct AudioSystem 

Source
pub struct AudioSystem { /* private fields */ }
Expand description

Sistema de audio con raylib Nota: Sound y Music son structs FFI que contienen pointers internos

Implementations§

Source§

impl AudioSystem

Source

pub fn new() -> Self

Inicializar sistema de audio

Source

pub fn load_sound(&mut self, id: &str, path: &str) -> Result<(), String>

Cargar sonido desde archivo

Source

pub fn play_sound(&self, id: &str) -> bool

Reproducir sonido

Source

pub fn stop_sound(&self, id: &str) -> bool

Detener sonido

Source

pub fn set_sound_volume(&self, id: &str, volume: f32) -> bool

Configurar volumen de sonido (0.0 - 1.0)

Source

pub fn load_music(&mut self, path: &str) -> Result<(), String>

Cargar música desde archivo

Source

pub fn play_music(&mut self)

Reproducir música

Source

pub fn stop_music(&mut self)

Detener música

Source

pub fn update_music(&mut self)

Actualizar música (llamar en cada frame)

Source

pub fn set_music_volume(&mut self, volume: f32)

Configurar volumen de música (0.0 - 1.0)

Source

pub fn is_music_playing(&self) -> bool

Verificar si la música está reproduciendo

Source

pub fn unload_sound(&mut self, id: &str)

Descargar sonido y liberar memoria

Source

pub fn unload_music(&mut self)

Descargar música y liberar memoria

Source

pub fn has_sound(&self, id: &str) -> bool

Verificar si existe un sonido

Source

pub fn sound_count(&self) -> usize

Cantidad de sonidos cargados

Trait Implementations§

Source§

impl Default for AudioSystem

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for AudioSystem

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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.