[Media_api] Core Midi empty port name problems
Rob King
rob at e-mu.org
Fri Jan 18 09:04:19 PST 2008
Hi there,
I'm trying to use portmidi with my Novation X-Station under OS X
Leopard, and have come across a bug in the part of portmidi that
enumerates the device names on OS X. For some reason it seems as
though the X-Station doesn't name it's individual ports, only the
device, so when I try and run Pm_Initialize with the X-Station it
causes a bus error.
Looking at the traceback, it looks as if the problem is in the
EndpointName function in pmmacosxcm.c. Specifically the call to
CFStringCompareWithOptions on line 686. I suspect it doesn't like
running with an empty string or something...
This patch seems to fix the problem, though I'm not sure if there's a
better way to do it:
676c676,679
< if (str != NULL) {
---
> if (CFStringGetLength(result) == 0){
> CFRelease(result);
> return str;
> }else if (str != NULL) {
Thanks!
Rob
P.S. To whomever just applied the "Fixed bug in midi_length function
in OS X implementation." patch, thank you very much! I was just
running across that nasty problem last night when trying to use
portmidi with ableton, and it was beyond me as to how to fix it!
More information about the media_api
mailing list