Module: MIDIJRuby::Device
Overview
Common methods used by both input and output devices
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
has the device been initialized?.
-
#enabled ⇒ Object
(also: #enabled?)
readonly
has the device been initialized?.
-
#id ⇒ Object
readonly
has the device been initialized?.
-
#name ⇒ Object
readonly
has the device been initialized?.
-
#type ⇒ Object
readonly
has the device been initialized?.
-
#vendor ⇒ Object
readonly
has the device been initialized?.
Class Method Summary collapse
-
.all ⇒ Array<Input, Output>
All devices of both directions.
-
.all_by_type ⇒ Hash
A hash of :input and :output devices.
-
.first(direction) ⇒ Input, Output
Select the first device of the given direction.
-
.last(direction) ⇒ Input, Output
Select the last device of the given direction.
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object (readonly)
has the device been initialized?
6 7 8 |
# File 'lib/midi-jruby/device.rb', line 6 def description @description end |
#enabled ⇒ Object (readonly) Also known as: enabled?
has the device been initialized?
6 7 8 |
# File 'lib/midi-jruby/device.rb', line 6 def enabled @enabled end |
#id ⇒ Object (readonly)
has the device been initialized?
6 7 8 |
# File 'lib/midi-jruby/device.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
has the device been initialized?
6 7 8 |
# File 'lib/midi-jruby/device.rb', line 6 def name @name end |
#type ⇒ Object (readonly)
has the device been initialized?
6 7 8 |
# File 'lib/midi-jruby/device.rb', line 6 def type @type end |
#vendor ⇒ Object (readonly)
has the device been initialized?
6 7 8 |
# File 'lib/midi-jruby/device.rb', line 6 def vendor @vendor end |
Class Method Details
.all ⇒ Array<Input, Output>
All devices of both directions
57 58 59 |
# File 'lib/midi-jruby/device.rb', line 57 def self.all all_by_type.values.flatten end |
.all_by_type ⇒ Hash
A hash of :input and :output devices
48 49 50 51 52 53 |
# File 'lib/midi-jruby/device.rb', line 48 def self.all_by_type @devices ||= { input: API.get_inputs, output: API.get_outputs } end |
Instance Method Details
#initialize(id, device, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/midi-jruby/device.rb', line 21 def initialize(id, device, = {}) @name = [:name] @description = [:description] @vendor = [:vendor] @id = id @device = device @type = get_type @enabled = false end |