Recent change can cause feedback-loops

Logic / arm Native

Mono to Stereo AudioUnit Plugin

Feedback Loop on the right channel

The bug was introduced with change below

EDIT: its not a bug, but a change in behaviour, see below

@reuk

git bisect good
6de3af35665206383b47d48038ce0960dc9d509d is the first bad commit
commit 6de3af35665206383b47d48038ce0960dc9d509d

Author: reuk <reuk@users.noreply.github.com>
Date:   Thu Nov 4 15:51:21 2021 +0000

    AU:  Make channel/bus handling more robust

 .../juce_audio_plugin_client/AU/juce_AU_Wrapper.mm |  19 +--
 .../AU/juce_AUv3_Wrapper.mm                        |  34 +++--
 .../format_types/juce_AU_Shared.h                  | 152 +++++++++++----------

Could you supply a few more details about the test procedure please? In particular, it would be useful to know which host you’re testing, and what the processBlock function is doing (is it writing or clearing all output channels?).

I tried adjusting the CMake AudioPlugin example so that it has a mono input and stereo output, then adjusted the processBlock to copy the input channel to all output channels like so:

void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer,
                                              juce::MidiBuffer&)
{
    juce::ScopedNoDenormals noDenormals;
    auto totalNumOutputChannels = getTotalNumOutputChannels();
    
    auto* input = buffer.getReadPointer (0);

    for (int channel = 0; channel < totalNumOutputChannels; ++channel)
        std::copy (input, input + buffer.getNumSamples(), buffer.getWritePointer (channel));
}

When I loaded this in the AudioPluginHost and played some audio through it, I didn’t hear any feedback.

Would you expect this test to reveal the problem, or are you testing in some other way?

Hi reuk,
I’m testing in Apple Logic Arm Native.
Channelstrip with two mono plugins and then one with mono to stereo. It’s a reverb which creates two different signals L/R.
I have more information tomorrow.

UPDATE:

My plugin (unknowingly) relied on the behaviour that unused input-buffers are silenced automatically, so this is clearly my fault. This has changed, so unused input channels may contain garbage.

It was correctly documented, but maybe you should add this to the breaking changes document, or undo the behaviour, other peoples code might rely on it too.