# Hosting VST3 with JUCE: getting incorrect parameter reference from specific VST3 plugins

**URL:** <https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441>\
**Category:** Audio Plugins\
**Created:** [June 10, 2021, 3:49pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441 "2021-06-10T15:49:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 10, 2021, 3:49pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/1 "2021-06-10T15:49:14Z")

</div>

Hi,  
we developed a host plugin for VST, AU and VST3. We are using JUCE 6.0.7.  
When hosting specific VST3 plugins (and a few AU) the reference to the parameter given from JUCE when trying to a get a specific parameter is not the parameter chosen.  
We get the parameter reference by clicking on the hosted plugin’s parameter.  
For example, trying to link the Cutoff Freq. it links the LFO rate. Trying to link the Attack, links the Release and so on.

This happens only with **all VST3 U-he plugins and a few AU**. VST2 is linking correctly. Although, U-he plugins link correctly in all DAWs and other hosts.  
We noticed that other hosting plugins/apps made with JUCE have the same issue.

We reached out to U-He and they were kind enough to give us some insights,  
_“The id you’re looking for is the first member of the Steinberg::Vst::ParameterInfo structure you get via AM\_VST3\_Processor::getParameterInfo.”_

It seems that In VST3 the identifying index is defined by “id” field in the Steinberg::Vst::ParameterInfo structure, which can diverge from the order in which parameters are reported to the host.

Any idea of what may be causing this and any advice on how to solve it?

Thank you very much!  
Em

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 10, 2021, 4:12pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/2 "2021-06-10T16:12:52Z")

</div>

I fixed a similar-sounding bug about a month ago:

> <https://github.com/juce-framework/JUCE/commit/f35c2d90e29638ab0b9bd8664d7417a26c23a96c>
>
> Previously, IEditController parameter indices were being used to index
> into the …AudioProcessor parameter array, but these parameter indices are
> not guaranteed to point to the same parameter (parameter groups may
> cause reordering on JUCE's side). Now, we use the IEditController
> indices universally.

Could you try testing with the current JUCE develop branch and see whether the issue is resolved?

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 11, 2021, 1:57pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/3 "2021-06-11T13:57:51Z")

</div>

Thank much, we will try this out and post an update.

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 11, 2021, 6:40pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/4 "2021-06-11T18:40:25Z")

</div>

YES!!!  
that fixed it. We only tested on Windows so far, but will test on Mac tomorrow.  
I think some AUs were having the same issue, i am not sure if this change will fix them as well.  
Will post the findings soon.  
So, from our tests, this fixed the issue with U-He plugins and Fabfilter Pro-Q3 adding a second band (probably because these parameters are added as more bands are added in the plugin)  
Thanks much!

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 11, 2021, 7:13pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/5 "2021-06-11T19:13:33Z")

</div>

Great, glad it seems to solve the issue.

The patch above won’t affect audio unit hosting. If you run into any problems with audio units on the develop branch, please create a new issue and let us know which plugins are broken, and in what way.

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 12, 2021, 6:52pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/6 "2021-06-12T18:52:55Z")

</div>

We tried to build on mac using the JUCE 6.0.8 [4c133c2](https://github.com/juce-framework/JUCE/commit/4c133c281e237971dfbd09e958e8050ca595db70) develop but we get this error:  
JUCE/modules/juce\_audio\_processors/format\_types/juce\_AudioUnitPluginFormat.mm:1304:41: error: no matching constructor for initialization of ‘CFObjectHolder’ (aka ‘CFObjectHolder\<const \_\_CFString \*\>’)  
CFObjectHolder contextName { properties.name.toCFString() };

Any ideas on how to fix this one?  
Thanks much!

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 12, 2021, 8:13pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/7 "2021-06-12T20:13:55Z")

</div>

We’ve not seen that on our CI systems. Which version of Xcode are you using? Which C++ language standard are you targeting?

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 13, 2021, 5:33am UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/8 "2021-06-13T05:33:02Z")

</div>

We are using Xcode 12.5, C++ 20 via cmake on Clion.

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 13, 2021, 8:56am UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/9 "2021-06-13T08:56:56Z")

</div>

We added 2 constructors in juce\_mac\_CFHelpers.h so that we can build.  
CFObjectHolder(CFStringRef pString) {

```
}

CFObjectHolder(CFPropertyListRef pVoid) {

}

```

We were able to build the plugins and tested the original issue with the wrong linked parameters and the problem is resolved.

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [June 19, 2021, 1:50pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/10 "2021-06-19T13:50:27Z")

</div>

A quick update, just to keep in mind in the final release of 6.0.9, we went back to 6.0.7 because some things were not working as expected when using the developer branch of 6.0.8  
The problems were:

1. Our nested menus stopped working, the menu items were showing but did not function on items that had to do with file operations (opening and saving files).
2. Were getting some random crashes when hosting plugins.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 22, 2021, 9:55am UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/11 "2021-06-22T09:55:42Z")

</div>

Thanks for the update. These sound like quite serious issues, and I’d like to try tracking them down. Please can you provide some more details about the broken behaviour, and some steps to reproduce it? For item 1, it would be useful to know see the code snippet you are using to launch the file chooser. For item 2, it would help to know which plugins are causing issues when they are hosted, and whether the crashes are reproducible in other JUCE hosts (such as the AudioPluginHost).

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [August 25, 2021, 5:56am UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/12 "2021-08-25T05:56:35Z")

</div>

We updated to Juce 6.1.0 and this is fixed.  
Thanks much!

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [August 30, 2021, 4:48pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/13 "2021-08-30T16:48:19Z")

</div>

Although when linking parameters the parameter reference is correct,  
AU and VST3 plugins from some vendors (For example, U-He Diva and Arturia Jun-V6) when we change the preset on the hosted plugin, we get a program change notification but the parameter values in the getParameters() array is not updating.  
This problem appeared with JUCE 6.1.0, with 6.0.7 we did not have this issue.  
Do we need to change something in our code to get the updated list of parameters when a preset changes?

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [August 31, 2021, 3:49pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/14 "2021-08-31T15:49:03Z")

</div>

Thanks for reporting, I can reproduce the issue with the VST3 versions of the plugins you mentioned, and I have a potential fix which should be on develop shortly.

I see that parameter values are not updated in the AudioPluginHost when changing presets via the editor in the AU version of Jun-6 V, but I checked with JUCE 6.0.7 and it didn’t work there either. I also tried some other hosts (Reaper, Live, Carla) and those didn’t update their parameter views in response to program changes in the plugin. Logic _does_ seem to update its “smart controls” view when changing programs, but doesn’t update non-automated parameter values displayed in the automation lane.

I’ve spent some time searching and reading the AU documentation, and at the moment it’s not clear how Logic is achieving this. I think I would probably expect changing parameters to trigger an AudioUnitEvent describing the parameter change, but I don’t see this when changing the program in Jun-6 V. If the AU API has an analog to the VST3 `kParamValuesChanged` I haven’t been able to find it yet (if anyone is aware of such a feature, please let me know!).

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [September 1, 2021, 8:39am UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/15 "2021-09-01T08:39:02Z")

</div>

You are correct regarding the AU. We just tested with Jun V6 directly in Ableton and it does not update the linked params when changing presets.  
In Logic 10.6.3, changing presets on the Jun V6 does not change smart controls.  
Also, when moving a smart control does not change the linked parameter, but when moving a linked parameter it does change the smart control.  
For the AU this seems like a problem with the Jun-V6 plugin because it does not work properly in any DAW.

U-He Diva AU in Logic and Ableton does work properly with smart controls/linked parameters and also moving smart controls changes the target parameter and the opposite.  
In our AU host (JUCE 6.0.7 and 6.1.0) Diva AU also changes parameters when presets change.

The problem of not updating params when changing presets in general seems to be only with hosted VST3 plugins.

In our Host using JUCE 6.1.0, when hosting U-he Diva AU, there is still a problem when linking correctly some parameters (not all). For example, when trying to link the Waveform of osc1 it links the Vibrato parameter. When linking Feedback, it links the FM mod source. When hosting Diva VST3 this issue is fixed in 6.1.0.and all parameters link correctly.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [September 1, 2021, 1:13pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/16 "2021-09-01T13:13:53Z")

</div>

Thanks, I took another look at U-He Diva AU in the AudioPluginHost and I think I can reproduce the problem you’re seeing:

- Open the AudioPluginHost and load U-He Diva AU
- Open the plugin’s custom editor, and also the generic parameters view
- Click on “Modifications” in the editor, then change the “OSC FmModSrc” parameter. The equivalent parameter in the generic display _should_ update, but does not.

I’ve put together a potential fix, which will go on develop shortly after the next bufix release in a week or so.

If this issue is different to the problem that you were seeing, please let me know and provide a set of steps to reproduce the problem, ideally in the AudioPluginHost.

---

<div class="post-metadata">

**Author:** ![emenden](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@emenden](https://forum.juce.com/u/emenden)\
**Post date:** [September 1, 2021, 4:59pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/17 "2021-09-01T16:59:15Z")

</div>

I was able to reproduce it in the J6.1.0 AudioPluginHost. Yes, this is part of the problem but not all of it.

Also, it is easy to see it with the Waveform of the first Oscillator. For instance, preset HS Albert Hall Mini, has the triple VCO, move the Waveform of the first Oscillator, it does not move the Shape1 slider in the generic params view.

Here is an unlisted video to take a look [Linking Parameters AU Diva - J6.1.0 - YouTube](https://youtu.be/1v-INj6omN4)

Clicking on Feedback and then on the selected rotary encoder is linking them and automatically gets the parameter name. In this case, instead of getting the name Feedback, it gets the name FreqMod2Src. Moving the linked encoder changes the FreqMod2Src instead of the Feedback param. Moving Feedback on Diva moves the linked encoder, but the movement range is not linear as it should be.  
There is a second example with Waveform. Linking the Waveform, links Vibrato and the encoder now controls Vibrato. Moving the Waveform on Diva, controls the Vibrato encoder of the host.  
This was exactly the problem with VST3 that has been fixed in 6.1.0

---

<div class="post-metadata">

**Author:** ![jchowdhury18](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@jchowdhury18](https://forum.juce.com/u/jchowdhury18)\
**Post date:** [September 5, 2021, 9:32am UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/18 "2021-09-05T09:32:24Z")

</div>

I’m running into an issue (now on JUCE 6.1.0) that seems to be related to this commit. I’m trying to validate my plugin using the [pluginval](https://github.com/Tracktion/pluginval) tool, and the validation for VST3 is failing whenever the plugin calls `updateHostDisplay()` (AU validation passes without issue).

From `updateHostDisplay()`, the VST3 wrapper runs into this code where the program parameter can be updated. The interesting thing here is that `programParameterIndex` is equal to `-1` (not sure why, but it seems like it’s been that way for a long time).

```cpp
if (auto* programParameter = audioProcessor->getProgramParameter())
{
    const auto programParameterIndex = programParameter->getParameterIndex();
    const auto programParameterId = audioProcessor->getProgramParamID();
    const auto currentProgram = pluginInstance->getCurrentProgram();
    const auto paramValue = roundToInt (EditController::normalizedParamToPlain (programParameterId, EditController::getParamNormalized (programParameterId)));

    if (currentProgram != paramValue)
    {
        beginGesture (programParameterId);
        paramChanged (programParameterIndex, programParameterId, EditController::plainParamToNormalized (programParameterId, currentProgram));
        endGesture (programParameterId);

    flags |= Vst::kParamValuesChanged;
    }
}

```

However, when the `paramChanged()` from above get’s called, the parameter index is propagated through to this member function in `CachedParamValues`, where it gets cast to an unsigned int. So now the `-1` becomes a really large. positive number.

```cpp
void set (Steinberg::int32 index, float value) { floatCache.set ((size_t) index, value); }

```

And then finally, in `FloatCache::set()`, the index (which was a negative int, and is now a massive unsigned int) is used to try to index an array, resulting in a crash.

```cpp
void set (size_t index, float value)
{
    jassert (index < size());
    const auto previous = values[index].exchange (value, std::memory_order_relaxed);
    const auto bit = previous == value ? ((FlagType) 0) : ((FlagType) 1 << (index % numFlagBits));
    flags[index / numFlagBits].fetch_or (bit, std::memory_order_acq_rel);
}

```

Anyway, I have a pretty limited understanding of the VST3 wrapper code, but I hope this information is enough to understand where the crash is coming from. Please let me know if there’s more information I could provide that would be helpful.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [September 7, 2021, 2:31pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/19 "2021-09-07T14:31:40Z")

</div>

Thanks for reporting this problem. This patch should fix the issue:

> <https://github.com/juce-framework/JUCE/commit/b2a51eb2538e98f74a629e0cca3eda03bf9f0b27>
>
> Previously, updating the program or bypass parameter could cause an
> out-of-bound…s access into the parameter value cache. This is because
> AudioProcessorParameter::getParameterIndex() was used to index into the
> cache, but the parameter index could be negative for parameters that
> had not been added to the AudioProcessor.
> 
> We now use the appropriate index in the cache for parameters that
> have not been added to the AudioProcessor.

Please try this out and let me know if you encounter any further issues.

---

<div class="post-metadata">

**Author:** ![jchowdhury18](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@jchowdhury18](https://forum.juce.com/u/jchowdhury18)\
**Post date:** [September 7, 2021, 4:33pm UTC](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441/20 "2021-09-07T16:33:35Z")

</div>

Yes, the issue is now fixed on the latest `develop`. Thanks much!

[Next page](https://forum.juce.com/t/hosting-vst3-with-juce-getting-incorrect-parameter-reference-from-specific-vst3-plugins/46441.md?page=2)
