ScopedPointer<AudioFormatReader> in a value tree state?

Hello everyone and thank you for your time, For a school project I am coding vst.
I would like to know if it’s possible to link a scopedPointer

Hi, there are a few things to consider. The first is that ScopedPointer has been deprecated, meaning it’s no longer available to use. Normally you would replace this with a std::unique_ptr.

This video should help get you moving in the right direction. Good luck and let us know if you get stuck.

Thank you for your answer, I watched the video and i understand how does it work ! but For my project I would like to attach a File or an absolute path, and I don’t know how to do it with the value tree state because here he just attachs int pointer or float pointer.
thanks !
have a good day !

You wouldn’t want to connect a File to your ValueTree - the value trees are simply for holding the parameters a user can adjust in your app. Here’s a video on loading and playing a file.

yes I know how it works ! But My project is to build a SoundSynthesiser with a draggable button, So I would like to connect my textButton with the synthesiser and I don’t know how to do it… I would like to change the wav played within my synthesiser when I drag a wav on my button.

That isn’t really so. The ValueTree in the AudioProcessorValueTreeState can hold any data besides the parameters. For example storing a file path in that is pretty trivial :


If you want to make a tutorial video about this kind of custom state, the plugin editor’s size in a resizeable plugin would be a pretty easy thing to demonstrate. It doesn’t really make sense to have the size stored as normal plugin parameters but one would instead have the size in the ValueTree properties that are not connected to the plugin parameters. (Might be a good idea to have a child ValueTree for the custom data, like was mentioned by Daniel below.)

1 Like

The AudioProcessorValueTreeState is not only too long to type, it is also misleading:

The AudioProcessorValueTreeState holds a flat list of parameters exposed to the host.
Additionally it has a tree structure to allow parameter groups.

Completely separate it HAS (not is) a ValueTree, that is holding the current values of the parameters, and that allows the developer to add their own settings, that are not exposed to the host, but are saved in the session.

The internal ValueTree is exposed as public member state and can be used to attach your information, like @Xenakios wrote in the previous post.

I would encourage to use getOrCreateChildWithName() and not pollute the top level with your own properties, just in case. There is no mechanism to prevent name clashes, afaik.

Thank you for yours answers, so it could be possible to attach a file to the value tree state. But I don’t really understand how to do it. I have AudioProcessorValueTreeState parameters; in my plugin processor but I don’t know how to inizialise it. Because the constructor need parameter layout and I don’t have it. thanks !

Have a look at this tutorial:

If you don’t need parameters to be automated, an empty {} as 4th argument (or just ParameterLayout()) would do as well

Thank you for the correction! :smiley:

thank you for your help, But I have a problem, I created a draggable textbutton with a string wich represent the path to the file dropped.But How could I attach this parameters of the button to the value tree state ? because I want to change the sound if an other wav file is dropped on my button. Thank you !