class UniMIDI::Loader
Populate UniMIDI
devices using the underlying device objects from the platform-specific gems
Public Class Methods
devices(options = {})
click to toggle source
Get all MIDI devices @param [Hash] options @option options [Symbol] :direction Return only a particular direction of device eg :input, :output @return [Array<Input>, Array<Output>]
# File lib/unimidi/loader.rb, line 18 def devices(options = {}) 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 options[:direction].nil? ? @devices.values.flatten : @devices[options[:direction]] end
use(loader)
click to toggle source
Use the given platform-specific adapter to load devices @param [UniMIDI::Adapter::Loader] loader
# File lib/unimidi/loader.rb, line 10 def use(loader) @loader = loader end