Class: MusaLCEServer::MIDIDevice
- Inherits:
-
Object
- Object
- MusaLCEServer::MIDIDevice
- Defined in:
- lib/midi-devices.rb
Overview
Wrapper for a MIDI output device with voice management.
Provides access to individual MIDI channels as voices and panic functionality.
Instance Attribute Summary collapse
- #low_level_device ⇒ Object readonly
Instance Method Summary collapse
-
#channels ⇒ Array<Musa::MIDIVoices::MIDIVoice>
Returns the MIDI channels/voices for this device.
-
#initialize(sequencer, low_level_device) ⇒ MIDIDevice
constructor
Creates a new MIDI device wrapper.
-
#name ⇒ String
Returns the device name.
-
#panic! ⇒ void
Sends All Notes Off and reset to all channels.
-
#to_s ⇒ String
Returns the display name of the device.
Constructor Details
#initialize(sequencer, low_level_device) ⇒ MIDIDevice
Creates a new MIDI device wrapper.
105 106 107 108 |
# File 'lib/midi-devices.rb', line 105 def initialize(sequencer, low_level_device) @low_level_device = low_level_device @voices = Musa::MIDIVoices::MIDIVoices.new(sequencer: sequencer, output: low_level_device, channels: 0..15, do_log: true) end |
Instance Attribute Details
#low_level_device ⇒ Object (readonly)
112 113 114 |
# File 'lib/midi-devices.rb', line 112 def low_level_device @low_level_device end |
Instance Method Details
#channels ⇒ Array<Musa::MIDIVoices::MIDIVoice>
Returns the MIDI channels/voices for this device.
131 132 133 |
# File 'lib/midi-devices.rb', line 131 def channels @voices.voices end |
#name ⇒ String
Returns the device name.
117 118 119 |
# File 'lib/midi-devices.rb', line 117 def name @low_level_device.name end |
#panic! ⇒ void
This method returns an undefined value.
Sends All Notes Off and reset to all channels.
124 125 126 |
# File 'lib/midi-devices.rb', line 124 def panic! @voices.panic reset: true end |
#to_s ⇒ String
Returns the display name of the device.
138 139 140 |
# File 'lib/midi-devices.rb', line 138 def to_s @low_level_device.display_name end |