jonas-k / coremidi-sys

Low level Rust bindings for CoreMIDI
MIT License
8 stars 5 forks source link

MIDI 2.0 support #15

Open chris-zen opened 2 years ago

chris-zen commented 2 years ago

Hi, I'm the maintainer of the coremidi crate, I was willing to update it to support MIDI 2.0, and replace all the deprecated functions. But I'd like to check with you first to see what work would be necessary in coremidi-sys. Also I saw that the MIDI-CI stuff is written in Obj-C and I'm not experienced with bindgen, and less for Obj-C.

Looking forward to hearing from you.

jonas-k commented 2 years ago

Hey chris-zen,

thanks for reaching out and for even making a pull request. The update brings the changes in MIDIServices.h into the rust bindings. This is not enough though to support MIDI 2.0 CI. Bindgen supports Objective-C, but we'd have to feed it multiple headers. I wrote a short rust script that generates the bindings and allows using multiple headers. I'm also considering to generate bindings for all of CoreMIDI to have support for all the headers.

chris-zen commented 2 years ago

Hi @jonas-k , yes I agree that there is still a lot to do to have the full MIDI 2 spec covered, but for now, with this PR I'll be able to support the UMP format using the new CoreMIDI EventList abstraction.

I was thinking on the same, I personally would create a different generated module per header file for all the CoreMIDI headers, which would allow the coremidi crate to provide higher level abstractions for other aspects of CoreMIDI such as devices, networking, and so on.

As of bindgen, did you see my PR? I propose a variation of the bindgen command that is able to pick headers from multiple frameworks. Although I would personally follow the bindgen tutorial and include the generation process as part of the build.rs file, it could look for an environment variable to know the root folder for all the frameworks and skip the generation if it doesn't exist.

About MIDI-CI, this is something I would love to have support for, but I'm not very familiar with bindgen and Obj-C.

I propose we go step by step, and focus now on the PR #16 required to support EventList (see my ongoing work here).