pub struct AudioSystem {
pub oscillators: HashMap<ComponentId, Vec<AudioOscillator>>,
/* private fields */
}Expand description
Audio system.
Minimal implementation today:
- When an
AudioOutputComponentis registered, start a CPAL output stream. - Maintain a monotonically increasing audio clock based on rendered frames.
Fields§
§oscillators: HashMap<ComponentId, Vec<AudioOscillator>>Registered oscillator components and their oscillator lists.
Implementations§
Source§impl AudioSystem
impl AudioSystem
pub fn new() -> Self
pub fn is_active(&self) -> bool
pub fn driver(&self) -> Option<Arc<dyn ClockDriver>>
pub fn update_transport_from_clock(&mut self, beat_now: f64, bpm: f64)
pub fn schedule_graph_swap( &mut self, world: &World, source_root: ComponentId, beat: f64, )
pub fn schedule_audio_op( &mut self, target_component: ComponentId, beat: f64, op: AudioOp, )
pub fn register_audio_output( &mut self, world: &mut World, component: ComponentId, )
pub fn register_audio_oscillator( &mut self, world: &mut World, component: ComponentId, )
pub fn register_audio_buffer_size( &mut self, world: &mut World, component: ComponentId, )
Source§impl AudioSystem
impl AudioSystem
Sourcepub fn mark_audio_graph_dirty(&mut self, world: &World, component: ComponentId)
pub fn mark_audio_graph_dirty(&mut self, world: &World, component: ComponentId)
Record that something in the audio graph changed.
component can be any node in a subtree under an AudioOutputComponent.
Sourcepub fn rebuild_dirty_audio_graphs(&mut self, world: &World)
pub fn rebuild_dirty_audio_graphs(&mut self, world: &World)
Recompile all dirty audio output graphs. Intended to be called once per frame after CommandQueue mutations are applied.
Source§impl AudioSystem
impl AudioSystem
Sourcepub fn drain_decode_completions_public(&mut self, world: &mut World)
pub fn drain_decode_completions_public(&mut self, world: &mut World)
Public wrapper for the internal drain — exposed so SystemWorld
can flush completions after command processing each frame.
Sourcepub fn register_audio_clip(&mut self, world: &mut World, component: ComponentId)
pub fn register_audio_clip(&mut self, world: &mut World, component: ComponentId)
Register an AudioClipComponent for decode + RT playback. Spawns
the decode worker lazily on first call.
Decode is deduplicated by URI hash (asset_key): two clips with
the same URI — or a clip and an .instance_of() clone — share
one decoded buffer on the RT side. Each component still gets its
own RtClipInstance voice via RegisterClipInstance.
Trait Implementations§
Source§impl Debug for AudioSystem
impl Debug for AudioSystem
Source§impl Default for AudioSystem
impl Default for AudioSystem
Source§impl System for AudioSystem
impl System for AudioSystem
fn tick( &mut self, world: &mut World, _visuals: &mut VisualWorld, _input: &InputState, _dt_sec: f32, )
Auto Trait Implementations§
impl !Freeze for AudioSystem
impl !RefUnwindSafe for AudioSystem
impl !Send for AudioSystem
impl !Sync for AudioSystem
impl !UnwindSafe for AudioSystem
impl Unpin for AudioSystem
impl UnsafeUnpin for AudioSystem
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.