Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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