Filter slider not affecting audio

Hello,

I’m new to JUCE and I’ve been trying to make some slider controlled filters for a project. I’ve been able to add the default filter effect for the high pass and make it so I can move the slider, but it doesn’t change the frequency that is affected by the filter. Both of the sliders are using public juce::Slider::Listener

And this is what I’ve done to say how I want it to change:

void sliderValueChanged (juce::Slider* slider) override
{
if(slider == &hpffrequencySlider)
{
audioProcessor.sethpf(hpffrequencySlider.getValue());
}

    {
        if(slider == &lpffrequencySlider)
        {
            audioProcessor.setlpf(lpffrequencySlider.getValue());
        }
            
        }
        
    }

Is there something that I’m missing?

Hi,

I’m still learning as well but I can try to help.
Do you have a github repo so we could see the entire source code? I do not see any obvious mistake in your snippet.

Also, I would add a console print in the function to make sure it is called. Then, if something appears in the console (= the listener is working), you can check if the if blocks conditions are satisfied with other loggers (= the equality with pointers is working).

If you found a solution I’m curious to know where the bug is :slight_smile:

Hi,

This is the link for it, though I don’t really know how to navigate everything, cause it’s all really new to me. :sweat_smile:If I do find what the problem was, I’ll definitely let you know.

I’ve figured it out.

I had mistakenly put this in the .h instead of the .cpp for the GUI.

void ExampleProjectAudioProcessorEditor::sliderValueChanged(juce::Slider* slider)

{

if (slider == &hpffrequencySlider)

{ 

  audioProcessor.sethpf (hpffrequencySlider.getValue()); 

} 

if (slider == &lpffrequencySlider)

{ 

  audioProcessor.setlpf (lpffrequencySlider.getValue()); 

} 

}