BASS_ATTRIB_MIDI_PPQN attribute
The Pulses Per Quarter Note (or ticks per beat) value of a MIDI stream.
BASS_ChannelGetAttribute( HSTREAM handle, BASS_ATTRIB_MIDI_PPQN, float *ppqn );
Parameters
handle | The MIDI stream handle. |
ppqn | The PPQN value. |
Remarks
This attribute is the number of ticks per beat as defined by the MIDI file; it will be 0 for MIDI streams created via BASS_MIDI_StreamCreate. It is also read-only, so cannot be modified via BASS_ChannelSetAttribute.Example
Get the currnet position of a MIDI stream in beats.float ppqn; BASS_ChannelGetAttribute(handle, BASS_ATTRIB_MIDI_PPQN, &ppqn;); // get PPQN value QWORD tick=BASS_ChannelGetPosition(handle, BASS_POS_MIDI_TICK); // get tick position DWORD beat=tick/ppqn; // translate it to beats