krevis / MIDIApps

MIDI apps for Mac OS X: MIDI Monitor and SysEx Librarian.
http://www.snoize.com/
BSD 3-Clause "New" or "Revised" License
712 stars 112 forks source link

MIDIMonitor: crash when using device IAC and many notes sent at once #112

Closed bwagner closed 1 year ago

bwagner commented 1 year ago

To reproduce: activate IAC Driver start MIDI Monitor in Terminal: sendmidi dev iac panic MIDI Monitor crashes

Does only occasionally occur when using a hardware MIDI device, i.e. sendmidi dev micro panic

midi_monitor_crash.txt

when issuing the command sendmidi dev iac panic the following sequence is repeated for all 16 MIDI channels:

control-change    64     0 # "Damper Pedal" or "Sustain" OFF
control-change   120     0 # "All Sound Off"
control-change   123     0 # "All Notes Off"
note-off         C-2   0
note-off         C#-2   0
...
note-off         F#8   0
note-off         G8   0

resulting in 2096 midi messages, each 3 bytes in quick succession.

krevis commented 1 year ago

Thanks for the repro case, that's very helpful. Investigating.

The crash is in code that gets MIDI data from the "spying" MIDI driver. If you turn off "Spy on output to destinations > IAC Driver Bus 1", then it's fine.

krevis commented 1 year ago

My fault. SpyingMIDIDriver::SizeOfPacketList is very old and does not account for the 4-byte alignment of MIDIPackets on Apple Silicon processors.

krevis commented 1 year ago

Will do a release of MIDI Monitor 1.5.4 shortly!

bwagner commented 1 year ago

Interesting: After installing 1.5.4 I still get a crash in that situation. midi_monitor_crash2.txt

krevis commented 1 year ago

The bug fix was actually in the driver that gets installed into ~/Library/Audio/MIDI Drivers/MIDI Monitor.plugin.

So a few things might have gone wrong:

  1. When the new version of the app ran for the first time, it should have updated that driver. Check whether it's version 1.5.4.
  2. If you moved that driver away from its installed location, perhaps into /Library/Audio/MIDI Drivers, then that old copy might be getting used instead. Check for any copies and remove them. The one in ~/Library/Audio/MIDI Drivers ought to work.
  3. If some other app or process has been using CoreMIDI, it will be keeping the MIDIServer process alive, with the old driver code. Try quitting all apps that use MIDI, wait a few moments, then launch MIDI Monitor again and try again. Or, to be completely foolproof, log out and in again, or just restart the whole computer.

Let me know if that none of those help.

bwagner commented 1 year ago

restarted my computer and now it works. Thank you!