Florian Schmidt wrote:
Another approach, that works very well in my experience, is to not sleep the total required time until the next event, but rather regularly sleep for very short amounts of time (< 1ms), wakeup, measure the current time and if any event time now lies in the past, simply play it back immediately. This way the sleep time doesn't need to be accurate at all. All that's needed is that it's small enough to get some decent timing.
I've now finished implementing this approach, sleeping around 10000 microseconds instead of less than 1ms, and it works very well! Thanks!
I'm getting very decent timing even with complicated MIDI files that have numerous pitch bends at very short times.
I'm about to try your other suggestions later on.
Thank you very much.
Regards, Flo
Best Regards,
Carlo