Having Problems with Slider Listener


I'm trying to create a pretty simple plugin, here's what's going on:


- You can't use the GUI editor on the plugin editor directly.

- To overcome this, I made a GUI component and instantiated it in my plugin editor.

- This works fine, all of my sliders are there and working.

- I need the GUI component's sliders to edit parameters in the processor.

- My GUI component doesn't know about the processor or the plugin editor, nor do I want it to.

- Not sure what to do, but I try making my plugin editor inherit Slider::Listener.

- I make a getter function in my GUI component that returns a ScopedPointer to a slider.

- Now I try to make my plugin editor listen to that slider by using .addListener (this).

- When I open the plugin the slider has now disappeared.


I'm having trouble wrapping my head around using slider listeners and the new AudioProcessorParameter class. I can't seem to find any tutorials on using the AudioProcessorParameter class either since it is a newer thing. I'd greatly appreciate some guidance on how to organize getting GUI components to update AudioProcessorParameters.


You can look at how AudioProcessorParameter is used in the updated JUCE audio plugin demo. That's how I figured out how to use it.  If you don't see it, you should get JUCE from GitHub. You'll also find other newer demos there too. 


Thanks! I guess I didn't have the most up to date version. I found the example now. I'll take a look when I get the chance.


ScopedPointer documentation states to not return it from a function…


I would just pass the processor to the Component, inherit from Slider::Listener in the Component and then in the sliderValueChanged changed callback set the value of the corresponding AudioProcessorParameter from the processor.


Thanks for the help. I have it working for now but I'm still confused about some things.


If I understand the concept of an AudioProcessorParameter correctly, it is what the host sees and and automates and ranges from 0 to 1. In all the examples I've seen, the value of whatever parameter is set by a slider in its sliderValueChanged code. It also seems like the examples are set on a timer to check for parameter updates to update the UI.

Say I have a some sort of object that lives in the AudioProcessor and has its own internal processing parameters. What if I want some of these parameters to be synced up to an AudioProcessorParameter? Right now my solution is to have the slider set those parameters along side of the AudioProcessorParameter, but that is really a bad solution. Not only is it ugly, but what happens when I automate a parameter? My timerCallback picks up the change and changes my object's internal parameter, but only at the speed of the timer.

If anyone could help me better understand how to set this up I would be grateful.