A tempo event (from the Midi File 1.0 specification). This event cannot be sent to external Midi devices.
typeTempo events have one field.
0
- A tempo value in microseconds/Midi quarter-note 0 to 127. (Field size : 4 bytes)
Creates a typeTempo event from a floating point tempo value in quarter-notes per minutes. Returns a pointer to the event or NIL if there is not enough memory space.
MidiEvPtr TempoChange ( long date, float tempo) { MidiEvPtr e; if ( e = MidiNewEv(typeTempo)) /* Allocate a new event. Check not NIL* / { Date(e) = date; MidiSetField(e, 0, (long)(60000000.0 / tempo)); } return e; }
Converts a tempo event in microseconds per quarter-note in to a floating point tempo value in quarter-notes per minutes.
float GetTempo (MidiEvPtr e) { return 60000000.0 / (float) MidiGetField(e,0); }