View Single Post
Old 01-23-2017, 03:48 AM   #7
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
Default

Quote:
Originally Posted by Nowhk View Post
He said: You could try putting the OnParamChange call (in VSTSetParameter) outside the lock. I think that would work., refered to this.

Didn't try yet, but I'm not sure about change those lines
I guess that means FL Studio is calling VSTSetParameter() from the GUI thread... ?

Anyway, maybe something like thid would work then (and hopefully also still work in other hosts):

Code:
void VSTCALLBACK IPlugVST::VSTSetParameter(AEffect *pEffect, VstInt32 idx, float value)
{
  Trace(TRACELOC, "%d:%f", idx, value);
  IPlugVST* _this = (IPlugVST*) pEffect->object;
  bool change = false;
  {
    IMutexLock lock(_this);
    if (idx >= 0 && idx < _this->NParams())
    {
      if (_this->GetGUI())
      {
        _this->GetGUI()->SetParameterFromPlug(idx, value, true);
      }
      _this->GetParam(idx)->SetNormalized(value);
      change = true;
    }
  }
  if (change) _this->OnParamChange(idx);
}
Tale is offline   Reply With Quote