pub enum Instruction {
PlayNote {
midi_note: MidiNote,
len: u32,
channel_id: u8,
},
StartNote {
midi_note: MidiNote,
channel_id: u8,
},
StopNote {
midi_note: MidiNote,
channel_id: u8,
},
SendCC {
channel_id: u8,
parameter: u8,
value: u8,
},
StopAllNotes,
MidiMessage {
midi_message: MidiMessage,
},
Continue,
Start,
Stop,
}Expand description
Represents instructions that can be interpreted and processed by the MidiController.
These instructions are used to generate and send MIDI messages.
Variants§
PlayNote
Plays a note for a specified duration on a given MIDI channel.
Fields
StartNote
Starts playing a MIDI note without specifying a duration.
Requires a corresponding Instruction::StopNote to stop the note.
StopNote
Stops a previously started MIDI note.
Fields
SendCC
Sends a MIDI Control Change (CC) message.
Fields
StopAllNotes
Stops all currently playing notes.
MidiMessage
Sends a raw MIDI message directly.
Fields
midi_message: MidiMessageThe raw MIDI message to send.
Continue
Sends a MIDI Continue message to resume playback.
This instruction is not intended to be called manually.
Prefer calling crate::Context::resume instead.
Start
Sends a MIDI Start message to begin playback from the start.
This instruction is not intended to be called manually.
Prefer calling crate::Context::start instead.
Stop
Sends a MIDI Stop message to halt playback.
This instruction is not intended to be called manually.
Prefer calling crate::Context::pause instead.
Implementations§
Source§impl Instruction
impl Instruction
Sourcepub fn transpose(&mut self, semitones: i8)
pub fn transpose(&mut self, semitones: i8)
Transposes the note in the instruction by the given number of semitones.
This function is only applicable when the Instruction variant is
Instruction::PlayNote, Instruction::StartNote, or Instruction::StopNote.
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more