Module: AlsaRawMIDI::Device::ClassMethods

Included in:
AlsaRawMIDI::Device
Defined in:
lib/alsa-rawmidi/device.rb

Instance Method Summary collapse

Instance Method Details

#allArray<Input, Output>

All devices

Returns:



30
31
32
# File 'lib/alsa-rawmidi/device.rb', line 30

def all
  all_by_type.values.flatten
end

#all_by_typeHash

A hash of devices, partitioned by direction

Returns:

  • (Hash)


24
25
26
# File 'lib/alsa-rawmidi/device.rb', line 24

def all_by_type
  @devices ||= get_devices
end

#first(direction) ⇒ Input, Output

Select the first device of the given direction

Parameters:

  • direction (Symbol)

Returns:



11
12
13
# File 'lib/alsa-rawmidi/device.rb', line 11

def first(direction)
  all_by_type[direction].first
end

#last(direction) ⇒ Input, Output

Select the last device of the given direction

Parameters:

  • direction (Symbol)

Returns:



18
19
20
# File 'lib/alsa-rawmidi/device.rb', line 18

def last(direction)
  all_by_type[direction].last
end