BASS_MIDI_StreamGetMarks
Retrieves the markers in a MIDI file stream.
DWORD BASS_MIDI_StreamGetMarks(
HSTREAM handle,
int track,
DWORD type,
BASS_MIDI_MARK *marks
);
Parameters
handle | The MIDI stream to retrieve the markers from.
|
track | The track to get the markers from... 0 = 1st track, -1 = all tracks.
|
type | The type of marker to retrieve, one of the following.
BASS_MIDI_MARK_COPY | Copyright notice events (MIDI meta event 2).
| BASS_MIDI_MARK_CUE | Cue events (MIDI meta event 7).
| BASS_MIDI_MARK_INST | Instrument name events (MIDI meta event 4).
| BASS_MIDI_MARK_KEYSIG | Key signature events (MIDI meta event 89). The marker text is in the form of "a b", where a is the number of sharps (if positive) or flats (if negative), and b signifies major (if 0) or minor (if 1).
| BASS_MIDI_MARK_LYRIC | Lyric events (MIDI meta event 5).
| BASS_MIDI_MARK_MARKER | Marker events (MIDI meta event 6).
| BASS_MIDI_MARK_TEXT | Text events (MIDI meta event 1).
| BASS_MIDI_MARK_TIMESIG | Time signature events (MIDI meta event 88). The marker text is in the form of "a/b c d", where a is the numerator, b is the denominator, c is the metronome pulse, and d is the number of 32nd notes per MIDI quarter-note.
| BASS_MIDI_MARK_TRACK | Track name events (MIDI meta event 3).
| BASS_MIDI_MARK_TICK | Flag: Get the marker's position in ticks rather than bytes.
|
|
marks | Pointer to an array to receive the marker details... NULL = get the number of markers without getting the markers themselves.
|
Return value
If successful, the number of markers is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_HANDLE | handle is not valid.
|
BASS_ERROR_ILLTYPE | type is not valid.
|
BASS_ERROR_ILLPARAM | track is not valid.
|
Remarks
This function should first be called with marks = NULL to get the number of markers, before allocating an array of the required size and retrieving the markers.
The markers are ordered chronologically, and by track number (lowest first) if multiple markers have the same position.
Syncs can be used to be informed of when markers are encountered during playback.
If a lyric marker text begins with a / (slash) character, that means a new line should be started. If the text begins with a \ (backslash) character, the display should be cleared. Lyrics can sometimes be found in BASS_MIDI_MARK_TEXT instead of BASS_MIDI_MARK_LYRIC markers.
Example
Retrieve the markers from all tracks in a MIDI stream.
DWORD markc = BASS_MIDI_StreamGetMarks(handle, -1, BASS_MIDI_MARK_MARKER, NULL); // get number of markers
BASS_MIDI_MARK *marks = (BASS_MIDI_MARK*)malloc(markc * sizeof(BASS_MIDI_MARK)); // allocate marker array
BASS_MIDI_StreamGetMarks(handle, -1, BASS_MIDI_MARK_MARKER, marks); // get the markers
See also
BASS_MIDI_StreamCreateFile, BASS_MIDI_StreamGetMark, BASS_MIDI_MARK structure