pub struct MusicNoteComponent {
pub note: MusicNote,
pub target_source: Option<ComponentRef>,
pub target_resolved: Option<ComponentId>,
pub scheduled_beat: Option<f64>,
pub play_on_attach: bool,
/* private fields */
}Fields§
§note: MusicNote§target_source: Option<ComponentRef>Pre-authored target audio source (audio_source per spec §6.4.1).
Durable ref preserved through serde / MMS dump. target_resolved is
the runtime cache filled by resolve_target. When both are None,
dispatch falls back to ancestor-walk per docs/spec/audio-sources.md
§6.6 rank 5 (the executor caches the result back here).
target_resolved: Option<ComponentId>Runtime cache of the resolved target. Skipped by serde — fresh
loads re-resolve from target_source (or ancestor walk) on first
use, then this stays populated.
scheduled_beat: Option<f64>Pre-authored default beat (scheduled_beat per spec §6.4.1). When
None, .play() fires immediately (beat_offset = 0).
play_on_attach: boolFire AudioSchedulePlay automatically when this component initializes.
Defaults to false — silent unless explicitly triggered.
Implementations§
Source§impl MusicNoteComponent
impl MusicNoteComponent
pub fn new(note: MusicNote) -> Self
pub fn from_note(note: MusicNote) -> Self
pub fn with_target_source(self, source: ComponentRef) -> Self
pub fn with_scheduled_beat(self, beat: f64) -> Self
pub fn with_play_on_attach(self, on: bool) -> Self
pub fn id(&self) -> Option<ComponentId>
Sourcepub fn resolve_target(&mut self, world: &mut World) -> Option<ComponentId>
pub fn resolve_target(&mut self, world: &mut World) -> Option<ComponentId>
Resolve a target for this note following the current runtime
precedence: cached → explicit target_source (Guid/Query).
Returns None when nothing resolves — the executor’s subtree /
ancestor audio-source walk handles that case and writes the result
back to target_resolved afterward.
Trait Implementations§
Source§impl Clone for MusicNoteComponent
impl Clone for MusicNoteComponent
Source§fn clone(&self) -> MusicNoteComponent
fn clone(&self) -> MusicNoteComponent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for MusicNoteComponent
impl Component for MusicNoteComponent
fn set_id(&mut self, component: ComponentId)
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn init(&mut self, emit: &mut dyn SignalEmitter, component: ComponentId)
fn init(&mut self, emit: &mut dyn SignalEmitter, component: ComponentId)
Source§fn to_mms_ast(&self, _world: &World) -> ComponentExpression
fn to_mms_ast(&self, _world: &World) -> ComponentExpression
Source§fn cleanup(&mut self, _emit: &mut dyn SignalEmitter, _component: ComponentId)
fn cleanup(&mut self, _emit: &mut dyn SignalEmitter, _component: ComponentId)
Source§impl Debug for MusicNoteComponent
impl Debug for MusicNoteComponent
Source§impl Default for MusicNoteComponent
impl Default for MusicNoteComponent
Source§impl<'de> Deserialize<'de> for MusicNoteComponent
impl<'de> Deserialize<'de> for MusicNoteComponent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for MusicNoteComponent
impl RefUnwindSafe for MusicNoteComponent
impl Send for MusicNoteComponent
impl Sync for MusicNoteComponent
impl Unpin for MusicNoteComponent
impl UnsafeUnpin for MusicNoteComponent
impl UnwindSafe for MusicNoteComponent
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.