pub struct MusicalEvent {
pub duration: Duration,
pub content: EventContent,
pub dynamic: Option<Dynamic>,
pub attributes: Vec<Attribute>,
pub offset: Fraction,
}Expand description
A complete musical event with timing, content, and expression information.
This represents any musical occurrence - notes, chords, rests, or sequences of other events. It includes all the information needed to render the event in a musical context.
Fields§
§duration: Duration§content: EventContent§dynamic: Option<Dynamic>§attributes: Vec<Attribute>§offset: FractionImplementations§
Source§impl MusicalEvent
impl MusicalEvent
pub fn note(pitch: Pitch, duration: Duration) -> Self
pub fn chord(chord: Chord, duration: Duration) -> Self
pub fn rest(duration: Duration) -> Self
pub fn set_dynamic(&mut self, dynamic: Dynamic)
pub fn with_dynamic(self, dynamic: Dynamic) -> Self
pub fn add_attribute(&mut self, attribute: Attribute)
pub fn with_attribute(self, attribute: Attribute) -> Self
pub fn set_attributes(&mut self, attributes: Vec<Attribute>)
pub fn with_attributes(self, attributes: Vec<Attribute>) -> Self
pub fn set_offset(&mut self, offset: Fraction)
pub fn with_offset(self, offset: Fraction) -> Self
Sourcepub fn atomic_event_count(&self) -> usize
pub fn atomic_event_count(&self) -> usize
Counts the number of atomic (non-sequence) events contained within this event.
Sourcepub fn total_duration(&self) -> Fraction
pub fn total_duration(&self) -> Fraction
Calculates the total duration including any nested sequences.
Trait Implementations§
Source§impl Clone for MusicalEvent
impl Clone for MusicalEvent
Source§fn clone(&self) -> MusicalEvent
fn clone(&self) -> MusicalEvent
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 moreSource§impl Debug for MusicalEvent
impl Debug for MusicalEvent
Source§impl Invert for MusicalEvent
impl Invert for MusicalEvent
Source§fn invert(&self, axis: &PitchClass) -> Self
fn invert(&self, axis: &PitchClass) -> Self
Inverts the musical object around the specified axis. Read more
Source§impl Invert<Pitch> for MusicalEvent
impl Invert<Pitch> for MusicalEvent
Source§impl PartialEq for MusicalEvent
impl PartialEq for MusicalEvent
Source§fn eq(&self, other: &MusicalEvent) -> bool
fn eq(&self, other: &MusicalEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MusicalEvent
Auto Trait Implementations§
impl Freeze for MusicalEvent
impl RefUnwindSafe for MusicalEvent
impl Send for MusicalEvent
impl Sync for MusicalEvent
impl Unpin for MusicalEvent
impl UnsafeUnpin for MusicalEvent
impl UnwindSafe for MusicalEvent
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