diff --git a/PortMidi.cabal b/PortMidi.cabal index e960536..acf818f 100644 --- a/PortMidi.cabal +++ b/PortMidi.cabal @@ -42,7 +42,6 @@ Library else if os(darwin) include-dirs: portmidi/pm_common portmidi/pm_mac portmidi/porttime - cc-options: -msse2 c-sources: portmidi/pm_common/pmutil.c portmidi/pm_common/portmidi.c diff --git a/portmidi/pm_mac/pmmacosxcm.c b/portmidi/pm_mac/pmmacosxcm.c index 999e41c..b5d76aa 100644 --- a/portmidi/pm_mac/pmmacosxcm.c +++ b/portmidi/pm_mac/pmmacosxcm.c @@ -56,10 +56,12 @@ #define MIDI_SYSEX 0xf0 #define MIDI_EOX 0xf7 #define MIDI_STATUS_MASK 0x80 +#define MIDI_NULL 0 +#define INT2VOIDP(i) (void *)(uintptr_t)(i) -static MIDIClientRef client = NULL; /* Client handle to the MIDI server */ -static MIDIPortRef portIn = NULL; /* Input port handle */ -static MIDIPortRef portOut = NULL; /* Output port handle */ +static MIDIClientRef client = MIDI_NULL; /* Client handle to the MIDI server */ +static MIDIPortRef portIn = MIDI_NULL; /* Input port handle */ +static MIDIPortRef portOut = MIDI_NULL; /* Output port handle */ extern pm_fns_node pm_macosx_in_dictionary; extern pm_fns_node pm_macosx_out_dictionary; @@ -648,9 +650,9 @@ CFStringRef EndpointName(MIDIEndpointRef endpoint, bool isExternal) CFRelease(str); } - MIDIEntityRef entity = NULL; + MIDIEntityRef entity = MIDI_NULL; MIDIEndpointGetEntity(endpoint, &entity); - if (entity == NULL) + if (entity == MIDI_NULL) // probably virtual return result; @@ -664,9 +666,9 @@ CFStringRef EndpointName(MIDIEndpointRef endpoint, bool isExternal) } } // now consider the device's name - MIDIDeviceRef device = NULL; + MIDIDeviceRef device = MIDI_NULL; MIDIEntityGetDevice(entity, &device); - if (device == NULL) + if (device == MIDI_NULL) return result; str = NULL; @@ -890,7 +892,7 @@ PmError pm_macosxcm_init(void) /* Iterate over the MIDI input devices */ for (i = 0; i < numInputs; i++) { endpoint = MIDIGetSource(i); - if (endpoint == NULL) { + if (endpoint == MIDI_NULL) { continue; } @@ -900,13 +902,13 @@ PmError pm_macosxcm_init(void) /* Register this device with PortMidi */ pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint), - TRUE, (void*)endpoint, &pm_macosx_in_dictionary); + TRUE, INT2VOIDP(endpoint), &pm_macosx_in_dictionary); } /* Iterate over the MIDI output devices */ for (i = 0; i < numOutputs; i++) { endpoint = MIDIGetDestination(i); - if (endpoint == NULL) { + if (endpoint == MIDI_NULL) { continue; } @@ -916,7 +918,7 @@ PmError pm_macosxcm_init(void) /* Register this device with PortMidi */ pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint), - FALSE, (void*)endpoint, &pm_macosx_out_dictionary); + FALSE, INT2VOIDP(endpoint), &pm_macosx_out_dictionary); } return pmNoError; @@ -929,7 +931,7 @@ PmError pm_macosxcm_init(void) void pm_macosxcm_term(void) { - if (client != NULL) MIDIClientDispose(client); - if (portIn != NULL) MIDIPortDispose(portIn); - if (portOut != NULL) MIDIPortDispose(portOut); + if (client != MIDI_NULL) MIDIClientDispose(client); + if (portIn != MIDI_NULL) MIDIPortDispose(portIn); + if (portOut != MIDI_NULL) MIDIPortDispose(portOut); }