systemshock icon indicating copy to clipboard operation
systemshock copied to clipboard

Add native MIDI support for Mac OSX via Core MIDI API

Open HunterZ opened this issue 3 years ago • 2 comments

A couple of years ago I contributed native MIDI support for Windows and Linux, but was not able to do so for Mac OSX because I lacked a workable development environment. This has been remedied, and I was able to implement and test Core MIDI support in an OSX Mojave VM talking to a real Roland SC-88 via a USB-MIDI interface.

As with Windows, support for this is automatically enabled in OSX builds because it's an OS-provided functionality.

File change notes:

  • CMakeLists.txt:
    • link required Core API libraries on OSX
  • src/MusicSrc/MusicDevice.c:
    • include relevant headers for native MIDI support on OSX
    • add Core MIDI handles to native MIDI device struct on OSX
    • change Windows NativeMidiSendMessage() to take a pointer for outHandle so that calling code can stay common between that and OSX
    • add device name lookup utilities from rtmidi library
    • implement Core MIDI based NativeMidiSendMessage() function
    • implement Core MIDI device init/destroy and device query logic
    • update NativeMidiSendMessage() callers to pass outHandle as pointer for Windows and OSX

HunterZ avatar Aug 08 '22 20:08 HunterZ

You can see what I meant with my own pull request to your pull request: https://github.com/HunterZ/systemshock/pull/2

MaddTheSane avatar Jan 25 '23 23:01 MaddTheSane

You can see what I meant with my own pull request to your pull request: HunterZ#2

Thanks. I don't know much about coremidi and was just going off of what examples I could find, so I'm happy to merge in your suggestions.

HunterZ avatar Apr 19 '23 02:04 HunterZ