Changing private audio parameter

Greetings.

I have recently started studying JUCE for following writing plugins but stuck in the beginning.

According to the documentation (JUCE: Tutorial: Create a basic Audio/MIDI plugin, Part 2: Coding your plug-in) I can create and customize GUI controls in PluginEditor. The tutorial describes how to create a slider and how to manipulate a paramter via ‘sliderValueChanged’.

Also, in another tutorial (JUCE: Tutorial: Adding plug-in parameters) AudioParameterFloat class is introduced. The tutorial adds a paramter as a private member of PluginProcessor class. The additional code file (.h) does not contain any code about GUI or Slider separately. In spite of that, after compiling the file I have gotten a program that already had one slider (I have no idea how, the tutorial does not say anythin about it).

Based on the above, my question is as follows. If I create a slider in a Plugin Editor and create a private parameter in a Plugin Processor, I have no legal opportunity to change that private paramter from the slider’s listener (obviously, because the parameter is private). How do I have to get access to parameter? I suppose, a parameter could be public but then I don’t understand why the tutorial makes it private.

Thank you in advance. I would be grateful if you recommended my additional resources on JUCE plugin programming.

The adding parameter tutorial uses the Juce GenericAudioProcessorEditor for the GUI. That’s a class that automatically generates a very simple GUI from the AudioProcessor based on its parameters.

The tutorial has those private pointers to the parameters so that the parameters don’t need to be looked up based on their names over and over again in the processBlock method.

You might want to look into the AudioProcessorValueTreeState and the component attachments to implement the communication between the AudioProcessor and AudioProcessorEditor, instead of directly manipulating parameters from the GUI editor.

But you could also just make the parameter pointers public in the AudioProcessor and manipulate the parameters directly from the editor code. That’s not really recommended, though. You would also need to implement the reverse flow of information : if the parameter changes in the audio processor, the GUI should update itself. (This can happen when the host automates a parameter or when the state of a host project file is loaded, for example.)