AudioPluginFormatManager addDefaultFormats() not adding any formats

This has been stumping me for a few hours and I'm at a loss for a solution.  I've been looking at working example code in the xcode debugger and have been getting the expected results.  For some reason, whenever I try it on my own code, no formats are stored.

I have been declaring a private AudioPluginFormatManager called formatManager in my PluginProcessor.h file and calling formatManager.addDefaultFormats() in the first line of the constructor in my PluginProcessor.cpp file.  When I step through the code, something I can't explain happens.  

I put a breakpoint in the constructor, and also in prepareForPlay for my plugin processor and checked the debugger for each.  At the first breakpoint, numAllocated and numUsed for the formatManager were extremely large integers.  At the second breakpoint, they were both zero.  I can't figure out what to make of this behavior.  

I'm relatively new to JUCE, so please excuse me if there is an obvious answer to this problem.

 

Thank you for any help!  

You're probably looking at a different instance of the object the second time?

Thanks for the reply--I just solved the problem, but it wasn't that.

I guess there's something to be said for a fresh start on a new day. To fix this, I went into the introjucer and under the juce_audio_processors module for my project, enabled the JUCE_PLUGINHOST_VST option (I don't need the others at the moment). It was set to default, and that was preventing the proper areas of the module code from being run when I called addDefaultFormats()

Sure enough, this worked! Hopefully this helps anybody else running into the same problem.

2 Likes

Thanks for following up on this. Had to same issue and this was the resolution.