BOOST XML JUCE


#21

Look for a member of type AudioProcessorValueTreeState in the AudioProcessor subclass. If it’s not there, then you need to add it yourself. (Projucer does not add it by default because there are multiple ways to deal with the plugin parameters/states.) But if you are following the AudioProcessorValueTreeState plugin tutorial, the tutorial class should have it…


#22

The AudioProcessorValueTreeState is an optional class, that is intended to enhance the AudioProcessor’s handling of Parameters exposed to the host, as well as providing a public ValueTree member, where your additional parameters, that are not automated by the host (e.g. because they are of a kind the host wouldn’t understand, like in your case).
This makes it easy to serialise the plugin’s state in one go for the host to save and restore it later using getStateInformation and setStateInformation.

To use the AudioProcessorValueTreeState, create one member of this type in your AudioProcessor (this procedure is called aggregation).

The way, how the automated parameters are added was recently changed, have a look in this thread: “AudioProcessorValueTreeState Improvements”.

After that to add your own information to the state member of that AudioProcessorValueTreeState, like @Xenakios explained.


#23

Thanks Senseis @xenakios and @daniel !
That should keep me going for a while!


#24

I have been on tour away from all this …
At the moment my constructor looks like this

WayloChorder3AudioProcessor::WayloChorder3AudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
     : AudioProcessor (BusesProperties()
                     #if ! JucePlugin_IsMidiEffect
                      #if ! JucePlugin_IsSynth
                       .withInput  ("Input",  AudioChannelSet::stereo(), true)
                      #endif
                       .withOutput ("Output", AudioChannelSet::stereo(), true)
                     #endif
                       )
#endif
{
    AudioProcessorValueTreeState parameters(*this, nullptr);
    parameters.state.addChild(makeChordValueTree("Cmaj", {60,64,67}), -1, nullptr);
    parameters.state.addChild(makeChordValueTree("Cmin", {60,63,67}), -1, nullptr);
   
}

WayloChorder3AudioProcessor::~WayloChorder3AudioProcessor()
{
}

It uses a method I added :

ValueTree WayloChorder3AudioProcessor::makeChordValueTree(String name, std::initializer_list<int> notes)
{
    ValueTree result(name);
    for (size_t i=0;i<notes.size();++i)
        result.setProperty("note_"+String(i), *(notes.begin()+i), nullptr);
    return result;
}

I just instantiated that member class directly in the constructor without declaring it in the header file.

I assume I will now be able to see that data structure from inside the process block and use it.

Do I need a pointer to it in the editor class to access it from over there ?

Is that what you folks suggested ?

The tutorial on the AudioProcessorValueTreeState didn’t help much …

Thanks for all your help !
Sean


#25

No. How would that work? The AudioProcessorValueTreeState you added is a local variable in the constructor. For object scoped variables (that is, to be visible in the class’s methods) you need to have them as class members.