Jump to content

Programming Reference:MidiPlayer Class

From BCI2000 Wiki
Revision as of 12:33, 16 June 2008 by Mellinger (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Synopsis

The MidiPlayer class provides MIDI output on the level of individual notes, and sequences of notes.

Methods

Default Constructor, Copy Constructors, Assignment Operator, Destructor

These provide the full set of methods required to use MidiPlayer as a data type in STL containers, such as std::vector<MidiPlayer>.

MidiPlayer(instrument, volume, note, note length, balance)

This constructor creates a MidiPlayer object that plays a certain instrument at a given volume. Optionally, a default note, note length, and balance may be specified.

Play( note, length, velocity )

Plays a single note with given length and velocity. All arguments are optional; when unspecified, the default is used.

PlaySequence(sequence)

Plays a sequence of MIDI notes. The sequence is given as an array of struct MidiNote type records. A MidiNote record has a "note" field which describes the MIDI note to play, and a "duration" field which describes the note's duration in ms. A note field of -1 indicates a pause, a duration field of 0 indicates the end of a sequence.

StopSequence

Stops sequence playback. When no sequence is being played, this method does nothing.

See also

Programming Reference:TextToSpeech Class, Programming Reference:WavePlayer Class