Basic question regarding using slider in SynthVoice


#1

Hi everyone, this is my first post on the forum. I’ve been working my way through JUCE tutorials the past month and now find myself trying to create a basic FM synth. To get right into the crux of my problem, I have defined a slider in my MainComponent which I am trying to access in a SynthVoice class (similar to the AudioSynthesiserDemo in the examples folder). However, when I try to access the slider I get the error that its an invalid use of non-static data member. I have tried to use static and const in order to resolve the error but to no avail. Does anyone have any suggestions on how I may be able to get around this issue or what the root cause is? Thanks for your time.


#2

It means you’re trying to call a class method incorrectly – probably a syntax or code issue.

Rail


#3

So the specific line of code is as follows:

cyclesPerSecond = MainContentComponent::mFrequencySlider.getValue();

Not sure if that might help provide more context


#4

Try removing the classname, it should read:

cyclesPerSecond = mFrequencySlider.getValue();

HTH


#5

When I remove the class name it can’t find the slider


#6

You’ll need to know and understand C++ and classes and inheritance to use the JUCE library:

http://www.cplusplus.com/doc/tutorial/classes/

Rail