wallabra / matt

MATT (Matrix Tracker) – an experimental matrix-routing tracker format and engine.
MIT License
1 stars 0 forks source link

(MatT Basics) Patterns #2

Open wallabra opened 1 year ago

wallabra commented 1 year ago

Tracks the fleshing out of pattern code.

An Engine will have a list of PatternData, and a list of PatternState.

Whenever a pattern is played, a PatternState is created for that pattern. When it is created, the PatternState produces a brief list of Voice objects, through a function create_init_voices which returns a Vec<Voice> (with ownership) to the Engine above, which appends them to a list.

When the engine ticks, it first ticks each PatternState, letting it update itself from the content of the current row; and then the Engine requests each PatternState to update its corresponding Voice objects (by passing a &mut [Voice] and a &PatternData). Once every Voice object is updated, with information such as command and note and volume (enum NoteCommand and enum VolumeCommand), they are ready to be polled by the "routing pass":

SourceObject → source buffer Tick router Sink buffer → SinkObject