[−][src]Struct riddle_audio::AudioSystem
The Riddle audio system core state.
Manages underlying audio device and riddle audio objects' states. The recommended
way to use this type is to let the riddle
crate initialize and manage it for you.
It is possible to manage the audio system state independantly - the most important
thing to note is that AudioSystem::process_frame
must be called periodically
for ClipPlayer
to work properly. This is not something that needs doing if
using the riddle
crate to manage the AudioSystem
automatically.
Implementations
impl AudioSystem
[src]
pub fn new() -> Result<AudioSystemHandle, AudioError>
[src]
Create the audio system, connected to the default audio output device.
pub fn process_frame(&self)
[src]
Update the system's state.
Updates all ClipPlayer
fades. This must be called periodically for the AudioSystem
to function. Do not call this if the riddle
crate is being used.
Example
let audio_system = AudioSystem::new()?; // Tick the audio system every 100ms let start_time = std::time::Instant::now(); while std::time::Instant::now() - start_time < std::time::Duration::from_secs(2) { audio_system.process_frame(); std::thread::sleep(std::time::Duration::from_millis(100)); }
Trait Implementations
impl CloneHandle for AudioSystem
[src]
type Handle = AudioSystemHandle
The type which represents a strong reference, and which may be dereferenced as Self. Read more
type WeakHandle = AudioSystemWeak
The type which represents a weak reference.
fn clone_handle(&self) -> AudioSystemHandle
[src]
fn clone_weak_handle(&self) -> AudioSystemWeak
[src]
Auto Trait Implementations
impl RefUnwindSafe for AudioSystem
impl Send for AudioSystem
impl Sync for AudioSystem
impl Unpin for AudioSystem
impl UnwindSafe for AudioSystem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,