pub struct GameAudioContext { /* private fields */ }Expand description
A wrapper around the Web Audio API AudioContext providing
game engine audio playback and volume management.
Implementations§
Source§impl GameAudioContext
Implements audio context management for GameAudioContext.
impl GameAudioContext
Implements audio context management for GameAudioContext.
Sourcepub fn create() -> Option<GameAudioContext>
pub fn create() -> Option<GameAudioContext>
Creates a new audio context with default master volume.
§Returns
Option<GameAudioContext>- The new audio context, orNonewhen the browser does not expose a WebAudioAudioContext.
Sourcepub fn apply_master_volume(&self, volume: f64)
pub fn apply_master_volume(&self, volume: f64)
Sets the master volume for all audio output.
§Arguments
f64- The volume level in the range 0.0 to 1.0.
Sourcepub fn sample_rate(&self) -> f64
pub fn sample_rate(&self) -> f64
Sourcepub fn current_time(&self) -> f64
pub fn current_time(&self) -> f64
Source§impl GameAudioContext
impl GameAudioContext
pub fn get_mut_context(&mut self) -> &mut AudioContext
pub fn get_mut_master_gain(&mut self) -> &mut GainNode
pub fn get_master_volume(&self) -> f64
pub fn get_mut_master_volume(&mut self) -> &mut f64
pub fn set_master_volume(&mut self, val: f64) -> &mut Self
Source§impl GameAudioContext
impl GameAudioContext
pub fn new( context: AudioContext, master_gain: GainNode, master_volume: f64, ) -> Self
Trait Implementations§
Source§impl Clone for GameAudioContext
impl Clone for GameAudioContext
Source§fn clone(&self) -> GameAudioContext
fn clone(&self) -> GameAudioContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GameAudioContext
impl RefUnwindSafe for GameAudioContext
impl Send for GameAudioContext
impl Sync for GameAudioContext
impl Unpin for GameAudioContext
impl UnsafeUnpin for GameAudioContext
impl UnwindSafe for GameAudioContext
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