Xcode 5 - JUCE Assertion Failure in VST wrapper


#1

So I'm brand new to JUCE and pretty new to C++ in general, forgive me if I'm missing something obvious. I'm building an audio plugin for AU and VST, and before I started using Xcode's debugger, it was working just fine when I loaded up both plugins in Reaper. No problems, no crashes. But then I started using the debugger (editing the Scheme to run Reaper after build), and I started getting this error:

JUCE v3.0.6
Creating VST instance: CellularAutomata
JUCE Assertion failure in juce_VST_Wrapper.cpp:286
(lldb)

Any ideas what's going on? The relevant line of code in juce_VST_Wrapper.cpp is this:

// NB: For reasons best known to themselves, some hosts fail to load/save plugin
// state correctly if the plugin doesn't report that it has at least 1 program.
jassert (af->getNumPrograms() > 0);

Should I just comment out this line? I tried running the debugger linked to JUCE's plugin host, but got the same error, so I know it's not Reaper.


#2

So I commented out the jassert and it works fine now, just worried that this will break something later, and maybe there's a better fix?


#3

So I guess you've not overriden AudioProcessor::getNumPrograms() (see https://www.juce.com/api/classAudioProcessor.html#a510123768a99f32ff4a23d0458e15e13).

The assertion is there to remind you that if you don't set up preset handling and implement at least one preset program, then your plugin will have issues in some hosts.

You'll probably also want to take a look at getStateInformation & setStateInformation.


#4

Right on, Andrew! Overriding getNumPrograms() took care of things. Missed that bit from the audioplugindemo source.