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.
95 96 97 98 |
# File 'lib/midi-devices.rb', line 95 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)
102 103 104 |
# File 'lib/midi-devices.rb', line 102 def low_level_device @low_level_device end |
Instance Method Details
#channels ⇒ Array<Musa::MIDIVoices::MIDIVoice>
Returns the MIDI channels/voices for this device.
121 122 123 |
# File 'lib/midi-devices.rb', line 121 def channels @voices.voices end |
#name ⇒ String
Returns the device name.
107 108 109 |
# File 'lib/midi-devices.rb', line 107 def name @low_level_device.name end |
#panic! ⇒ void
This method returns an undefined value.
Sends All Notes Off and reset to all channels.
114 115 116 |
# File 'lib/midi-devices.rb', line 114 def panic! @voices.panic reset: true end |
#to_s ⇒ String
Returns the display name of the device.
128 129 130 |
# File 'lib/midi-devices.rb', line 128 def to_s @low_level_device.display_name end |