Class: JSound::Midi::Devices::OutputDevice
- Inherits:
-
JDevice
- Object
- JSound::Midi::Device
- JDevice
- JSound::Midi::Devices::OutputDevice
- Defined in:
- lib/jsound/midi/devices/output_device.rb
Overview
A device that sends all it’s received messages to a system MIDI output port.
Available outputs are contained in the OUTPUTS list in the JSound::Midi module.
Instance Attribute Summary
Attributes inherited from JDevice
Instance Method Summary collapse
-
#initialize(java_device) ⇒ OutputDevice
constructor
Wrap a javax.sound.midi.MidiDevice transmitter to provide MIDI output.
- #message(message) ⇒ Object
- #output=(device) ⇒ Object
Methods inherited from JDevice
#[], #close, from_java, #inspect, #method_missing, #open, open_devices, #respond_to?, #to_s
Methods inherited from JSound::Midi::Device
#<=, #>>, #close, #open, #open?, #output, #to_s, #type
Methods included from TypeFromClassName
Constructor Details
#initialize(java_device) ⇒ OutputDevice
Note:
Typically you won’t instantiate these directly. Instead, find an output via the OUTPUTS list in the JSound::Midi module.
Wrap a javax.sound.midi.MidiDevice transmitter to provide MIDI output.
15 16 17 |
# File 'lib/jsound/midi/devices/output_device.rb', line 15 def initialize(java_device) super(java_device, :output) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JSound::Midi::Devices::JDevice
Instance Method Details
#message(message) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/jsound/midi/devices/output_device.rb', line 23 def () # unwrap the ruby message wrapper, if needed: = .to_java if .respond_to? :to_java # Use java_send to call Receiver.send() since it conflicts with Ruby's built-in send method # -1 means no timestamp, so we're not supporting timestamps @java_device.receiver.java_send(:send, [javax.sound.midi.MidiMessage, Java::long], , -1) end |
#output=(device) ⇒ Object
19 20 21 |
# File 'lib/jsound/midi/devices/output_device.rb', line 19 def output= device raise "#{self.class} cannot be assigned an output" end |