Error when Creating IR Reverb Plugin with JUCE::dsp::convolution

Hi, relatively new to JUCE and just want to make a simple convolution reverb with 1 IR response for now but struggling it get it working.

Currently I am using binary data of my IR response.

here is my relevant code:

AudioProcessor:

Convolution_TestAudioProcessor::Convolution_TestAudioProcessor()
#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
)
#endif
{
// initialisation
irChoice.reset(new juce::AudioParameterChoice(
“ir”,
“Impulse Response”,
juce::StringArray { “Church” },
0
));
addParameter(irChoice.get());

currentIRIndex = 0;

}

Prepare to Play:

void Convolution_TestAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{

juce::dsp::ProcessSpec spec;
spec.maximumBlockSize = samplesPerBlock;
spec.sampleRate = sampleRate;
spec.numChannels = getTotalNumOutputChannels();

convolution.reset();
convolution.prepare(spec);


convolution.loadImpulseResponse(
    BinaryData::IR_Church_UpstairsXY_Stereo_wav,
    BinaryData::IR_Church_UpstairsXY_Stereo_wavSize,
    juce::dsp::Convolution::Stereo::yes,
    juce::dsp::Convolution::Trim::yes,
    0,
    juce::dsp::Convolution::Normalise::yes
);


currentIRIndex = 0; 

}

Process block:

void Convolution_TestAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();

// Clear any unused output channels
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
    buffer.clear(i, 0, buffer.getNumSamples());

juce::dsp::AudioBlock<float> block {buffer};

if (convolution.getCurrentIRSize() > 0)
{
    convolution.process(juce::dsp::ProcessContextReplacing<float>(block));
}

}

Header file:

private:

juce::dsp::Convolution convolution;

std::unique_ptr<juce::AudioParameterChoice> irChoice;
int currentIRIndex;

When I build a standalone plugin, it says build succeeded but then process to cut off and give me an error with a breakpoint in this section:

"void checkInvariants() const
{
jassert (end > start);
jassert (interval >= ValueType());
jassert (skew > ValueType());
}
"

And if I build with all then it says “Command PhaseScriptExecution failed with a nonzero exit code”

Not too sure what is wrong I have followed the documentation quite thoroughly, does anyone know what is wrong? Does it matter that I’ve used binary data or should I input the IR .wav straight in?

Hope someone can help :slight_smile:

Just a quick guess : when you create the ChoiceParameter, it doesn’t like that you only have one entry (“church”) for that. (But without seeing the call stack, difficult to say for sure it’s about that.)

Can I just delete that then because I set that up if in the future I want to add other IRs but I guess it’s not needed?