I'm writing an audio processing app in C++ using JUCE. The GUI of the app is handled in the file PluginEditor.cpp while the processing is handled in the file PluginProcessor.cpp
I have a slider component mMicInGainSlider for an audio gain in the editor that exploits an AudioProcessorValueTreeState::SliderAttachment to pass the value of the slider to the processor through the parameter paramMicInGain:

mMicInGainAttachment = std::make_uniqueAudioProcessorValueTreeState::SliderAttachment (p.getValueTreeState(), PluginProcessor::paramMicInGain, *mMicInGainSlider);

In the processor I have a method void PluginProcessor::parameterChanged (const String &parameterID, float newValue)

where I check for the paramMicInGain value and if that's the case I can get the current gain value associated to the slider into a processor local var called mMicInGain.

This works fine when the user manually changes position of the slider and the var mMicInGain gets the new value.

However, in some cases I wan the opposite to work, too, i.e. I change the value of mMicInGain in the code and I'd like that this trickles back and slider changes its value accordingly. How to achieve this?