Class: MIDIator::Driver::CoreMIDI
- Inherits:
-
MIDIator::Driver
- Object
- MIDIator::Driver
- MIDIator::Driver::CoreMIDI
- Defined in:
- lib/midiator/drivers/core_midi.rb
Overview
:nodoc:
Defined Under Namespace
Constant Summary
Constants inherited from MIDIator::Driver
Instance Method Summary collapse
- #close ⇒ Object
- #message(*args) ⇒ Object
-
#open ⇒ Object
D R I V E R A P I.
Methods inherited from MIDIator::Driver
#aftertouch, #channel_aftertouch, #control_change, inherited, #initialize, #note_off, #note_on, #pitch_bend, #program_change
Constructor Details
This class inherits a constructor from MIDIator::Driver
Instance Method Details
#close ⇒ Object
67 68 69 |
# File 'lib/midiator/drivers/core_midi.rb', line 67 def close C.mIDIClientDispose( @client ) end |
#message(*args) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/midiator/drivers/core_midi.rb', line 71 def ( *args ) format = "C" * args.size bytes = args.pack( format ).to_ptr packet_list = DL.malloc( 256 ) 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 ) C.mIDISend( @outport, @destination, packet_list ) end |
#open ⇒ Object
D R I V E R A P I
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/midiator/drivers/core_midi.rb', line 53 def open client_name = CF.cFStringCreateWithCString( nil, "MIDIator", 0 ) @client = DL::PtrData.new( nil ) C.mIDIClientCreate( client_name, nil, nil, @client.ref ) port_name = CF.cFStringCreateWithCString( nil, "Output", 0 ) @outport = DL::PtrData.new( nil ) C.mIDIOutputPortCreate( @client, port_name, @outport.ref ) number_of_destinations = C.mIDIGetNumberOfDestinations raise MIDIator::NoMIDIDestinations if number_of_destinations < 1 @destination = C.mIDIGetDestination( 0 ) end |