If you only want to load and play MIDI files you can use the AdvancedSequencer class.
It is an all-in-one object easy to use and with all the common features of a sequencer. These include:
- Loading MIDI files
- Playing and stopping the file at any time
- Jumping from a time to another, even when playing
- Muting, soloing, transposing, velocity scaling for individual tracks
- MIDI out port assign and time shifting for individual tracks
- Global tempo scaling
- Embeds a MIDIThru object, so you can play along with the sequencer
Here is a simple example of its usage:
int main() {
return 0;
}
Contains the definition of the classes MIDISequencerTrackProcessor and AdvancedSequencer.
An enhanced MIDISequencer, able to directly load and play MIDI files and many more.
Definition: advancedsequencer.h:93
virtual bool Load(const char *fname)
Loads a MIDIFile into the internal MIDIMultiTrack.
virtual void Play()
This is an alias of Start().
Definition: sequencer.h:455
bool IsPlaying() const
Returns true if the callback procedure is active.
Definition: tick.h:92
static void Wait(unsigned int msecs)
Stops the calling thread for the given number of milliseconds.
Definition: timer.h:105
Contains the definition of the MIDITimer class and some other typedef related to MIDI timing.
Here is a more complex example using some of the class features (in a real environment you could do these commands interactively) while the sequencer is playing:
int main() {
return 0;
}
bool SetTrackMute(unsigned int trk_num, bool f)
Mutes/unmutes the given track (it has no effect on others).
bool SetTrackSolo(unsigned int trk_num)
Soloes the given track muting all others.
bool SetTrackTranspose(unsigned int trk_num, int amt)
Sets a transpose amount in semitones for the given track.
unsigned int GetCurrentMeasure() const
Returns the current measure number (first is 0). See Numbering conventions.
virtual bool SetTempoScale(unsigned int scale)
Sets the global tempo scale.
You can see two more elaborated examples that let you interact with the class: