# AudioProcessorValueTreeState GUI Attachments

**URL:** <https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988>\
**Category:** Audio Plugins\
**Created:** [November 18, 2015, 6:40am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988 "2015-11-18T06:40:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tadnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tadnicol/32/5141_2.png) [@tadnicol](https://forum.juce.com/u/tadnicol)\
**Post date:** [November 18, 2015, 6:40am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/1 "2015-11-18T06:40:33Z")

</div>

I've been experiementing with the new enticing processor parameter managment objects. It looks really promising but I've come accross a vexing issue regarding the gui AudioProcessorValueTreeState gui attachments. It seems that when attaching a slider to the state, AudioProcessor::setParameter(int **parameterIndex** , float newValue) is only invoked upon moving the slider. This would be fine except that I haven't found any way to access the state's parameters via&nbsp; **parameterIndex_.&nbsp;_** It seems that every AudioProcessorValueTreeState method uses the String ID as the "key". Is there something I'm completely disregarding?

Specifically what I&nbsp;have in mind:

- use the given gui attachments

- when AudioProcessor::setParameter() is invoked, take the normalized range [0, 1]&nbsp;and use the NormalisableRange built in to the AudioProcessorValueTreeState::Parameter to map&nbsp; **newValue** to it's full unormalized range. Then call setValue() on the parameter, updating all Listeners of that parameter.

I'd rather not make an array of string IDs and use an enum list to access them. Redundancy is what I'm trying to reduce :) Any tips?

Go juce team!

RP

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [November 18, 2015, 9:31am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/2 "2015-11-18T09:31:00Z")

</div>

IMHO these classes need a whole redesign, sorry, even when it makes things&nbsp;incompatible.

(This classes were just&nbsp;introduced, so i hope there is a chance)

The parameter should be stored as the normalized values (to prevent rounding issues, if the processor sets a value, and gets a different value later)

Instead there should be accessor-functions for the real values. (There could be meta-data like the range, "ID", stored in the Chunk, so if the range

will changed later, the values will be&nbsp;rescaled when the plugin-state is set)

also i think it would be cool&nbsp;if AudioProcessParamterBool/Float/Choice & AudioProcesserValueTreeState would&nbsp;work together

This would be a real benefit.&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [November 18, 2015, 9:37am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/3 "2015-11-18T09:37:03Z")

</div>

Another suggestion i have is

AudioProcessParameterHertz, for a logarithmic storage of a frequency (maybe 0,0001Hz - 192kHz) and something like&nbsp;AudioProcessParameterVolume

---

<div class="post-metadata">

**Author:** ![tadnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tadnicol/32/5141_2.png) [@tadnicol](https://forum.juce.com/u/tadnicol)\
**Post date:** [November 18, 2015, 5:01pm UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/4 "2015-11-18T17:01:06Z")

</div>

In what way do the folks at Roli use the AudioProcessorValueTreeState gui attachments ?

---

<div class="post-metadata">

**Author:** ![radiohunches](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@radiohunches](https://forum.juce.com/u/radiohunches)\
**Post date:** [November 19, 2015, 7:10am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/5 "2015-11-19T07:10:59Z")

</div>

I would also love to see some example code for **AudioProcessorValueTreeState&nbsp;** as well. Perhaps integrated into the audio plugin demo example.

I'm getting hung up on where to store my GUI attachments. I would love to use the **AudioProcessorValueTreeState::addParameterListener** method to manage my attachments but it takes an&nbsp; **AudioProcessorValueTreeState::Listener\*** as a construction argument.&nbsp;The&nbsp; **AudioProcessorValueTreeState::\_\_\_\_\_Attachment** classes themselves are not **Listener** s. They have a private&nbsp; **Pimpl** member which inherits&nbsp; **AudioProcessorValueTreeState::AttachedControlBase** &nbsp;but this cannot be accesed nor instantiated because it is private. How are we expected to use&nbsp; **AudioProcessorValueTreeState::addParameterListener**?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 23, 2015, 11:29am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/6 "2015-11-23T11:29:15Z")

</div>

All of the equator UI widgets use them to control things.

---

<div class="post-metadata">

**Author:** ![tadnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tadnicol/32/5141_2.png) [@tadnicol](https://forum.juce.com/u/tadnicol)\
**Post date:** [November 23, 2015, 11:13pm UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/7 "2015-11-23T23:13:01Z")

</div>

What, then, is **parameterIndex** used for in&nbsp;AudioProcessor::setParameter(int&nbsp; **parameterIndex,** float newValue) in the Equator AudioProcessor?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 24, 2015, 9:34am UTC](https://forum.juce.com/t/audioprocessorvaluetreestate-gui-attachments/15988/8 "2015-11-24T09:34:00Z")

</div>

That's an old way of setting the parameter values - the method will be deprecated eventually, but some people are still using it.
