Class: MIDIInstrument::Output
- Inherits:
-
Object
- Object
- MIDIInstrument::Output
- Defined in:
- lib/midi-instrument/output.rb
Overview
Send MIDI messages
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#devices ⇒ Object
Returns the value of attribute devices.
-
#mute ⇒ TrueClass
Mute the output.
Instance Method Summary collapse
-
#initialize ⇒ Output
constructor
A new instance of Output.
-
#mute? ⇒ Boolean
Is the output muted?.
-
#puts(*args) ⇒ Array<Fixnum>
(also: #<<)
Emit messages.
-
#toggle_mute ⇒ Boolean
Toggle muted output.
-
#unmute ⇒ FalseClass
Un-mute the output.
Constructor Details
#initialize ⇒ Output
Returns a new instance of Output.
9 10 11 12 13 14 |
# File 'lib/midi-instrument/output.rb', line 9 def initialize @channel = nil @channel_filter = nil @mute = false @devices = [] end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
6 7 8 |
# File 'lib/midi-instrument/output.rb', line 6 def channel @channel end |
#devices ⇒ Object
Returns the value of attribute devices.
6 7 8 |
# File 'lib/midi-instrument/output.rb', line 6 def devices @devices end |
#mute ⇒ TrueClass
Mute the output
51 52 53 |
# File 'lib/midi-instrument/output.rb', line 51 def mute @mute = true end |
Instance Method Details
#mute? ⇒ Boolean
Is the output muted?
63 64 65 |
# File 'lib/midi-instrument/output.rb', line 63 def mute? @mute end |
#puts(*args) ⇒ Array<Fixnum> Also known as: <<
Emit messages
32 33 34 35 36 37 38 39 40 |
# File 'lib/midi-instrument/output.rb', line 32 def puts(*args) = Message::(*args) = filter_output() bytes = Message::to_bytes() if !@mute @devices.each { |output| output.puts(*bytes) } end bytes end |
#toggle_mute ⇒ Boolean
Toggle muted output
45 46 47 |
# File 'lib/midi-instrument/output.rb', line 45 def toggle_mute @mute = !@mute end |
#unmute ⇒ FalseClass
Un-mute the output
57 58 59 |
# File 'lib/midi-instrument/output.rb', line 57 def unmute @mute = false end |