Skip to content

Commit

Permalink
Added fix for Snow Leopard
Browse files Browse the repository at this point in the history
  • Loading branch information
chubas committed Dec 11, 2010
1 parent eada73d commit c65d669
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/midiator/drivers/core_midi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
require 'midiator/driver_registry'

class MIDIator::Driver::CoreMIDI < MIDIator::Driver # :nodoc:

# Figure out if we have SnowLeopard
SNOW_LEOPARD = = `uname -r` =~ /10\.\d\.\d/

##########################################################################
### S Y S T E M I N T E R F A C E
##########################################################################
Expand All @@ -35,7 +39,11 @@ module C # :nodoc:
extern "void* MIDIGetDestination( int )"
extern "int MIDIOutputPortCreate( void*, void*, void* )"
extern "void* MIDIPacketListInit( void* )"
extern "void* MIDIPacketListAdd( void*, int, void*, int, int, int, void* )"
if SNOW_LEOPARD
extern "void* MIDIPacketListAdd( void*, int, void*, int, int, void* )"
else
extern "void* MIDIPacketListAdd( void*, int, void*, int, int, int, void* )"
end
extern "int MIDISend( void*, void*, void* )"
end

Expand Down Expand Up @@ -75,7 +83,11 @@ def message( *args )
packet_ptr = C.mIDIPacketListInit( packet_list )

# Pass in two 32-bit 0s for the 64 bit time
packet_ptr = C.mIDIPacketListAdd( packet_list, 256, packet_ptr, 0, 0, args.size, bytes )
if SNOW_LEOPARD
packet_ptr = C.mIDIPacketListAdd( packet_list, 256, packet_ptr, 0, args.size, bytes )
else
packet_ptr = C.mIDIPacketListAdd( packet_list, 256, packet_ptr, 0, 0, args.size, bytes )
end

C.mIDISend( @outport, @destination, packet_list )
end
Expand Down

0 comments on commit c65d669

Please sign in to comment.