How can process on button effect

Hello,
Actually i am trying to do some process on button click/tune.
So, first i planned to display button’s value on GUI when click/tune button.
So, i used below lines of code in PluginProcessor.cpp file “processBlock” function

if (QVCAEditor* editor = (QVCAEditor*)getActiveEditor()) {
editor->updateSlicerParameters();
}

And assigning value of buttons to some parameters which has declared in Editor class. As below:
void QVCAEditor::updateSlicerParameters()
{
/Store Buttons value to parameters/
}

And display these parameters value, from “paint” function in PluginEditor file as below:

g.drawSingleLineText(juce::String::formatted("%4.2f", “parameters_variable”), ((getWidth()/16)*0) + 10, getHeight()-20);

But, i can not see any effect of those value when click/tune buttons.
So, am i doing something wrong. Or am i missed something. Please, guide me.

Or I have to use following lines of code from “setParameter” function from PluginProcessor.cpp file?.

if (QVCAEditor* editor = (QVCAEditor*)getActiveEditor()) {
editor->updateSlicerParameters();
}

Regards,
Kishan Patel.

processor.getParameter, only holds the last value of the button or encoder.
you are going to need to ‘manage’ your own plugin values derived from these.

if you go back to the qvca example,
you can see this if you set showParamValues=true. (by default its false)

also id say, you really do not want to be holding the parameter values in the editor anyway, since your processor will need them whilst processing the audio.

this is an aspect where qvca is a little different, its processor is purely using the buffer input streams to derive the outputs, it is not using parameters - the editor is ‘just’ displaying the scopes.

note: id also tend to advise against using critical sections (as qvca does) or any other locks - audio threads are usually ‘lock free’, as using locks potentially cause audio glitches, when under load.

when you set the button values from setParameter() or from your processBlock() function, you will need to call repaint, to tell the GUI thread to call the paint() function. Otherwise you won’t see any change.

BUT… you cannot call repaint() on your editor from within setParameter() or processBlock() because those functions are called from the audio thread, so like @thetechnobear says, you need either a lock-free queue or other message passing system that will not block the audio thread, to notify the GUI. or you have to use an atomic variable (e.g. a float or int32) and use a timer in your GUI class, which will call repaint(). The strategies to solve this problem are discussed in the juce forum in great detail so it’s best you first read/ask there.