What is the purpose of the AudioProcessorValueTreeState::Parameter::state member?


#1

I am trying to understand the inner workings of the AudioProcessorValueTreeState class and in particular how it interacts with the ValueTree.
I have now stumbled over the Parameter::state member object (another ValueTree) and I don’t get what its purpose is.
Under what circumstances would I use this isolated value tree object to control the parameter?
Is it a stub or a placeholder? Is anybody using it?
Thanks!


#2

Let’s say you’d like to store custom payload. For example UI state. Something which isn’t an exposed parameter.

The access to the value tree allows you to simplify loading / saving.


#3

Isn’t the AudioProcessorValueTreeState::state ValueTree meant to be used for that? I can’t see how the AudioProcessorValueTreeState::Parameter::state is accessible for serialization and how this would make any sense.

I have now dug a bit deeper and it seems like AudioProcessorValueTreeState::getParameterAsValue is the only public function that accesses the Parameter::state. I still don’t get why it does not use the respective leaf of the AudioProcessorValueTreeState::state. To me it looks like it stores the same information.


#4

I think it stores part of the global state, with just the leaf you need for your parameter. This way, you can easily check if the new update needs to apply to your parameter.
It is still quite heavy, so that’s why I don’t like having the check for parameter change inside the processing function!


#5

Ahh sorry didn’t see the extra ::Parameter. :frowning: