View Single Post
Old 10-08-2019, 01:09 AM   #2
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Never mind, I took the time to make it build with VST3 3.6.9.

And confirmed the same Reaper-only issue I was seeing with my plugin, which is (for the curious):

Here is the relevant code, from IPlugVST3::process in IPlugVST3.cpp; When recalling a user preset, Reaper first issues a factory preset (note we are recalling a user preset!) command. The value (which should be 0-1, to select a factory preset) is garbage (NaN in this case, but in my own plugin was 0, 1, or a huge negative number which happened to be an interesting bit pattern). RestorePreset will fail if the number doesn't correspond to a factory preset, but it doesn't matter—it either restores a factory preset or fails. Regardless, Reaper then sends parameter changes for all plugin parameter, in order (handled in the default case here).

Code:
case kPresetParam:
  RestorePreset(FromNormalizedParam(value, 0, NPresets(), 1.));
  break;
  //TODO pitch bend, modwheel etc
default:
  if (idx >= 0 && idx < NParams())
  {
    GetParam(idx)->SetNormalized((double)value);
    if (GetGUI()) GetGUI()->SetParameterFromPlug(idx, (double)value, true);
    OnParamChange(idx);
  }
  break;
If anyone wonders, there is no change in behavior if PLUG_DOES_STATE_CHUNKS is set to 1. With 1, you'd expect restoration by chunk, but it never happens. I also played with uncommenting SetState and the various combinations people have tried over the years, with no success. (BTW, Reaper handles factory preset recalls just fine.)

For most plugins, you won't notice the mistake. But I need to restore from chunks, not serial parameter changes for one of my plugins, so it's bad news for me. My plugin works correctly for every other VST3 host I've tried.

Basically, it appears to be a Reaper implementation error that's sensitive to the IPlug(1) VST3 implementation. IPlug2 has a much better implementation, and Reaper doesn't have this issue with it (reaper calls SetState). I have to stick with IPlug1 right now, so next step is to figure how to rewrite IPlugVST3 in a way that makes Reaper happy..
earlevel is offline   Reply With Quote