Module: MicroMIDI::Device
Overview
Deal with MIDI devices
Instance Method Summary collapse
-
#get_inputs(*args) ⇒ Array<UniMIDI::Input>
Select the MIDI inputs from the given objects.
-
#get_outputs(*args) ⇒ Array<UniMIDI::Output, IO>
Select the MIDI outputs from the given objects.
-
#input?(device) ⇒ Boolean
Is the given device a MIDI input?.
-
#output?(device) ⇒ Boolean
Is the given device a MIDI output?.
Instance Method Details
#get_inputs(*args) ⇒ Array<UniMIDI::Input>
Select the MIDI inputs from the given objects
25 26 27 |
# File 'lib/micromidi/device.rb', line 25 def get_inputs(*args) [args].flatten.select { |device| input?(device) } end |
#get_outputs(*args) ⇒ Array<UniMIDI::Output, IO>
Select the MIDI outputs from the given objects
32 33 34 |
# File 'lib/micromidi/device.rb', line 32 def get_outputs(*args) [args].flatten.select { |device| output?(device) } end |
#input?(device) ⇒ Boolean
Is the given device a MIDI input?
11 12 13 |
# File 'lib/micromidi/device.rb', line 11 def input?(device) device.respond_to?(:type) && device.type == :input && device.respond_to?(:gets) end |
#output?(device) ⇒ Boolean
Is the given device a MIDI output?
18 19 20 |
# File 'lib/micromidi/device.rb', line 18 def output?(device) device.respond_to?(:puts) end |