[FR] Cannot convolve mono input thru stereo IR

I’m encountering a gotcha in JUCE’s dsp::Convolution

This assert-fails (numInputChannels != numOutputChannels) within the JUCE code:

        juce::dsp::ProcessContextNonReplacing<float> ctx(mono_in, stereo_out);
        convolver.process(ctx);

As a workaround I’ve done this:

    void feed(const dsp::AudioBlock<float> in_mono)
    {
        const float* pointers[] = {
            in_mono.getChannelPointer(0),
            in_mono.getChannelPointer(0)
        };

        AudioBlock<float>tmpBlk((float * const *)&pointers, 2, (int)in_mono.getNumSamples());
        auto outBlock = getOutBlock();

        juce::dsp::ProcessContextNonReplacing<float> ctx(tmpBlk, outBlock);
        convolver.process(ctx);
    }

(consts are not required, it seems)

It avoids allocation or even copying. But it’s clumsy.
Please can we have a fix for this teamJUCE? This is a beautiful component.

There’s another lesser issue: I can’t supply rValues. ctx(getSrcBlock(), getDstBlock()) fails. I think that should be fixable with &&.

NOTE: Maybe clearer to write add_pointer_t<const add_pointer_t<float>> instead of float * const *

Ref: Copy block (mono->stereo)

This code is cleaner (and works):

        float* pointers[] = {
            in_mono.getChannelPointer(0),
            in_mono.getChannelPointer(0)
        };

        AudioBlock<float>tmpBlk(pointers, 2, in_mono.getNumSamples());

The original code was poor form. It works because for T arr[ ];, both arr and &arr give the same memory address.