Class: RtMidi::Out
- Inherits:
-
Object
- Object
- RtMidi::Out
- Defined in:
- lib/rtmidi/out.rb
Overview
Ruby representation of a RtMidiOut C++ object
Instance Method Summary collapse
-
#close_ports ⇒ Object
Close all opened ports.
-
#initialize ⇒ Out
constructor
Create a new RtMidiOut wrapper object.
-
#open_port(index) ⇒ Object
Open the MIDI output port at the given index.
-
#port_count ⇒ Object
The number of MIDI output ports available.
-
#port_name(index) ⇒ Object
The name of the MIDI output port at the given index.
-
#port_names ⇒ Object
The list of all MIDI output port names.
-
#send_message(byte1, byte2, byte3 = 0) ⇒ Object
Send a 3-byte MIDI channel message to the opened port.
Constructor Details
Instance Method Details
#close_ports ⇒ Object
Close all opened ports.
45 46 47 |
# File 'lib/rtmidi/out.rb', line 45 def close_ports() Interface::midiout_close_port(@midiout) end |
#open_port(index) ⇒ Object
Open the MIDI output port at the given index.
40 41 42 |
# File 'lib/rtmidi/out.rb', line 40 def open_port(index) Interface::midiout_open_port(@midiout, index) end |
#port_count ⇒ Object
The number of MIDI output ports available.
14 15 16 |
# File 'lib/rtmidi/out.rb', line 14 def port_count @port_count ||= Interface::midiout_port_count(@midiout) end |
#port_name(index) ⇒ Object
The name of the MIDI output port at the given index.
20 21 22 |
# File 'lib/rtmidi/out.rb', line 20 def port_name(index) port_names[index] end |
#port_names ⇒ Object
The list of all MIDI output port names.
The index of a port in this list is the index to be passed to #port_name and #open_port.
30 31 32 33 34 35 36 |
# File 'lib/rtmidi/out.rb', line 30 def port_names @port_namess ||= ( names = [] port_count.times{|i| names << Interface::midiout_port_name(@midiout, i) } names ) end |
#send_message(byte1, byte2, byte3 = 0) ⇒ Object
Send a 3-byte MIDI channel message to the opened port.
Some channel messages only have 2 bytes in which case the 3rd byte is ignored.
53 54 55 |
# File 'lib/rtmidi/out.rb', line 53 def (byte1, byte2, byte3=0) Interface::(@midiout, byte1, byte2, byte3) end |