Skip to main content

PerformanceIntent

Enum PerformanceIntent 

Source
pub enum PerformanceIntent {
    NoteOn {
        pitch: Pitch,
        velocity: u8,
        channel: Channel,
    },
    NoteOff {
        pitch: Pitch,
        velocity: u8,
        channel: Channel,
    },
    Aftertouch {
        pitch: Pitch,
        pressure: u8,
        channel: Channel,
    },
    PitchBend {
        value: u16,
        channel: Channel,
    },
    Sustain {
        down: bool,
        channel: Channel,
    },
    Sostenuto {
        down: bool,
        channel: Channel,
    },
    AllNotesOff {
        channel: Channel,
    },
    AllSoundOff {
        channel: Channel,
    },
    ResetControllers {
        channel: Channel,
    },
    Parameter {
        target: Symbol,
        value: i64,
    },
    Panic,
}
Expand description

A single live-performance gesture.

Enumerates the MIDI-style intents a PerformanceSource can emit: note triggers, expression controls, the sustain pedal, parameter changes, and an all-notes-off panic.

Variants§

§

NoteOn

Starts a note at the given pitch and velocity on a channel.

Fields

§pitch: Pitch

Pitch of the note.

§velocity: u8

Attack velocity (0..=127).

§channel: Channel

Channel the note plays on.

§

NoteOff

Releases a previously started note.

Fields

§pitch: Pitch

Pitch of the note being released.

§velocity: u8

Release velocity (0..=127).

§channel: Channel

Channel the note plays on.

§

Aftertouch

Applies polyphonic key pressure to a sounding note.

Fields

§pitch: Pitch

Pitch the pressure applies to.

§pressure: u8

Pressure amount (0..=127).

§channel: Channel

Channel the note plays on.

§

PitchBend

Bends pitch on a channel by a 14-bit amount.

Fields

§value: u16

Raw 14-bit bend value (0..=16383).

§channel: Channel

Channel the bend applies to.

§

Sustain

Sets the sustain pedal state on a channel.

Fields

§down: bool

Whether the pedal is depressed.

§channel: Channel

Channel the pedal applies to.

§

Sostenuto

Sets the sostenuto pedal state on a channel.

Fields

§down: bool

Whether the pedal is depressed.

§channel: Channel

Channel the pedal applies to.

§

AllNotesOff

Releases every key-down note on one channel, subject to hold pedals.

Fields

§channel: Channel

Channel whose notes are released.

§

AllSoundOff

Silences every sounding note on one channel immediately.

Fields

§channel: Channel

Channel whose sound is stopped.

§

ResetControllers

Resets channel controllers and releases notes held only by pedals.

Fields

§channel: Channel

Channel whose controller state is reset.

§

Parameter

Sets a named parameter to an integer value.

Fields

§target: Symbol

Symbol naming the parameter target.

§value: i64

New parameter value.

§

Panic

Requests an all-notes-off panic and pedal reset.

Implementations§

Source§

impl PerformanceIntent

Source

pub fn kind_symbol(&self) -> Symbol

Returns the qualified symbol identifying this intent’s kind.

Source

pub fn kind_label(&self) -> &'static str

Returns the short kebab-case label for this intent’s kind.

Source

pub fn to_expr(&self) -> Expr

Encodes this intent as an Expr map keyed by kind and its fields.

Source

pub fn from_expr(expr: &Expr) -> Result<Self>

Decodes an intent from an Expr map produced by to_expr.

Accepts both bare and music/performance-intent-qualified kind labels, and returns an error for non-map exprs or unknown kinds.

Trait Implementations§

Source§

impl Clone for PerformanceIntent

Source§

fn clone(&self) -> PerformanceIntent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PerformanceIntent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PerformanceIntent

Source§

impl PartialEq for PerformanceIntent

Source§

fn eq(&self, other: &PerformanceIntent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PerformanceIntent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.