Class: Topaz::MIDISyncOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/topaz/midi_sync_output.rb

Overview

Send clock messages via MIDI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ MIDISyncOutput

Returns a new instance of MIDISyncOutput.



8
9
10
# File 'lib/topaz/midi_sync_output.rb', line 8

def initialize(output)
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



6
7
8
# File 'lib/topaz/midi_sync_output.rb', line 6

def output
  @output
end

Instance Method Details

#clock(*a) ⇒ Object

Send a clock tick message



25
26
27
28
# File 'lib/topaz/midi_sync_output.rb', line 25

def clock(*a)
  clock = MIDIMessage::SystemRealtime["Clock"].new.to_a
  @output.puts(clock)
end

#start(*a) ⇒ Object

Send a start message



13
14
15
16
# File 'lib/topaz/midi_sync_output.rb', line 13

def start(*a)
  start = MIDIMessage::SystemRealtime["Start"].new.to_a
  @output.puts(start)
end

#stop(*a) ⇒ Object

Send a stop message



19
20
21
22
# File 'lib/topaz/midi_sync_output.rb', line 19

def stop(*a)
  stop = MIDIMessage::SystemRealtime["Stop"].new.to_a
  @output.puts(stop)
end