AudioProcessirValueTreeState question

Hi JUCE friends.

I have a quick question regarding APVTS and audio plugins. Whats the recommendation on using multiple APVTS in one plugin? Working on a plugin that has several “submodules” (wrapped in one process call) and consider having 1 APVTS per “submodule”, are there any issues with that or better to just have everything in one APVTS?

Thanks

E

What I do in this situation is to share the reference to the master APVTS and have a static createParameterLayout() for each sub processor, that I put in a sub group each.

I would definitely advise against having several instances of APVTS, since it handles the communication to the host, and I don’t think multiple of them would play together.

1 Like

Thanks for the info, I will use only one then for this! Thanks again!

Short follow up question.

For float parameters, looking at the examples online its done like:
float* myParam = apvts.getRawParameterValue("param");
to get reference to the value and not have to check it / update it in the processBlock(…) function.

How is this done with boolean values?

bool enable = apvts.getParameterAsValue("enable").getValue(); ? or is there a better way?

Thanks

E

Use a dynamic_cast:

if (auto boolParam = dynamic_cast<AudioParameterBool*>(apvts.getParameter("enable")))
{
    auto enable = boolParam->get();
}

(Assuming that you used AudioParameterBool when you created the parameter - otherwise the cast will fail.)