View Single Post
Old 09-08-2020, 10:24 AM   #19
Human being with feelings
Join Date: Apr 2018
Posts: 354

Originally Posted by Tale View Post
AFAIK IPlug only uses mutex locks to protect parameters from changing while processing audio. I don't think there are any mutex locks protecting the GUI. So I guess the scenario is:
  1. User clicks control, which toggles control value; it tries to update parameter, but it can't right now, so it waits for mutex to release.
  2. While mutex is still locked control is set to zero (i.e. control value changes, dirty flag is set, but don't push to plug).
  3. Mutex is released, so param is updated to control value from when user clicked on it.

In this scenario the parameter will have the value the user expects it to, but the control value will always end up being zero.
That appears to be the scenario except for your last sentence - the control doesn't always end up zero, it's that it isn't redrawn. The parameter changes but the control bitmap does not.

I have "solved" the problem by redrawing the control upon return to OnParamChange(). It works but seems a band aid for something systemically not right, i.e., why isn't redraw of the control automatically resumed after the audio thread mutex lock is released? The control update is being left in a "half finished" state.

Last edited by Nonlinear; 09-08-2020 at 10:37 AM.
Nonlinear is offline   Reply With Quote