Hi
I am doing a gain control with separate L and R controls and having trouble to link the two sides in the GUI. How can I link two sliders so they present the same value in the GUI using the AudioProcessorValueTreeState? I can update their values but not the visuals. When I try to change the other sliders parameter in ::parameterChanged it just gets into an endless loop and then “JUCE Assertion failure”. … if I just update their values nothing happens to the slider I am not manually dragging.
if(linkGainButton){
if(parameterID == "gainLeft"){
gainLeftValue.setTargetValue(juce::Decibels::decibelsToGain(newValue * 0.5));
gainRightValue.setTargetValue(juce::Decibels::decibelsToGain(newValue * 0.5));
auto* param = apvts.getParameter ("gainRight");
param->beginChangeGesture();
param->setValueNotifyingHost (juce::Decibels::decibelsToGain(static_cast<float>(*apvts.getRawParameterValue("gainLeft"))));
param->endChangeGesture();
}
if(parameterID == "gainRight"){
gainLeftValue.setTargetValue(juce::Decibels::decibelsToGain(newValue * 0.5));
gainRightValue.setTargetValue(juce::Decibels::decibelsToGain(newValue * 0.5));
auto* param2 = apvts.getParameter ("gainLeft");
param2->beginChangeGesture();
param2->setValueNotifyingHost (juce::Decibels::decibelsToGain(static_cast<float>(*apvts.getRawParameterValue("gainRight"))));
param2->endChangeGesture();
}
}
