View Single Post
Old 06-04-2019, 04:36 PM   #13
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 343
Default

I think I got this.

I made two changes in IPlugVST3.cpp. The first change is with getParamNormalized(). This is around line 843. I am not sure if this was something I did earlier, but there was code that was commented out. The complete function I have is:
Code:
 ParamValue PLUGIN_API IPlugVST3::getParamNormalized(ParamID tag)
{  
  if (tag == kBypassParam) 
  {
    return (ParamValue) mIsBypassed;
  }
   else if (tag == kPresetParam) 
   {
     return (ParamValue) ToNormalizedParam(mCurrentPresetIdx, 0, NPresets(), 1.);
   }

    
    if (tag >= mPublicParams) return 0.0;
    
  IParam* param = GetParam(tag);

  if (param)
  {
    return param->GetNormalized();
  }

  return 0.0;
}
The second change (and I think what is more of the fix to this problem) is in setParamNormalize(). This is right after the previous function in my code. I added some code to set mCurrentPresetIdx. The complete function is:
Code:
tresult PLUGIN_API IPlugVST3::setParamNormalized(ParamID tag, ParamValue value)
{

	if (tag == kBypassParam)
	{
		mIsBypassed = (bool)value;
		return kResultOk;
	}
	else if (tag == kPresetParam)
	{
		mCurrentPresetIdx = FromNormalizedParam(value, 0, NPresets(), 1.);
		return kResultOk;
	}

    if (tag >= mPublicParams) return kResultFalse;
    
  IParam* param = GetParam(tag);

  if (param)
  {
    param->SetNormalized(value);
    return kResultOk;
  }

  return kResultFalse;
}
Hope it works. I don't think it should affect/break anything else.
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote