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

Hi,
I’m on Mac OS with Xcode 8.2.1. I’m trying to complete this tutorial, but I’m stuck at the point where I have to insert the following code:
void TutorialPluginAudioProcessorEditor::sliderValueChanged (Slider* slider)
{
_ processor.noteOnVel = midiVolume.getValue();_
}

I do insert the code into PluginEditor.cpp (at the end) but get an error message:
Out-of-line definition of ‘sliderValueChange’ does not match any declaration in 'TutorialPluginAudioProcessorEditor
How can I solve this or what am I doing wrong? Any help much appreciated!

Have you added the corresponding definition for sliderValueChanged in the .h file?

You may have a typo in:
void sliderValueChanged (Slider* slider) override;

1 Like

Thank you Dave, you pointed me in the right direction. Shame on me, but I forgot to add that part of the code… Now the build succeeds, only with one message: Unused variable ‘channelData’, but I guess at this point I don’t need it. Thanks again for the quick reply!

I just started going through this tutorial and I’m having the same problem regarding " Unused variable ‘channelData’ ".

Commenting it out doesn’t make it run. What would I have to do to either use it or remove it from being called entirely?

Is it an actual problem, does your plugin still run anyway? It’s “just” a compiler warning. (Generally you should watch out for those but the tutorials and the Projucer generated code are not necessarily 100% warning free.)

Without having had a look at the tutorial code, to avoid compiler warnings like that, juce has the ignoreUnused function, so you can just write ignoreUnused (channelData) after the declaration of the variable somewhere and the warning should be silenced. However you should always try to unterstand why it is there in the first place before silencing a warning…

Background of this function: This is especially useful if you want to use a variable for some checks with jassert in a debug build but the variable will be unused in the release build and would trigger a warning there.

2 Likes

Right, so that warning won’t keep it from compiling. It says that the build was successful, but there is no window that opens with the ‘MIDI Volume’ fader.

Do I have that block of code in the right place (lines 39-51)? I moved it to the top and there was no change. Xcode returned a successful build but does not generate a window.

Here is how the PluginEditor.cpp file looks:

I’m very much a novice with this, so I really appreciate the help!