Class: JSound::Midi::Device
- Inherits:
-
Object
- Object
- JSound::Midi::Device
- Includes:
- JSound::Mixins::TypeFromClassName
- Defined in:
- lib/jsound/midi/device.rb
Overview
A device that can transmit and/or receive messages (typically MIDI messages). This default implementation simply passes through all messages.
Direct Known Subclasses
JSound::Midi::Devices::Generator, JSound::Midi::Devices::InputDevice::Bridge, JSound::Midi::Devices::JDevice, JSound::Midi::Devices::Monitor, JSound::Midi::Devices::Recorder, JSound::Midi::Devices::Repeater, JSound::Midi::Devices::Transformer
Instance Method Summary collapse
-
#<=(message) ⇒ Object
send a message to this device.
-
#>>(device) ⇒ Object
Connect a device as the output for this device.
-
#close ⇒ Object
Close the device and free up any resources used by this device.
-
#message(message) ⇒ Object
Send a message to this device.
-
#open ⇒ Object
Open the device and allocate the needed resources so that it can send and receive messages.
-
#open? ⇒ Boolean
return true if this device is currently open.
-
#output ⇒ Device
the device connected to this device’s output.
-
#output=(device) ⇒ Object
connect a device as the output for this device.
- #to_s ⇒ Object
- #type ⇒ Object
Methods included from JSound::Mixins::TypeFromClassName
Instance Method Details
#<=(message) ⇒ Object
send a message to this device. shortcut for #message
61 62 63 |
# File 'lib/jsound/midi/device.rb', line 61 def <=() () end |
#>>(device) ⇒ Object
Connect a device as the output for this device. shortcut for #output=
47 48 49 |
# File 'lib/jsound/midi/device.rb', line 47 def >> device self.output= device end |
#close ⇒ Object
this operation is typically only relevant for Java-based devices such as JSound::Midi::Devices::InputDevice and JSound::Midi::Devices::OutputDevice
Close the device and free up any resources used by this device.
23 24 |
# File 'lib/jsound/midi/device.rb', line 23 def close end |
#message(message) ⇒ Object
Send a message to this device
54 55 56 57 |
# File 'lib/jsound/midi/device.rb', line 54 def () # default behavior is to pass the message to any connected output @output.() if @output end |
#open ⇒ Object
this operation is typically only relevant for Java-based devices such as JSound::Midi::Devices::InputDevice and JSound::Midi::Devices::OutputDevice
Open the device and allocate the needed resources so that it can send and receive messages
12 13 |
# File 'lib/jsound/midi/device.rb', line 12 def open end |
#open? ⇒ Boolean
return true if this device is currently open
16 17 18 19 |
# File 'lib/jsound/midi/device.rb', line 16 def open? # typically, ruby devices are always open, subclasses might not be true end |
#output ⇒ Device
the device connected to this device’s output
33 34 35 |
# File 'lib/jsound/midi/device.rb', line 33 def output @output end |
#output=(device) ⇒ Object
connect a device as the output for this device
40 41 42 |
# File 'lib/jsound/midi/device.rb', line 40 def output= device @output = device end |
#to_s ⇒ Object
65 66 67 |
# File 'lib/jsound/midi/device.rb', line 65 def to_s "MIDI #{type} device" end |
#type ⇒ Object
26 27 28 29 |
# File 'lib/jsound/midi/device.rb', line 26 def type # The base Device behaves like a 'pass through' @type ||= (self.class == Device ? :pass_through : self.class.type) end |