pub struct MidiInstrumentModel {
pub program: Option<u8>,
pub channel: Option<u8>,
pub volume_cc: Option<u8>,
pub pan_cc: Option<u8>,
pub midi_unpitched: Option<u8>,
pub span: Span,
}Expand description
A score-level MIDI instrument projected from a voice’s %%MIDI program /
channel / control / midi-unpitched directives.
%%MIDI is an abc2midi convention, not part of ABC 2.1; the score-meaningful
fields (instrument identity, channel, CC7 volume, CC10 pan, unpitched
percussion key) are
forward-translated to MusicXML <score-instrument> / <midi-instrument>
while the raw directive text stays in ScoreMetadata::preserved_directives
for round-trip / formatter use.
Fields§
§program: Option<u8>General MIDI program number exactly as written in the directive
(0-based, abc2midi/GM convention). The MusicXML <midi-program> is this
value plus one (1-based). None when no program was declared.
channel: Option<u8>MIDI channel (1-16) from the two-integer program <chan> <prog> form or
a sibling %%MIDI channel directive in the same voice. None when no
channel was declared.
volume_cc: Option<u8>MIDI CC7 (channel volume) value 0-127 from %%MIDI control 7 <n>,
rendered as <midi-instrument><volume> (n / 1.27). None when unset.
pan_cc: Option<u8>MIDI CC10 (pan) value 0-127 from %%MIDI control 10 <n>, rendered as
<midi-instrument><pan> (n / 127 * 180 - 90). None when unset.
midi_unpitched: Option<u8>MusicXML <midi-unpitched> value for unpitched percussion playback
(1-128). None when the instrument is pitched or unspecified.
span: SpanSource span of the directive that last set this instrument.
Implementations§
Source§impl MidiInstrumentModel
impl MidiInstrumentModel
Sourcepub fn has_content(&self) -> bool
pub fn has_content(&self) -> bool
True when this projection carries at least one field worth emitting as a
MusicXML <score-instrument> / <midi-instrument>.