JUCE Assertion failure in juce_VST_Wrapper.cpp:269


Hey Im following the coding the audio plugin tutorial(https://www.juce.com/doc/tutorial_code_basic_plugin) and I have ran into a couple of issues trying to run the example plugin. It was working fine but now when I try and load it in the JUCE plugin host it cant load and I get this error in the console

JUCE Assertion failure in juce_VST_Wrapper.cpp:269

Im on OSX running xcode and I have just updated my JUCE version as well.

Here is the code from the process block function:

void Jucepart2AudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) {

    MidiBuffer processedMidi;
    int time;
    MidiMessage m;

    for (MidiBuffer::Iterator i(midiMessages); i.getNextEvent(m, time);) {
        if (m.isNoteOn()) {
            uint8 newVel = (uint8)noteOnVel;
            m = MidiMessage::noteOn(m.getChannel(), m.getNoteNumber(), newVel);
        processedMidi.addEvent(m, time);



I am afraid I can’t give a precise answer because this would require some more specific info on what is going on in your plugin.
Here instead are some hints on how to find that information:

  • If your code fails an assertion it is always a good idea to look at the line above it. The wise JUCE people have put a message here that is meant to explain what went wrong in your code. (In this case the answer can be found in juce_VST_Wrapper.cpp line 268)
  • if the assertion comment does not ring a bell then take a look at the call stack. You can see which of your functions made the call into the JUCE framework that in the end lead to the failed assertion.
  • by now you should have gotten a better understanding of the issue and maybe you can already implement a fix. If not come back here and share the information you have found.
  • Writing the forum post try to be as precise as you can with the description of the problem and its context. You might even find the anwer to your question yourself while you write it down. (that happens a lot to me and this forum has missed quite some traffic because of that.)


The code is the exact same as in the tutorial I have linked above. Here is the full console output:

JUCE v5.0.2
Attempting to load VST: /Users/Nicholas/Library/Audio/Plug-Ins/VST/JUCEPart2.vst
JUCE v5.1.1
Creating VST instance: JUCEPart2
JUCE Assertion failure in juce_VST_Wrapper.cpp:269

I dont think any of my code is actually running yet because it seems to run the JUCEApplicationBase::main(int, char const**) method and then there is a bunch of calls to other methods and then it throws an error when it gets to the juce_VST_Wrapper.

I can build the program fine but the error occurs when I actually run it and try and load the plugin in the JUCE plugin host.


If you open up juce_VST_Wrapper.cpp and scroll down to line 269 you’ll see this:

    // You must at least have some channels
    jassert (processor->isMidiEffect() || (maxNumInChannels > 0 || maxNumOutChannels > 0));

The assertion failure is telling you are trying to instantiate the plugin with no input/output channels.


Ok that makes a little more sense but first you have to load the plugin into the JUCE plugin host then you can add the audio input and output channels and also the midi ones. I’m basically trying to test the program and I can only do it in the JUCE host because I wont be able to do it with ableton(because it doesnt recognise the VST plugin as a midi effect which this basically is)


Then you probably forgot to set something because this processor->isMidiEffect() should then return true (which it doesn’t and this is why Live can’t load it, because it triggers that assertion).


Ok I’ve had a bit of a read of the file thats throwing the error and yes isMidiEffect() should be returning true but its not in this case. I have just double checked that I ticked is midi effect in the setting in Projucer and I have also ticked plugin wants Midi input.

I also looked at the code in the AudioProcessor class and it has some preprocessor conditionals with some macros so maybe the macros havent been updated? The projucer has no save in the settings so I’m just exiting out. Is this saving the changes?


It should, yes.


Projucer doesn’t save the settings automatically. You have to click on File > Save, or press Ctrl+S.


Yeah I’ve double checked it was already saved and its still not running. Even when I scan for new VSTs in the JUCE plugin host is crashes at the same point. Everything is building successfully. Is there anyway I can see the macros and see if it actually has saved properly?


Check how the function is computed and see if everything is set up properly.


I actually have no clue what is going on now aha. The plugin seems to open fine in ableton and there is a vertical scroll bar that works and everything but ableton only recognises it as an audio plugin not a midi one (Midi effects go before the instrument and audio after).


Just realised, that the default boilerplate does not override isMidiEffect() (I kinda remember, it used to do so)

Your plugin lacks the override, just add

bool isMidiEffect () const override {
#ifdef JucePlugin_IsMidiEffect
    return true;
    return false;

@ed95 / @t0m: was that intentional? If so, you might remove the Projucer option for that define as well…



Ayy that fixed! Thanks for that. Yeah I was looking at the overrided methods and only saw that accepts midi and produces midi where overridden but didnt think much of it.


I’ve added this to the new plug-in template code.