# IPlug2 controls not affecting Faust DSP params

**URL:** <https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619>\
**Category:** Faust\
**Created:** [10 April 2022 11:49 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619 "2022-04-10T11:49:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ftw](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/ftw/32/278_2.png) [@ftw](https://iplug2.discourse.group/u/ftw)\
**Post date:** [10 April 2022 11:49 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619/1 "2022-04-10T11:49:06Z")

</div>

I am now able to run my Faust instrument inside of an IPlug2 app, and I was able to get far enough to link IPlug params to Faust params and create controls that at least start out matching the DSP defaults. However, changing the controls in the UI does nothing:

> <https://mobile.twitter.com/Minkovsky/status/1512897859716329474>

Relevant code snippets:

```cpp
// near the top of the constructor
  mFaustProcessor.CreateIPlugParameters(this, 0, mFaustProcessor.NParams());
  pushBandParams(0);
  pushBandParams(1);
  pushBandParams(2);
  pushBandParams(4);
  pushBandParams(6);
  pushBandParams(8);
  pushBandParams(10);
  pushBandParams(12);
  pushBandParams(14);
  pushBandParams(16);

// inside mLayoutFunc
    for (auto band = 0; band < mBandParams.size(); band++) {
        auto &bandParamIds = mBandParams.at(band);
        IRECT bandStrip = b.GetGridCell(0, band, 1, mBandParams.size());
        IRECT slider = bandStrip.ReduceFromTop(150);
        pGraphics->AttachControl(new IVSliderControl(slider, bandParamIds.gain, "Gain"));
        IRECT envKnobs = bandStrip.ReduceFromTop(250);
        pGraphics->AttachControl(new IVKnobControl(envKnobs.GetGridCell(0, 0, 4, 1), bandParamIds.attack, "Attack"));
        pGraphics->AttachControl(new IVKnobControl(envKnobs.GetGridCell(1, 0, 4, 1), bandParamIds.decay, "Decay"));
        pGraphics->AttachControl(new IVKnobControl(envKnobs.GetGridCell(2, 0, 4, 1), bandParamIds.sustain, "Sustain"));
        pGraphics->AttachControl(new IVKnobControl(envKnobs.GetGridCell(3, 0, 4, 1), bandParamIds.release, "Release"));
    }

// the helper pushBandParams function. this iterates over all plugin params - initialised by
// mFaustProcessor.CreateIPlugParameters - and builds a map of partial number to param ids
// based on what I called the parameters in the Faust code.
void WeirdOrgan::pushBandParams(int bandId)
{
    std::string gainName = "partial gain " + std::to_string(bandId);
    std::string attackName = "attack " + std::to_string(bandId);
    std::string decayName = "decay " + std::to_string(bandId);
    std::string sustainName = "sustain " + std::to_string(bandId);
    std::string releaseName = "release " + std::to_string(bandId);

    int gainId = -1;
    int attackId = -1;
    int decayId = -1;
    int sustainId = -1;
    int releaseId = -1;
    
    for (int i = 0; i < NParams(); i++) {
        auto name = GetParam(i)->GetName();
        if (gainName.compare(name) == 0) {
            gainId = i;
            continue;
        }
        if (attackName.compare(name) == 0) {
            attackId = i;
            continue;
        }
        if (decayName.compare(name) == 0) {
            decayId = i;
            continue;
        }
        if (sustainName.compare(name) == 0) {
            sustainId = i;
            continue;
        }
        if (releaseName.compare(name) == 0) {
            releaseId = i;
            continue;
        }
    }

    mBandParams.emplace_back(gainId, attackId, decayId, sustainId, releaseId);
}

```

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [10 April 2022 12:25 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619/2 "2022-04-10T12:25:02Z")

</div>

bit hard to see whats wrong. is your source code online?

---

<div class="post-metadata">

**Author:** ![ftw](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/ftw/32/278_2.png) [@ftw](https://iplug2.discourse.group/u/ftw)\
**Post date:** [10 April 2022 12:30 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619/3 "2022-04-10T12:30:59Z")

</div>

C++: [FTWAudioPlugins/WeirdOrgan.cpp at main · FLamparski/FTWAudioPlugins · GitHub](https://github.com/FLamparski/FTWAudioPlugins/blob/main/WeirdOrgan/WeirdOrgan.cpp)  
Faust: [FTWAudioPlugins/WeirdOrgan.dsp at main · FLamparski/FTWAudioPlugins · GitHub](https://github.com/FLamparski/FTWAudioPlugins/blob/main/WeirdOrgan/WeirdOrgan.dsp)

Since I’m building on Windows I’m always using FAUST\_COMPILED, otherwise the plugin always crashes.

I’m also not getting any output from it in a DAW (I’m using Ardour)

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [10 April 2022 14:01 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619/4 "2022-04-10T14:01:51Z")

</div>

It seems your faust dsp has more parameters than the iPlug plug-in. If you comment this check, i think it might work

> <https://github.com/iPlug2/iPlug2/blob/master/IPlug/Extras/Faust/IPlugFaust.cpp#L68>

---

<div class="post-metadata">

**Author:** ![ftw](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/ftw/32/278_2.png) [@ftw](https://iplug2.discourse.group/u/ftw)\
**Post date:** [10 April 2022 15:03 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619/5 "2022-04-10T15:03:55Z")

</div>

I think the zone/parameter confusion theory is right - I added an extra debug message and I’m seeing disagreement between the parameters that IPlug is picking up and the number of zones:

```nohighlight
0 Panic
1 attack 0
2 decay 0
3 freq
4 gate
5 partial gain 0
6 q
7 release 0
8 sustain 0
9 attack 1
10 decay 1
11 partial gain 1
12 release 1
13 sustain 1
14 attack 2
15 decay 2
16 partial gain 2
17 release 2
18 sustain 2
19 attack 4
20 decay 4
21 partial gain 4
22 release 4
23 sustain 4
24 attack 6
25 decay 6
26 partial gain 6
27 release 6
28 sustain 6
29 attack 8
30 decay 8
31 partial gain 8
32 release 8
33 sustain 8
34 attack 10
35 decay 10
36 partial gain 10
37 release 10
38 sustain 10
39 attack 12
40 decay 12
41 partial gain 12
42 release 12
43 sustain 12
44 attack 14
45 decay 14
46 partial gain 14
47 release 14
48 sustain 14
49 attack 16
50 decay 16
51 partial gain 16
52 release 16
53 sustain 16
54 gain
55 volume
number of Faust zones = 83

```

---

<div class="post-metadata">

**Author:** ![ftw](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/ftw/32/278_2.png) [@ftw](https://iplug2.discourse.group/u/ftw)\
**Post date:** [13 April 2022 08:39 UTC](https://iplug2.discourse.group/t/iplug2-controls-not-affecting-faust-dsp-params/619/6 "2022-04-13T08:39:10Z")

</div>

Seems like a bug in Faust actually: [Surprising effects of vgroup/hgroup on how controls and parameters work · Issue #725 · grame-cncm/faust · GitHub](https://github.com/grame-cncm/faust/issues/725)
