module AlsaRawMIDI::Device::ClassMethods
Public Instance Methods
all()
click to toggle source
All devices @return [Array<Input, Output>]
# File lib/alsa-rawmidi/device.rb, line 30 def all all_by_type.values.flatten end
all_by_type()
click to toggle source
A hash of devices, partitioned by direction @return [Hash]
# File lib/alsa-rawmidi/device.rb, line 24 def all_by_type @devices ||= get_devices end
first(direction)
click to toggle source
Select the first device of the given direction @param [Symbol] direction @return [Input, Output]
# File lib/alsa-rawmidi/device.rb, line 11 def first(direction) all_by_type[direction].first end
last(direction)
click to toggle source
Select the last device of the given direction @param [Symbol] direction @return [Input, Output]
# File lib/alsa-rawmidi/device.rb, line 18 def last(direction) all_by_type[direction].last end
Private Instance Methods
get_devices()
click to toggle source
Get all available devices from the system @return [Hash]
# File lib/alsa-rawmidi/device.rb, line 38 def get_devices available_devices = { :input => [], :output => [] } device_count = 0 32.times do |i| card = Soundcard.find(i) unless card.nil? available_devices.keys.each do |direction| devices = card.subdevices[direction] devices.each do |dev| dev.send(:id=, device_count) device_count += 1 end available_devices[direction] += devices end end end available_devices end