Class: Topaz::MIDIClockOutput
- Inherits:
-
Object
- Object
- Topaz::MIDIClockOutput
- Defined in:
- lib/topaz/midi_clock_output.rb
Overview
Send clock messages via MIDI
Instance Attribute Summary collapse
-
#devices ⇒ Object
readonly
Returns the value of attribute devices.
Instance Method Summary collapse
-
#do_clock(*a) ⇒ Boolean
Send a clock tick message.
-
#do_start(*a) ⇒ Boolean
Send a start message.
-
#do_stop(*a) ⇒ Boolean
Send a stop message.
-
#initialize(options) ⇒ MIDIClockOutput
constructor
A new instance of MIDIClockOutput.
Constructor Details
#initialize(options) ⇒ MIDIClockOutput
Returns a new instance of MIDIClockOutput.
10 11 12 13 |
# File 'lib/topaz/midi_clock_output.rb', line 10 def initialize() device = [:device] || [:devices] @devices = [device].flatten.compact end |
Instance Attribute Details
#devices ⇒ Object (readonly)
Returns the value of attribute devices.
6 7 8 |
# File 'lib/topaz/midi_clock_output.rb', line 6 def devices @devices end |
Instance Method Details
#do_clock(*a) ⇒ Boolean
Send a clock tick message
33 34 35 36 37 |
# File 'lib/topaz/midi_clock_output.rb', line 33 def do_clock(*a) clock = MIDIMessage::SystemRealtime["Clock"].new emit(clock) !@devices.empty? end |
#do_start(*a) ⇒ Boolean
Send a start message
17 18 19 20 21 |
# File 'lib/topaz/midi_clock_output.rb', line 17 def do_start(*a) start = MIDIMessage::SystemRealtime["Start"].new emit(start) !@devices.empty? end |
#do_stop(*a) ⇒ Boolean
Send a stop message
25 26 27 28 29 |
# File 'lib/topaz/midi_clock_output.rb', line 25 def do_stop(*a) stop = MIDIMessage::SystemRealtime["Stop"].new emit(stop) !@devices.empty? end |