jeroenwalter/managed-midi

TempoChangeRatio of 0.0 is not supported.

jeroenwalter opened this issue · 2 comments

This will cause a divide by zero.
Result is that the music is played at ludicrous speed.

Can be fixed by rewriting the timing mechanism of the MidiEventLooper class. Don't block the thread via WaitBy(ms), but use a timer to increase a tick counter, using the current tempo, every millisecond and then playback all midi events that are expired.
Needs a highres (1m) timer.
The current implementation uses Task.Delay, which is not acceptable here and which brings a lot of overhead.