Jassert in CoreAudioBufferList::pop()

The jassert happens in an AUv3 built with the develop branch, loaded in iOS Garageband – not sure why, but it happens (very reliably) when I’m summoning a texteditor component.

float* pop() noexcept
    jassert (popIdx < scratch.getNumChannels());
    return channels[popIdx++];

scratch.getNumChannels is equal to 2, and popIdx is equal to 2 when the jassert is fired.

The pop() function is called at the end of the renderCallback from juce_AUv3_Wrapper.mm

It seems that when the assert happens, the renderCallback is called with the ‘if (lastTimeStamp.mSampleTime != timestamp->mSampleTime)’ being false, hence ‘audioBuffer.reset()’ is not called for that renderCallback, so popIdx is not reset to 0. Calling ‘audioBuffer.reset()’ when ‘lastTimeStamp.mSampleTime == timestamp->mSampleTime’ fixes the issue, although I don’t know if it is a good fix or an horrible one !

ok it was an horrible fix because I’m still getting a crash in the pop() function – my current fix is to put the

// copy back
            audioBuffer.pop (*outBusBuffers[(int) outputBusNumber]->get(),
                             mapper.get (false, (int) outputBusNumber));

inside the

if (lastTimeStamp.mSampleTime != timestamp->mSampleTime)
{ ...     }

Would it be possible for you to provide a minimal working example? I can’t reproduce the problem in a simple app.

I can trigger it with this modification to the juce AUv3SynthPluginDemo:

class AUv3SynthEditor   : public AudioProcessorEditor,
                          private Timer
  + TextEditor editor;
    AUv3SynthEditor (AudioProcessor& processor)
        :   AudioProcessorEditor (processor),
            roomSizeSlider (Slider::LinearHorizontal, Slider::NoTextBox)
        LookAndFeel::setDefaultLookAndFeel (&materialLookAndFeel);

      + editor.setBounds(0, 300, 400, 40);
      + addAndMakeVisible(editor);

        roomSizeSlider.setValue (getParameterValue ("roomSize"), NotificationType::dontSendNotification);

It does not happen 100% of the time on my iPad, but 10% of the time I get the “JUCE Assertion failure in juce_AU_Shared.h:189” after clicking in the text editor of the AUv3 in Garageband

Thanks for that.

Only popping inside the conditional seems to be the way to go here. I’ve just pushed a fix to the develop branch, but I’m a little concerned that I don’t know what Apple expects to happen with repeated timestamps…

1 Like