# AudioProcessirValueTreeState question

**URL:** <https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856>\
**Category:** General JUCE discussion\
**Created:** [August 19, 2019, 3:44pm UTC](https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856 "2019-08-19T15:44:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![refinedmusic](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@refinedmusic](https://forum.juce.com/u/refinedmusic)\
**Post date:** [August 19, 2019, 3:44pm UTC](https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856/1 "2019-08-19T15:44:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [August 19, 2019, 4:12pm UTC](https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856/2 "2019-08-19T16:12:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![refinedmusic](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@refinedmusic](https://forum.juce.com/u/refinedmusic)\
**Post date:** [August 19, 2019, 4:34pm UTC](https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856/3 "2019-08-19T16:34:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![refinedmusic](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@refinedmusic](https://forum.juce.com/u/refinedmusic)\
**Post date:** [August 20, 2019, 2:18pm UTC](https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856/4 "2019-08-20T14:18:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [August 20, 2019, 5:18pm UTC](https://forum.juce.com/t/audioprocessirvaluetreestate-question/34856/5 "2019-08-20T17:18:35Z")

</div>

Use a `dynamic_cast`:

```auto
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.)
