Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle automation on processing thread #4692

Merged
merged 1 commit into from
Nov 12, 2018

Conversation

DomClark
Copy link
Member

@DomClark DomClark commented Nov 1, 2018

Connections that update values for remote plugins are now all DirectConnections. The result is that changes to these values no longer always come from the main thread, but instead from the thread that changed them, which in the case of automation or controllers will be the processing thread.

This fixes the following issues:

  • Hangs occurring when the project is saved while Zyn or VSTs are being automated. Value updates were sometimes sent while LMMS was waiting to receive the save data from the remote plugin, resulting in a deadlock trying to lock the plugin mutex twice on the same thread. Sending the update on a different thread solves this. (Fixes LMMS hangs when saving project while automating VSTi's pitch #4543, fixes lmms 1.20 r6 crash when lfo controller use #4584.)
  • Stuttering audio during automation of Zyn or VSTs. Since Use tryLock in audio threads for VST/ZynAddSubFX #4460, the plugin mutex is locked using tryLock before getting audio from the remote plugin. If a value was being automated, the main thread was sometimes holding the lock to update the value which caused a buffer of audio to be skipped for the plugin. Sending the automation on the processing thread ensures the updates are finished before audio is rendered. (Fixes VST pitch automation not working #4625.)
  • Choppy/laggy/missing VST automation, especially during export. The automation used to get caught up on the main thread (a problem that was much worse on export), but is now delivered immediately on the processing thread. (I can't find an issue for this, but I've seen it mentioned from time to time on the Discord server.)

if( m.id == IdStartProcessing || m.id == IdMidiEvent )
if( m.id == IdStartProcessing
|| m.id == IdMidiEvent
|| m.id == IdVstSetParameter )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! 👍

@PhysSong
Copy link
Member

PhysSong commented Nov 9, 2018

@DomClark Is it ready to merge?

@DomClark
Copy link
Member Author

DomClark commented Nov 9, 2018

I think so, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants