IPlug2-CLAP: Workaround for stagnant controls upon preset change

Hi,

For those wanting to experiment with iPlug2-clap, I made a little temporary workaround for a bug that prevents controls from being updated whenever a preset is chosen.
The signal processing works correctly, it’s just that the controls don’t move when they should.

This is on Windows 10; I don’t know about Mac, I don’t have one.
I have tested this with Reaper, latest CLAP-enabled development branch.
I do not have Bitwig, so I can’t test there.

The workaround is simple:

E.g., in IPlugEffect.h, you would add:

#ifdef CLAP_API
  // Filthy workaround to get the knobs to move on a preset change
  void OnParamChangeUI(int paramIdx, EParamSource source = kUnknown) override;
#endif

Then in IPlugEffect.cpp, you add:

#ifdef CLAP_API
  // Filthy workaround to get the knobs to move on a preset change
  void IPlugEffect::OnParamChangeUI(int paramIdx, EParamSource source) {
    if (source == EParamSource::kPresetRecall) {
      SendParameterValueFromAPI(paramIdx, GetParam(paramIdx)->Value(), false);
    }
  }
#endif

This makes the knobs move!

Please note that iPlug2-clap isn’t really production ready just yet, so just use this for testing, playing around, etc.

Also, once the bug gets fixed, I cannot predict what this workaround will do, so make sure to remove it once that happens.

Have fun! :slightly_smiling_face:

UPDATE: This has now been fixed in iPlug2’s clap branch, by Alex Harker :smiley:
Workaround no longer needed :slight_smile: