[Resolved] setValue is unidentified

I’ve been trying to solve an update issue for my sliders and found this link:

I’m trying to use setValue like the code at line 116. I think I have all the includes correct and the inheritances too.

However, my code still doesn’t compile because it says that the setValue identifier is undefined.

The quoted code above seems reliable, so I have probably missed something… does someone have an idea?

The Slider::setValue() method takes a double and an optional NotificationType as arguments. Make sure you’re passing a double value and if passing a second argument, make sure it’s a NotificationType.
If you’re sure you have this correct could you share some of your actual code?

Thanks for your answer.

setValue is underlined with a red wave, so the problem seems to be that it’s not recognized.

Here is my code:

void DelayAudioProcessorEditor::timerCallback()
    //if you want any display updates with a refresh timer add them here
    DelayAudioProcessor* ourProcessor = getProcessor();
    delayLengthSlider_ = setValue(ourProcessor->delayLength_, dontSendNotification);
    wetMixSlider_ = setValue(ourProcessor->wetMix_, dontSendNotification);
    dryMixSlider_ = setValue(ourProcessor->dryMix_, dontSendNotification);

And inheritances:

class DelayAudioProcessorEditor  : public AudioProcessorEditor,
                                   public Timer,
                                   public Slider::Listener

That’s not syntactically correct, look at the code you linked to. setValue() is a member function of Slider so to use it you need to use the dot operator (.).

Change these lines to:
delayLengthSlider_.setValue(ourProcessor->delayLength_, dontSendNotification);
and it should work fine.

1 Like

There are several issues with that, the first one is, that it uses the deprecated and soon to be removed setValue methods of the AudioProcessor.

My second one was, what @Im_Jimmi just wrote… :wink:

(And I really wonder, who came up with that underscore notation… looks horrible to me)


Im_Jimmi, thank you… your suggestion worked. I would be curious why different sources have the same mistake.

@daniel. This notation comes from @andrewm depot: https://code.soundsoftware.ac.uk/projects/audio_effects_textbook_code/repository

1 Like

Well, it shows this code:

DelayAudioProcessor* ourProcessor = getProcessor();

delayLengthSlider_.setValue(ourProcessor->delayLength_, dontSendNotification);
feedbackSlider_.setValue(ourProcessor->feedback_, dontSendNotification);
dryMixSlider_.setValue(ourProcessor->dryMix_, dontSendNotification);
wetMixSlider_.setValue(ourProcessor->wetMix_, dontSendNotification);

So you did not copy/paste correctly…

1 Like

@peter-samplicity, you are correct. I mixed up with another source which had the mistake.
Thanks for letting me know this.