I would like to know when sound playback ends for MIDI files. Is there a means of coding an equivalent for FMUSIC to FSOUND_Stream_SetEndCallback?

Can anyone provide a code sample, preferably in Delphi, for determining the duration in milliseconds of a MIDI? I’ve looked at the discussion on the board, but I know nothing about the FMUSIC terminology.