Failing assert in juce_AudioProcessor

since updating to JUCE 7 I am now getting an assert failure in the juce_AudioProcessor.c code attached below is the bit of code where it fails as well as the backtrace

void AudioProcessor::validateParameter (AudioProcessorParameter* param)
{
    checkForDuplicateParamID (param);
    checkForDuplicateTrimmedParamID (param);

    /*  If you're building this plugin as an AudioUnit, and you intend to use the plugin in
        Logic Pro or GarageBand, it's a good idea to set version hints on all of your parameters
        so that you can add parameters safely in future versions of the plugin.
        See the documentation for AudioProcessorParameter(int) for more information.
    */
   #if JucePlugin_Build_AU
    jassert (wrapperType == wrapperType_Undefined || param->getVersionHint() != 0);
   #endif
}
* thread #1, name = 'JUCE Message Thread', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x102849d1c)
  * frame #0: 0x0000000102849d20 Electrobass`juce::AudioProcessor::validateParameter(this=0x000000012e024a00, param=0x000000012d10a280) at juce_AudioProcessor.cpp:441:5
    frame #1: 0x000000010284a554 Electrobass`juce::AudioProcessor::addParameter(this=0x000000012e024a00, param=0x000000012d10a280) at juce_AudioProcessor.cpp:524:5
    frame #2: 0x000000010288ac24 Electrobass`juce::AudioProcessorValueTreeState::AudioProcessorValueTreeState(this=0x000000016d7ee498, param=nullptr)::PushBackVisitor::visit(std::__1::unique_ptr<juce::RangedAudioParameter, std::__1::default_delete<juce::RangedAudioParameter> >) const at juce_AudioProcessorValueTreeState.cpp:229:30
    frame #3: 0x00000001026c2448 Electrobass`juce::AudioProcessorValueTreeState::ParameterLayout::ParameterStorage<juce::AudioParameterFloat>::accept(this=0x000060000149e1e0, visitor=0x000000016d7ee498) at juce_AudioProcessorValueTreeState.h:189:71
    frame #4: 0x00000001028669dc Electrobass`juce::AudioProcessorValueTreeState::AudioProcessorValueTreeState(this=0x000000012e0254f0, processorToConnectTo=0x000000012e024a00, undoManagerToUse=0x0000000000000000, valueTreeType=0x000000016d7eeb30, parameterLayout=ParameterLayout @ 0x000000016d7eeb18) at juce_AudioProcessorValueTreeState.cpp:261:15
    frame #5: 0x00000001026aafe4 Electrobass`ElectroAudioProcessor::ElectroAudioProcessor(this=0x000000012e024a00) at PluginProcessor.cpp:350:1
    frame #6: 0x00000001026ae264 Electrobass`ElectroAudioProcessor::ElectroAudioProcessor(this=0x000000012e024a00) at PluginProcessor.cpp:352:1
    frame #7: 0x00000001026b7aa4 Electrobass`createPluginFilter() at PluginProcessor.cpp:1580:16
    frame #8: 0x000000010266b1f4 Electrobass`juce::createPluginFilterOfType(type=wrapperType_Standalone) at juce_CreatePluginFilter.h:34:44
    frame #9: 0x00000001026649f0 Electrobass`StandalonePluginHolder::createPlugin(this=0x000000012e023e00) at ElectroStandalone.h:122:26
    frame #10: 0x0000000102663bbc Electrobass`StandalonePluginHolder::StandalonePluginHolder(this=0x000000012e023e00, settingsToUse=0x000000012d008fb0, takeOwnershipOfSettings=false, preferredDefaultDeviceName=0x000000016d7ef0d8, preferredSetupOptions=0x0000000000000000, channels=0x000000016d7ef0c8, shouldAutoOpenMidiDevices=false) at ElectroStandalone.h:83:9
    frame #11: 0x0000000102662fa0 Electrobass`StandalonePluginHolder::StandalonePluginHolder(this=0x000000012e023e00, settingsToUse=0x000000012d008fb0, takeOwnershipOfSettings=false, preferredDefaultDeviceName=0x000000016d7ef0d8, preferredSetupOptions=0x0000000000000000, channels=0x000000016d7ef0c8, shouldAutoOpenMidiDevices=false) at ElectroStandalone.h:74:5
    frame #12: 0x0000000102662b54 Electrobass`StandaloneFilterWindow::StandaloneFilterWindow(this=0x000000012c021600, title=0x000000016d7ef0f0, backgroundColour=Colour @ 0x000000016d7eeff4, settingsToUse=0x000000012d008fb0, takeOwnershipOfSettings=false, preferredDefaultDeviceName=0x000000016d7ef0d8, preferredSetupOptions=0x0000000000000000, constrainToConfiguration=0x000000016d7ef0c8, autoOpenMidiDevices=false) at ElectroStandalone.h:606:33
    frame #13: 0x000000010266274c Electrobass`StandaloneFilterWindow::StandaloneFilterWindow(this=0x000000012c021600, title=0x000000016d7ef0f0, backgroundColour=Colour @ 0x000000016d7ef07c, settingsToUse=0x000000012d008fb0, takeOwnershipOfSettings=false, preferredDefaultDeviceName=0x000000016d7ef0d8, preferredSetupOptions=0x0000000000000000, constrainToConfiguration=0x000000016d7ef0c8, autoOpenMidiDevices=false) at ElectroStandalone.h:583:5
    frame #14: 0x000000010265f6e4 Electrobass`juce::StandaloneFilterApp::createWindow(this=0x000060000248c5a0) at ElectroStandalone.cpp:51:24
    frame #15: 0x000000010265f444 Electrobass`juce::StandaloneFilterApp::initialise(this=0x000060000248c5a0, (null)=0x000000016d7ef160) at ElectroStandalone.cpp:69:31
    frame #16: 0x0000000102a76578 Electrobass`juce::JUCEApplicationBase::initialiseApp(this=0x000060000248c5a0) at juce_ApplicationBase.cpp:297:5
    frame #17: 0x0000000102ca7ff8 Electrobass`juce::JUCEApplication::initialiseApp(this=0x000060000248c5a0) at juce_Application.cpp:92:30
    frame #18: 0x0000000102a762f8 Electrobass`juce::JUCEApplicationBase::main() at juce_ApplicationBase.cpp:256:16
    frame #19: 0x0000000102a76178 Electrobass`juce::JUCEApplicationBase::main(argc=3, argv=0x000000016d7ef3d8) at juce_ApplicationBase.cpp:240:16
    frame #20: 0x00000001026134fc Electrobass`main(argc=3, argv=0x000000016d7ef3d8) at juce_audio_plugin_client_Standalone.cpp:47:1
    frame #21: 0x0000000104f8d0f4 dyld`start + 520
1 Like

The comment explains the problem. You need to explicitly set a version hint on each of your parameters.

There’s more information in the docs, here: JUCE: AudioProcessorParameter Class Reference

It got fixed for me when I replaced the parameterID type from juce::String to juce::ParameterID. EG: std::make_unique<AudioParameterFloat> (ParameterID { "gain", 1 }, "Gain", NormalisableRange<float> (0.0f, 1.0f), 0.9f)

1 Like

@dpolito I’m having a similar issue. Did you ever find a solution?

Thank you! this worked for me. The ParameterID can be found in the documentation here. JUCE: ParameterID Class Reference