I’m trying to develop an user friendly compressor. I had lots of doubts at the beginning and I’m based finally on two projects that are named in the code, under GNU.
I’m updating some plug in parameters values from an inc/dec button, just depending of compression degree, and switching that inc/dec value (from 1 to 5) acting directly into the compressor to change the value.
I am implementing the setting of the audio compressor machine in the “parameter changed” function, as shown below:
I’m so surprised so there’s no way for me to do the sliderAttachments textboxes update their values with the ones I set.
If anybody could help and also suggest some style or best-practice coding I’ll be glad, because at now the project is stopped. I’ve uploaded it to github @
For a slider text box to take calls from the processor (w/ addListener(this), you have to add Slider::Listener as a publicly inherited base class of your editor. Not sure how to paste code in here but I have some I’ll try to copy.
Sorry to interrupt, but that is the wrong approach.
The textual representation of a parameter is defined in the parameter itself, because it is used for the hosts parameter display as well.
Have a look at the arguments of the AudioParameterFloat constructor. You supply two lambdas, one to convert the value into a string and one to parse the string into a value for user input.
By using the AudioProcessorValueTreeState::SliderAttachment this lambdas are also used in the Slider without further customisation necessary. In fact, adding the SliderAttachment reverts most of the Slider settings intentionally.
Not a lambda but a SliderProcessorAttachment. That has all logic implemented to synchronise the parameter value and the slider value, without update loops. And it takes care of initial update. It also takes care of thread safety and begin-/endChangeGesture().
If you use the Slider::Listener and the AudioProcessorValueTreeState::Listener, you need to take care of those things manually, that you will write each time you connect a control with a parameter.
The DSP and the GUI should individually look at the AudioProcessorParameter, instead of updating from control directly to the DSP.
Anyway I cant access from PluginProcessor.cpp and that’s the problem…
I understand the point is to advice this components, but how?
If you use the Slider::Listener and the AudioProcessorValueTreeState::Listener, you need to take care of those things manually, that you will write each time you connect a control with a parameter.
could you please @daniel be just a little more speciffic with the code I’ve uploaded? I’ve been trying with tests on the code with no result…
You don’t need to update the attachment. By changing the parameter, it will automatically update the control. And by changing the control, it will change the parameter, if the host’s automation settings allow that.
The AudioProcessorParameter is the single source of truth, or the data model, whichever term you prefer.
The Control is the GUI, in MVC terms the view, and the attachment the controller, that takes care that view and model always stay in sync.
I wondered this, for sure… but in terms of host, OBS doesnt reflects any changes at all on Sliders when I change the compressor parameters. That’s the question
Hello Daniel, I’ve been doing several tests with nuendo and other hosts, just to try if the update of the sliders suceded as you told me. It does not happen.
I’ve tried