JUCE Assertion failure in juce_NormalisableRange.h:272 (lldb)

Hi!

Every time I run the Audio Plugin Host in Xcode it immediately quits and I get:

jassert (clampedValue == value);
JUCE Message Thread (1): EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

JUCE Assertion failure in juce_NormalisableRange.h:272
(lldb)

It was previously working fine but now just compiling the AudioPluginHost causes a crash. I haven’t altered anything in the code and tried compiling the latest one from GitHub with no success. Is this an Xcode issue? I’m brand new to JUCE and programming in general so excuse me if i’m being stupid.

Cheers!

Ricki

Note that jassert() is a wrapper for the C++ assertion function. It will cause the program to halt just to show you that something isn’t right, but the program can actually continue normally if you choose ‘Continue’ in the debugger.

That specific assertion in juce::NormalisableRange is for out of range numbers. This could be due to a parameter range changing, causing saved data to suddenly not be “in-range”. It basically happens any time you try converting a number and the result isn’t between 0.0 and 1.0.

An example that will make that assertion fire is:

#include "../JuceLibraryCode/JuceHeader.h"

int main (int argc, char* argv[])
{
    NormalisableRange<float> range(0.0f, 100.0f);
    range.convertTo0to1(-50.0f);
    return 0;
}

When the assertion hits, you can use the stack trace view in Xcode’s left panel… the little sandwich looking icon :slight_smile: It will let you see up the chain of function calls and find where the problem is really occurring.

To take the previous example, the assertion happens in NormalisableRange::clampTo0To1(), but the cause of all of it was us calling NormalisableRange::convertTo0to1() with an out-of-range number from within our main() function:

Not sure why the AudioHost project is causing the assertion to happen… but this should at least help you find the source of the problem!

1 Like

Looking through the stack trace view, I’ve realized I saved a preset layout within the host which it is trying to load every time I open it. My guess is that there is an issue with the plugin I’ve built, crashing the Plug-in Host.

Is there a preferences file or something that I can trash to get back to the original layout?

Thanks for your help!

Not sure where the host actually keeps that data… but you may be able to just continue in the debugger and eventually the assertion should stop. I’m assuming it’s just trying to set the values once, so it will end up hitting the assertion once for each parameter and then it will be fine.

The continue function for the debugger is available in the menu

01%20PM

or in the bottom panel (the ‘play’ button right of blue arrow)

47%20PM

After clicking the continue button multiple times I was able to get the app running for long enough to save a new layout and it is now working fine.

Once again, thank you!

1 Like