Max/Msp gen~ presets slider not moving


#1

Hi all,
I created an Audio plugin using gen~ and JUCE.
Instead of using an AudioProcessorValueTreeState parameters; like the JUCE demo plugins ,
the code created by max has it’s own class with a large struct which stores all the parameter values.
Everything works pretty well.
It’s possible to save presets in your DAW.
One problem :
Loading a new preset changes the parameters but the sliders get redrawn back at zero.
There is a similar issue when the plugin is loaded initially.
The default values get loaded into the plugin ( at least that’s what it sounds like to me ! ) but the sliders and their values are not updated.

I can’t see anything in the main Editor or Processor classes that refers to loading presets. Where does that happen in JUCE?
Where is the classes that redraw the sliders initially and when a new preset is loaded ?

It seems that the sliders are only redrawn when they are moved but not redrawn when a preset or the plugin is loaded initially.

Perhaps it’s possible for me to write some sort of enormous getter and setter which can convert from an audiotreestate to the struct and back.

The classes come from this …

Lot’s and lot’s of classes to look at and it’s all a bit beyond me to figure out today.

Thanks in advice for some help !

Some relevant code is below …

// my editor has  : 

    if (sliderThatWasMoved == d1LevelSlider)
    {
       sliderThatWasMoved->getValue();
       processor.setParameter(0,sliderThatWasMoved->getValue());
    }

// the max class has 

/// Set a parameter of a State object

void setparameter(CommonState *cself, long index, t_param value, void *ref) {
	State *self = (State *)cself;
	switch (index) {
		case 0: self->set_d1Level(value); break;

/// Get the state of all parameters of a State object

short getstate(CommonState *cself, char *state) {
	return genlib_getstate(cself, state, &getparameter);
}

#2

I was thinking that I could try set the slider values in the processor class at this point …

void C74GenAudioProcessor::setCurrentProgram (int index)
{

d1LevelSlider::setValue ( C74_GENPLUGIN::getparameter(1))
d2LevelSLier::setValue ( C74_GENPLUGIN::getparameter(2))

}

I might try that and see what happens …


#3

I came up with a sh#tty solution that works for now …

I created a textbutton called “Load Current Preset”

The button just sets the value of the sliders to whatever is stored in the parameters of the C74 class

eg :

        d1freqSlider->setValue(processor.getParameter(1));
        d1timeSlider->setValue(processor.getParameter(2));

Perhaps it’s better that only the editor class is messing with the slider pointers …

Calling all that stuff from
setCurrentProgram (int index)
within the processor class might cause threading issues I guess.

Probably an experienced JUCE? C++ programmer ( not me! ) could figure out a more elegant solution. At lease it works pretty good!
Sean


#4

Same problem here, got everything working and automable parameters but sliders won’t follow automation values.
Tried to set up the AudioProcessorValueTreeState following The Audio Programmer Tutorial attached and the demo tutorial and got parameters renamed for what I set up them to be but still Sliders are not moving. Got a scoped pointer and the sliderAttachment of course…

Where I’ve been learning from so far: