SequencerM1

Implements a MIDI v1.0 sequencer.

Since MIDI v2.0 isn't widespread (and seems like I even have to implement my own format) and v1.0 is widespread and still capable enough (even if getting the most out of it needs some klunkiness), I'm creating an internal sequencer for this format too. By using multiple tracks, it's able to interface with multiple modules.

Constructors

this
this(AudioModule[] modules, uint[] routing, ubyte[] routGrp)
Undocumented in source.

Members

Enums

Status
enum Status
Undocumented in source.

Functions

enableLoop
bool enableLoop(bool val)

Enables looping (marked with LOOPBEGIN and LOOPEND), then repeates the MIDI data between these points until either looping gets disabled, or the sequencer gets shut down.

lapseTime
void lapseTime(Duration amount)

Makes the sequencer to go forward by the given amount of time, and emits MIDI commands to the associated modules if the time have reached that point.

openMIDI
void openMIDI(MIDI src)

Loads a MIDI file into the sequencer, and initializes some basic data.

pause
void pause()

Pauses the sequencer. Note: Won't pause states of associated modules.

reset
void reset()

Resets the sequencer.

setTimeDiv
void setTimeDiv(uint usecPerQNote, size_t track)

Sets the time division for the given track

start
void start()

Starts the sequencer.

stop
void stop()

Stops the sequencer.

ticsToDuration
Duration ticsToDuration(int tics, size_t track)

Converts MIDI tics to Duration.

Variables

lp_positionBlock
size_t[] lp_positionBlock;
Undocumented in source.
lp_positionTime
Duration[] lp_positionTime;

Save states for looping.

lp_trackState
ubyte[] lp_trackState;
Undocumented in source.
lp_usecPerTic
uint[] lp_usecPerTic;
Undocumented in source.
modules
AudioModule[] modules;

Module list.

positionBlock
size_t[] positionBlock;

Current event position for all individual tracks.

positionTime
Duration[] positionTime;

Current time position for all individual tracks.

routGrp
ubyte[] routGrp;

Group routing for each module.

routing
uint[] routing;

Routings for multi-track MIDI files.

src
MIDI src;

Source file deconstructed.

status
uint status;

Stores status flags, see enum Status

trackState
ubyte[] trackState;

States of the tracks. Bit 0 : End of track marker has reached.

usecPerTic
uint[] usecPerTic;

Precalculated microseconds per tic (per track) for less complexity.

Inherited Members

From Sequencer

lapseTime
void lapseTime(Duration amount)

Makes the sequencer to go forward by the given amount of time, and emits MIDI commands to the associated modules if the time have reached that point.

Meta