Access slider and objects at runtime

Hello everyone,
I’ve been recently digging into Foleys’ librairy recently, and I’ve been looking for a way to get some pointers on my differents GUI elements.

I’m making a compressor, with sliders that let the user define different parameters.

One of theses sliders, (the threshold) has a special look and feel with a value that can be updated with the inputVolume of the plugin (and it should allow to display the current input volume on the button).
For the moment, I tried different approach to access the slider from my GUI and update it :

thresholdSlider = magicState.getObjectWithTypejuce::Slider(“thresholdSlider”);

I tried getting it like this : only getting nullptr…

Here’s how is defined my slider in the GUI :
image

Then, but I assume it doesn’t work because I can’t get the object, I was planning on doing this at each processBlock call :
void CompressorAudioProcessor::updateVolumeAngle(float inputVolume){

  LookAndFeelThreshold& lookAndFeel = dynamic_cast<LookAndFeelThreshold&>(thresholdSlider->getLookAndFeel());
lookAndFeel.setEndAngle(inputVolume);

}
But for the moment, it prevent my whole sound processing to run,
Do anyone of you have an idea to fix this ? Do you know where is the thing I have missunderstood ?
Thanks for your help !

Here’s the github repo if anybody want to use this as template or anything ! GitHub - MariusBoucard/Compressor

Hi Marius,
That sounds like a very interesting use case. Do I understand correctly that you want to display the gain reduction within the slider? That could be a great effect.

I think for that purpose I would create a special kind of slider or custom component really.
To connect to a gain reduction I would experiment with juce parameters. JUCE supports special AudioProcessorParameters for that purpose. That way the host could also display the gain reduction, and you have the information in one place:
AudioProcessorParameter::compressorLimiterGainReductionMeter

It would be interesting to see how that works out, I am very interested.

For the custom component, the speciality would be, that it connects to two parameters, one to control and the other to get the gain reduction for displaying.