I have an application that’s based around AudioProcessors, and so far I haven’t run into any issues with cross-platform compatibility. However, I recently started using custom AudioProcessors that rely heavily on MidiBuffers, including one that copies events from the MidiBuffer passed to the process() method into a second MidiBuffer, and then draws graphics based on the contents of the second buffer.
I didn’t think there was anything inherently wrong with this, since everything runs smoothly on Linux. But on OS X (10.8, Xcode 4.6.2), including these AudioProcessors in the AudioProcessorGraph causes my application to crash randomly when starting or stopping audio callbacks. Sometimes I can toggle the callbacks dozens of times without any problems; other times it crashes on the first try. The only consistent thing is that the error always happens inside runDispatchLoop(). Common failure points include JuceMainMenuHandler::updateMenuBar() and JuceNSViewComponentPeer::drawRect(), and it almost always ends with a line of machine code.
Has anyone encountered this problem before? Are there any red flags based on what I’ve described? Any obvious solutions? So far I’ve tried adding MessageManagerLocks in various places, but to no avail.
I updated the JUCE library for my project 6 days ago. FWIW, I changed some code inside MidiBuffer::addEvent() and MidiMessage::getMessageLengthFromFirstByte() in order to send messages of longer than 3 bytes. I can include the changes if you think it might be relevant, but I’m not seeing any errors related to these lines.