pub enum CellEvent {
None,
NoteOn {
pitch: Pitch,
velocity: Volume,
},
NoteOnGhost {
pitch: Pitch,
velocity: Volume,
},
InstrReset,
NoteOff {
retrig: bool,
},
NoteCut,
NoteFade,
}Expand description
Unified pattern-cell event.
The variants encode every (note column, instrument column)
combination an XM/IT/S3M/MOD cell can carry, plus the
ghost-vs-fresh distinction (whether the instrument column was
non-empty on the trigger row).
| Variant | Note source | Instr-col source |
|---|---|---|
Self::None | Empty | absent |
Self::NoteOn | Play(p) | present |
Self::NoteOnGhost | Play(p) | absent |
Self::InstrReset | Empty | present |
Self::NoteOff { retrig: false } | KeyOff (===) | absent |
Self::NoteOff { retrig: true } | KeyOff (===) | present |
Self::NoteCut | ^^^ | * |
Self::NoteFade | ~~~ | * |
NoteOff::retrig is a semantic distinction, not a quirk.
=== xx with an instrument column re-triggers the instrument
and then immediately fires key_off: a one-tick attack followed
by release — universal to XM/IT/S3M.
Variants§
None
Nothing on this cell — both columns empty.
NoteOn
Fresh trigger: play pitch with velocity, reset envelopes
and sample. Instrument column is present; the actual
instrument value comes from Track.instrument.
NoteOnGhost
Ghost trigger: play pitch with velocity without resetting
the live voice (TRIGGER_KEEP_VOLUME). Instrument column is
empty; the current voice is reused for the new pitch.
InstrReset
Instrument column present but note column empty:
reload instrument defaults without re-pitching.
Drives tick0_change_instr(true) on the channel.
NoteOff
Release (KeyOff column, ===).
retrig = false (no instrument column): plain key_off(0).
retrig = true (instrument column present): re-trigger the
instrument with KEEP_PERIOD, then key_off(0) — a click
attack followed by release on the same row. Universal to
XM/IT/S3M.
NoteCut
Hard cut (^^^). Volume → 0 immediately. The actual cut work
happens via the row’s TrackEffect::NoteCut effect; the
note-column ^^^ is inert at dispatch.
NoteFade
Start fadeout without releasing the envelope (~~~). IT-style
note-column event; behaves identically regardless of
instrument-column state.
Implementations§
Source§impl CellEvent
impl CellEvent
Sourcepub fn from_columns(
note: CellNote,
instrument: Option<usize>,
velocity: Volume,
) -> Self
pub fn from_columns( note: CellNote, instrument: Option<usize>, velocity: Volume, ) -> Self
Build a CellEvent from the three pattern-editor columns:
note, instrument, velocity.
This is the single mapping site between the column-oriented
representation (still used by importers and pattern-editor
UIs) and the typed variant. See
crate::tracker::import::unit::TrackImportUnit for the
importer-side column trio.
Sourcepub fn velocity(&self) -> Volume
pub fn velocity(&self) -> Volume
Trigger velocity for Self::NoteOn / Self::NoteOnGhost.
Volume::FULL for any other variant — non-trigger cells have
no meaningful velocity, and downstream code that always
multiplies by velocity sees a no-op.
Sourcepub fn has_instrument_column(&self) -> bool
pub fn has_instrument_column(&self) -> bool
true when the originating cell had a non-empty instrument
column.
Sourcepub fn is_trigger(&self) -> bool
pub fn is_trigger(&self) -> bool
true for variants that fire a fresh playback trigger
(NoteOn / NoteOnGhost).
Sourcepub fn is_release(&self) -> bool
pub fn is_release(&self) -> bool
true for variants that release / cut / fade the held note
(NoteOff / NoteCut / NoteFade).
Sourcepub fn to_cell_note(&self) -> CellNote
pub fn to_cell_note(&self) -> CellNote
Project onto a CellNote enum (note-column only). Useful
for debug printers and UI code that surfaces the
soundtracker-style --- / C-5 / === / ^^^ / ~~~ notation.
Lossy: discards the retrig flag of Self::NoteOff and
flattens Self::InstrReset back onto CellNote::Empty.