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) {
buffer.clear();
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);
}
midiMessages.swapWith(processedMidi);
}
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.
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?
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?
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).
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 used the latest Projucer (v. 5.2.3) to created Audio-Plugin project for VS2017 (on Windows 7).
In the resulting project, the lines 351-352 in AppConfig.h read:
The line you posted is fro the AudioProcessor base class - the plug-in template derives from this and returns a value based on whether the āMIDI Effect Pluginā flag is set, see here.
Perhaps check the other conditions of the assertion, whether maxNumInChannels is > 0 or maxNumOutChannels is > 0.
Thanks for your response.
My whole point is that the plug-in template - demonstrably - doesnāt return ātrueā when āMIDI Effect Pluginā flag in āProject Settingsā section of Projucer is set.
worked as expected, but it doesnāt. Given that, my question becomes:
Whatās the point of setting the āMIDI Effect Pluginā flag in Projucer if one still needs to fiddle around with the code anyway?
Also, why would I need to ācheck the other conditions ofā
when Projucer generates the following code? [emphasis mine]
void processBlock (AudioBuffer& buffer, MidiBuffer& midi) override
{
// the audio buffer in a midi effect will have zero channels!
jassert (buffer.getNumChannels() == 0);
How are you demonstrating this, exactly? Iāve taken the latest Projucer from the JUCE website download (v5.3.2) and created a new Audio Plug-in template project, then I have set the MIDI Effect Plugin option in the Plugin Characteristics group of the project settings. Iāve saved and opened the project in Xcode and added the following lines to my AudioProcessorās constructor in PluginProcessor.cpp:
I replicated project creation routine with Projucer 5.3.2 just like you did and, in fact it is working as expected.
I donāt recall exact steps I took that resulted in that āassertingā code, but the assertions did fail as I described earlier. Anyway; it works now, so never mind the whole thing.
Sorry for the hassle