Class: UniMIDI::Loader
- Inherits:
-
Object
- Object
- UniMIDI::Loader
- Defined in:
- lib/unimidi/loader.rb
Overview
Populate UniMIDI devices using the underlying device objects from the platform-specific gems
Class Method Summary collapse
-
.devices(options = {}) ⇒ Array<Input>, Array<Output>
Get all MIDI devices.
-
.use(loader) ⇒ Object
Use the given platform-specific adapter to load devices.
Class Method Details
.devices(options = {}) ⇒ Array<Input>, Array<Output>
Get all MIDI devices
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/unimidi/loader.rb', line 18 def devices( = {}) if @devices.nil? inputs = @loader.inputs.map { |device| ::UniMIDI::Input.new(device) } outputs = @loader.outputs.map { |device| ::UniMIDI::Output.new(device) } @devices = { :input => inputs, :output => outputs } end [:direction].nil? ? @devices.values.flatten : @devices[[:direction]] end |
.use(loader) ⇒ Object
Use the given platform-specific adapter to load devices
10 11 12 |
# File 'lib/unimidi/loader.rb', line 10 def use(loader) @loader = loader end |