I’m creating a parameterLayout in my configurationManager class. However this member function of my class doesn’t work:
AudioProcessorValueTreeState::ParameterLayout ConfigurationManager::createParameterLayout()
{
return m_pLayout;
}
The compiler tells me that it is a deleted function. Why is that? The brute-force method of course would be to make my parameterLayout public…
ParameterLayout
cannot be copied because it contains a std::vector<std::unique_ptr>
and std::unique_ptr
cannot be copied.
Now the question is, what exactly are you trying to do?
They’ve disabled the copy constructor for ParameterLayout to signify that they shouldn’t be copied. You could try returning a reference or const reference to the layout in your method. (Or move it to the return value with std::move, but that would make the ConfigurationManager class member m_pLayout invalid for later use…)
ok, that makes sense! I wanted to generate my parameterLayout before calling createParameterLayout(). I will try the reference, thanks!
daniel
March 20, 2019, 1:08pm
5
I found this post from @t0m most helpful:
Here’s one way of doing it:
AudioProcessorValueTreeState::ParameterLayout createParameterLayout()
{
std::vector<std::unique_ptr<AudioParameterInt>> params;
for (int i = 1; i < 9; ++i)
params.push_back (std::make_unique<AudioParameterInt> (String (i), String (i), 0, i, 0));
return { params.begin(), params.end() };
}
YourAudioProcessor()
: parameters (*this, &undoManager, "PARAMS", createParameterLayout())
I use it that way in my open source project:
std::move (gainParameter),
std::move (actvParameter));
params.push_back (std::move (group));
}
return { params.begin(), params.end() };
}
//==============================================================================
FrequalizerAudioProcessor::FrequalizerAudioProcessor() :
#ifndef JucePlugin_PreferredChannelConfigurations
AudioProcessor (BusesProperties()
.withInput ("Input", juce::AudioChannelSet::stereo(), true)
.withOutput ("Output", juce::AudioChannelSet::stereo(), true)
),
#endif
state (*this, &undo, "PARAMS", createParameterLayout())
{
frequencies.resize (300);
for (size_t i=0; i < frequencies.size(); ++i) {
Sweet, got it all sorted out now, thanks!