Portmidi-Mapper
This is a small, incomplete wrapper around the portmidi c library.
It is the successor of my portmidi-ruby project which used ordinary ruby extensions which are a pain to write.
Requirements
-
portmidi (who woulda thought) built as a dynamic library. See below for special notes for Mac OS X Snow Leopard
-
ffi (which in turn needs a sane build env to be installed)
What’s missing?
The most important: Tests. I’m still pondering on how to test a library that has hardware requirements and dependencies (= MIDI hardware). So I guess it means I will mock away the portmidi layer to test my abstractions and add some optional integration test that will require a MIDI loopback configuration.
Implementation wise, there’s a few things missing:
-
Setting Channel- and Message filters
-
Porttime support(not sure I can support that, I guess it needs multithreading, plus: I did not need it until now)
examples/read_test.rb on how to decipher sysex atm.
-
More different exceptions, plus support for Host Errors
-
A lot of safety nets like testing for open devices before reading and writing and such.
What’s coming
-
I’d love to see some explicit support for correctly parsing SysEx, see
Credits
The portmidi wrapper was thrown together by Jan Krutisch <[email protected]>
-
Portmidi C-Library: Roger B. Dannenberg / Portmedia Framework Group
-
Jan ‘half/byte’ Krutisch (github.com/halfbyte)
-
Patches by
-
Thomas Jachmann (github.com/thomasjachmann)
-
Appendix A: Installing Portmidi on OS X Snow leopard
This is a major pita, because currently portmidi doesn’t officially build for 64 bit, which makes it impossible to use with the default Snow Leopard Ruby.
You can try to enable 64 bit support, but I don’t have a frekkin clue what this means. It works for me and my application, but YMMV and I am not responsible for any damage this does to you or your system.
To enable 64 bit compilation (you will see quite a few warnings while compiling), open CMakeLists.txt in the trunk folder and find the following line (around line 39 in my version)
set(CMAKE_OSX_ARCHITECTURES i386 ppc CACHE STRING "do not build for 64-bit" FORCE)
and change it to: (yes, the comment is a bit silly)
set(CMAKE_OSX_ARCHITECTURES i386 ppc x86_64 CACHE STRING "do build for 64-bit" FORCE)
Now you can call
make -f pm_mac/Makefile.osx
if it builds, you can try to install the library. Currently the process seems to be a bit broken, so you actually need to type:
sudo env PF=/usr make -f pm_mac/Makefile.osx install
yes, this sucks - I’m currently trying to find out with the portmidi authors what it would take to fix all this.