MIDIGetInfo()
can return information about how many tracks are in the loaded MIDI file, what its timebase is, what format it is in, and how many events are in the currently selected track.