Skip to content

Fix audio thread stuttering with large midi messages on Windows#1104

Open
JeanVonVarr wants to merge 1 commit intokushview:mainfrom
JeanVonVarr:fix-midi-delay
Open

Fix audio thread stuttering with large midi messages on Windows#1104
JeanVonVarr wants to merge 1 commit intokushview:mainfrom
JeanVonVarr:fix-midi-delay

Conversation

@JeanVonVarr
Copy link
Copy Markdown

Hello,
Thanks for this amazing software!

This PR fixes an audio thread stuttering problem when sending a large midi message on Windows.

When sending a thousand bytes SysEx, the audio thread was kept busy by midiOut->sendBlockOfMessagesNow().
This causes a stuttering of the audio playback, because a 1000 bytes SysEx takes around 32ms to be sent,
hence blocking the audio thread. This is all the more noticeable with several-thousands-bytes SysEx.

This PR almost reverts cf2238c, but uses Time::getMillisecondCounter() instead of Time::getMillisecondCounterHiRes(), as suggested by this juce discussion.
Indeed, ScheduledEventThread::run, which is in charge of sending the midi messages on time, uses Time::getMillisecondCounter() to determine the current timestamp.

I am pretty confident this 'properly' resolves the original commit's issue #493, but I am not able to replicate the exact same setup to validate this. I, however, did not notice any side-effect during my testing.

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant