# IPlug2-CLAP: Workaround for stagnant controls upon preset change

**URL:** <https://iplug2.discourse.group/t/iplug2-clap-workaround-for-stagnant-controls-upon-preset-change/687>\
**Category:** Uncategorized\
**Created:** [8 August 2022 23:43 UTC](https://iplug2.discourse.group/t/iplug2-clap-workaround-for-stagnant-controls-upon-preset-change/687 "2022-08-08T23:43:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Matt](https://iplug2.discourse.group/u/Matt)\
**Post date:** [8 August 2022 23:43 UTC](https://iplug2.discourse.group/t/iplug2-clap-workaround-for-stagnant-controls-upon-preset-change/687/1 "2022-08-08T23:43:12Z")

</div>

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:

```auto
#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:

```auto
#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! 🙂

---

<div class="post-metadata">

**Author:** ![Matt](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Matt](https://iplug2.discourse.group/u/Matt)\
**Post date:** [21 August 2022 16:50 UTC](https://iplug2.discourse.group/t/iplug2-clap-workaround-for-stagnant-controls-upon-preset-change/687/2 "2022-08-21T16:50:34Z")

</div>

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