MIDI input crashing device after heavy data flow

Hey gang,
So the ios app I’m developing needs to accept midi input. Everything goes fine until the external MIDI device starts sending too much data, then it seems like an internal iOS buffer fills up and the app stop processing the MIDI. But what’s weird is that I have to reset the Midi device!
This suggests that my app isn’t processing the MIDI fast enough, but I’m not doing anything silly like updating the GUI and the like, so any tips would be great.

To collect the messages I’m using a MidiMessageCOllector and calling removeNextBlockOfMessages to fill a MIDIBuffer every audio block. Then, straight after I iterate through the buffer like so:

MidiBuffer::Iterator itr(midiBuffer);
MidiMessage result;
int samplePosition;
while (itr.getNextEvent(result, samplePosition)) {
midiHandler->processMessage(result);
}

The processMessage method does some minor processing and calls a noteOns and control changes on a Synthesiser class.

Any ideas?

Thanks

Do you have a stack trace or something. This is strange as we use JUCE with ROLI’s NOISE app, together with the Seaboard. The seaboard sends huge amounts of midi data and we haven’t seen anything similar.

It doesn’t crash, that’s the thing. The app keeps running, and if you use the GUI the audio is still being processed. What happens is the MIDI stops being processed. It’s like the MIDI thread is trying to do too much and can’t process the messages fast enough so some internal queue is growing and growing. Disconnecting the MIDI and reattaching it makes it work again.

… need to download the black midi file again. I’ll do some testing.

1 Like

Thanks for that reference to “black midi files”. Never heard about his before.

1 Like

I’m still investigating this. It’s really odd, I can’t reproduce this when I directly connect a Seaboard RISE (or other instruments) to the JUCE iOS app. I also can’t reproduce it with a black midi sent live from my computer (quite surprising actually). However, in some DAWs, when I route an instrument connected to my computer (such as the Seaboard) to the iPhone, the iOS app really locks up. This happens in Tracktion for example, but not in Digital Performer. I’m struggling to figure out what the difference is in the midi stream that is being sent.