Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanging notes when hosting AUv3 plugins on iOS #143

Open
mathieugarcia opened this issue Feb 21, 2023 · 0 comments
Open

Hanging notes when hosting AUv3 plugins on iOS #143

mathieugarcia opened this issue Feb 21, 2023 · 0 comments

Comments

@mathieugarcia
Copy link

mathieugarcia commented Feb 21, 2023

Hey,

For clarity I am opening a new, separate issue as I'm currently debugging and stress testing the hosting of AUv3 plugins on iOS.

I noticed some MIDI messages are completely discarded which can result in hanging notes as they don't reach the AudioUnitPluginInstance.

In MidiInputDeviceNode::processSection(), we can see this bit of code which discards scheduled MIDI events if the last block took too long to process:

    // if it's been a long time since the last block, clear the buffer because
    // it means we were muted or glitching
    if (timeNow > lastReadTime + maxExpectedMsPerBuffer)
    {
        //jassertfalse
        numMessages = 0;
    }

maxExpectedMsPerBuffer is calculated this way in MidiInputDeviceNode::prepareToPlay() :

maxExpectedMsPerBuffer = (unsigned int) (((info.blockSize * 1000) / info.sampleRate) * 2 + 100);

BTW, blockSize is 282 in my case, adjusted from the 256 samples latency in EditPlaybackContext::setNode() :

blockSize = juce::roundToInt (blockSize * (1.0 + (10.0 * 0.01))); // max speed comp

While I understand it might be necessary to flush accumulated or old MIDI messages, it's quite easy for this check to be triggered even with just one plugin running.

I wonder if this could be rendered optional, or, make the check slightly more accurate.

BTW, I am feeding MIDI events through a VirtualMidiDevice connected to an AudioTrack hosting an ExternalPlugin.

Even in release mode and with just one plugin this issue arise.

Happy to discuss solutions with the team to make hosting AUv3 on iOS rock solid!

Thanks in advance,

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant