Create a basic Audio/MIDI plugin Part 2: Coding your plug-in


So I’m doing part 2 of the create a basic audio/midi plugin and I’m stuck at this part:

midiVolume.setPopupDisplayEnabled (true, this);

In Xcode I get an error at this line, which is verbatim what the tutorial shows, saying it expects 3 parameters, not 2.

This is the tutorial I’m referring to

I understand it’s expecting me to put in another value in the parameters, which is supposed to be *juce::component. I’m not really sure what it should be though, and the tutorial doesn’t include it.

You know, it’s kind of weird. I’m just doing exactly what the tutorial says and every few steps there are lines that just don’t compile.

#2 seems to only need 2 parameters, but that documentation is very old.

What version of JUCE are you using? If you’re using juce 5.x you’ll need to use your local doxygen version of the documentation or just read the source code directly as it has been updated since that tutorial was written. That tutorial appears to have been written for version 4.x or 3.2 of JUCE.

You’ll learn very quickly that a lot of programming with JUCE involves a lot of reading the comments written in the source code for all of the modules. So get used to command-clicking all of the symbols in the JUCE classes to be taken to their definitions if you have error messages like what you described.


To answer your question about what parameters to pass to the method, the code used in the tutorial was saying:

midiVolume.setPopupDisplayEnabled (true, //bool shouldShowOnMouseDrag
                                   this);//Component* parentComponentToUse

So, just add in the missing boolean value that the new method signature is asking for and copy over the old values accordingly:

(bool shouldShowOnMouseDrag,
 bool shouldShowOnMouseHover, 
//add a true or false here if you want the popup displayed when you hover over the slider's thumb
 Component* parentComponentToUse);

Also, next time you have an error message like that, you might try writing the line of code yourself and letting your IDE provide the method signature. in XCode, you’d see something like this, with temporary fields showing you what parameters are expected.
17 AM
I still use juce v4.3.1 so that’s why you only see 2 parameters in my screenshot.

Hope that helps!