[Solved] Automation without GUI

I’m playing with a plugin that gets its values from the automation control lanes - I can implement the GUI but they are superfluous to my needs.

Is it possible to have automation with associated GUI bits?

I think that should be no problem. Just return false from MyAudioProcessor::hasEditor()

But you can also simply add the GenericAudioProcessorEditor instead of the MyAudioProcessorEditor from the boilerplate. That should populate sliders with the values automatically…

1 Like

OK, that’s good news.

If I return false from hasEditor() where would be best to implement the listener? Is it OK to implement along with the AudioProcessor class?

Yes, the AudioProcessor can be a listener, like every other class. You are talking about AudioProcessorValueTreeState::Listener, right?

Ye, that’s right.

I’ve implemented this but get an exception

I added the public AudioProcessorValueTreeState::Listener to the AudioProcessor class

with
void parameterChanged(const String &parameterID, float newValue) override;
AudioProcessorValueTreeState parameters;

created a paramterChanged in my processor
void myAudioProcessor::parameterChanged(const String & parameterID, float newValue) { }

and then in the constructor
myAudioProcessor::myAudioProcessor()
: parameters(*this, nullptr)
{
parameters.createAndAddParameter("x", "X Coordinate", "",
NormalisableRange<float>(-1.0f, 1.0f, 0.0001f), 0.0,
[](float value) { return String(value, 4); }, nullptr);

parameters.addParameterListener("x", this);
myX = parameters.getRawParameterValue("x");

}

but the exception seems to throw on createAndAddParameter()

The exception is an assert
jassert (name.toString().isNotEmpty()); // Must have a valid property name!
at JUCE Assertion failure in juce_valuetree.cpp:737

any ideas?

Did you initialize the ValueTree state after createAndAddParameter() calls?

myAudioProcessor::myAudioProcessor() : parameters(*this, nullptr)
{
    parameters.createAndAddParameter(...);

    parameters.state = ValueTree("some name for the state here");
}
1 Like

Thankyou Tony. Much appreciated.

I have just arrived at the observation myself!!! I was missing
parameters.state = ValueTree(“x”);

1 Like

With the new way of using APVTS

it’s no longer possible to miss out the initialization :slight_smile:

@t0m, do I implement the listeners in the old way with the the new way of using APVTS?

You can use the old way, but you’re also free to use the AudioProcessorParameter::Listener interface too.

thanks @t0m, your thought on APVTS might be useful here too Unity Plugin & Parameters