Class: JSound::Midi::Devices::Transformer
- Inherits:
-
JSound::Midi::Device
- Object
- JSound::Midi::Device
- JSound::Midi::Devices::Transformer
- Defined in:
- lib/jsound/midi/devices/transformer.rb
Instance Attribute Summary collapse
-
#message_processor ⇒ Object
The transformation block: a lambda that takes a message and returns either a transformed message or an Enumerable list of messages.
Instance Method Summary collapse
-
#initialize(&message_processor) ⇒ Transformer
constructor
A new instance of Transformer.
- #message(message) ⇒ Object
Methods inherited from JSound::Midi::Device
#<=, #>>, #close, #open, #open?, #output, #output=, #to_s, #type
Methods included from JSound::Mixins::TypeFromClassName
Constructor Details
#initialize(&message_processor) ⇒ Transformer
Returns a new instance of Transformer.
11 12 13 |
# File 'lib/jsound/midi/devices/transformer.rb', line 11 def initialize(&) = end |
Instance Attribute Details
#message_processor ⇒ Object
The transformation block: a lambda that takes a message and returns either a transformed message or an Enumerable list of messages
9 10 11 |
# File 'lib/jsound/midi/devices/transformer.rb', line 9 def end |
Instance Method Details
#message(message) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jsound/midi/devices/transformer.rb', line 15 def () if @output and = .call() if .is_a? Enumerable .each{|m| @output.(m) } else @output.() if end end end |