JUCE v8.0.6: Message Thread (1): EXC_BREAKPOINT (code=1, subcode=0x1010fa3ec)

Hello warm comunity

PluginProcessor.h:

class TestProcessor  : public juce::AudioProcessor
{
public:
   ....
    void setInMixState(bool newState);
    bool getInMixState() const;
    
    void updateFilters();
    
private:
    //==============================================================================
    bool warmButtonState = false;
    bool inMixState = true;
    
    juce::dsp::ProcessorChain<juce::dsp::IIR::Filter<float>, juce::dsp::IIR::Filter<float>,
                              juce::dsp::IIR::Filter<float>, juce::dsp::IIR::Filter<float>> filterChain;

    juce::AudioProcessorValueTreeState parameters;

    std::atomic<float>* hfFreq;
    ...
    
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TestProcessor)
};

PluginProcessor.cpp:

TestProcessor::TestProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
     : AudioProcessor (BusesProperties()
                     #if ! JucePlugin_IsMidiEffect
                      #if ! JucePlugin_IsSynth
                       .withInput  ("Input",  juce::AudioChannelSet::stereo(), true)
                      #endif
                       .withOutput ("Output", juce::AudioChannelSet::stereo(), true)
                     #endif
                       ),
      parameters(*this, nullptr, juce::Identifier("TestParameters"),
                 {
                  std::make_unique<juce::AudioParameterFloat>("HF_FREQ", "HF Frequency", 1500.0f, 16000.0f, 8750.0f),
                  ...
    )})
{    
    hfFreq = parameters.getRawParameterValue("HF_FREQ");

    updateFilters();
}
#endif

Compile…successed but…

I suspect that I don’t fully understand how this should be written correctly. I would be very grateful for the clarification and really appreciate any correction of the mistake.

To avoid wasting anyone’s time, I did some debugging of my code and found that when I add a line, everything breaks.

std::make_unique<juce::AudioParameterFloat>("HF_FREQ", "HF Frequency", 1500.0f, 16000.0f, 8750.0f),

The break line tells you the reason. The ParameterID constructor needs a string AND a versionHint, e.g.,

std::make_unique<juce::AudioParameterFloat>(juce::ParameterID("HF_FREQ", 0), "HF Frequency", 1500.0f, 16000.0f, 8750.0f),

BTW you may want to use log-scale for frequency parameters.

the same :frowning:

I tested example from: parameters.createAndAddParameter(std::make_uniquejuce::AudioParameterFloat(“hpfFreq”,
“HPF Frequency”, juce::NormalisableRange(20.0f, 20000.0f, 1.0f, 0.25f), 20.0f, “Hz”));

and got the same

Sorry about that. Please change the versionHint number to any integer other than 0. It cannot be 0. I somehow forgot that.

1 Like