midi-topaz 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/topaz/tempo.rb +16 -19
- data/lib/topaz.rb +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -42,7 +42,7 @@ You may also use another MIDI device to generate timing and control the tempo.
|
|
42
42
|
|
43
43
|
@input = UniMIDI::Input.first.open # an midi input
|
44
44
|
|
45
|
-
@tempo = Topaz::Tempo.new(
|
45
|
+
@tempo = Topaz::Tempo.new(@input) { seq.step }
|
46
46
|
|
47
47
|
Topaz can also act as a master clock. If a MIDI output is passed to Topaz, MIDI start, stop and clock signals will automatically be sent to that output at the appropriate time
|
48
48
|
|
@@ -52,7 +52,7 @@ Topaz can also act as a master clock. If a MIDI output is passed to Topaz, MIDI
|
|
52
52
|
|
53
53
|
Input and multiple outputs can be used simultaneously
|
54
54
|
|
55
|
-
@tempo = Topaz::Tempo.new(:midi => [@
|
55
|
+
@tempo = Topaz::Tempo.new(@input, :midi => [@output1, @output2]) { seq.step }
|
56
56
|
|
57
57
|
Once the Tempo object is initialized, start the clock
|
58
58
|
|
data/lib/topaz/tempo.rb
CHANGED
@@ -10,7 +10,7 @@ module Topaz
|
|
10
10
|
|
11
11
|
def_delegators :source, :tempo, :interval, :interval=, :join
|
12
12
|
|
13
|
-
def initialize(
|
13
|
+
def initialize(tempo_or_input, options = {}, &event)
|
14
14
|
@paused = false
|
15
15
|
@destinations = []
|
16
16
|
@actions = {
|
@@ -23,17 +23,16 @@ module Topaz
|
|
23
23
|
|
24
24
|
on_tick(&event)
|
25
25
|
|
26
|
-
if
|
27
|
-
@source = InternalTempo.new(@actions,
|
26
|
+
if tempo_or_input.kind_of?(Numeric)
|
27
|
+
@source = InternalTempo.new(@actions, tempo_or_input)
|
28
|
+
else
|
29
|
+
midi_clock_source = tempo_or_input
|
28
30
|
end
|
29
|
-
|
30
|
-
|
31
|
-
initialize_midi_io(options)
|
31
|
+
|
32
|
+
initialize_midi_io(options[:midi], midi_clock_source)
|
32
33
|
raise "You must specify an internal tempo rate or an external tempo source" if @source.nil?
|
33
|
-
|
34
|
-
unless options.nil?
|
35
|
-
@source.interval = options[:interval] unless options[:interval].nil?
|
36
|
-
end
|
34
|
+
|
35
|
+
@source.interval = options[:interval] unless options[:interval].nil?
|
37
36
|
|
38
37
|
end
|
39
38
|
|
@@ -157,15 +156,13 @@ module Topaz
|
|
157
156
|
|
158
157
|
private
|
159
158
|
|
160
|
-
def initialize_midi_io(
|
161
|
-
|
162
|
-
unless
|
163
|
-
if
|
164
|
-
|
165
|
-
elsif
|
166
|
-
@
|
167
|
-
elsif ports.type.eql?(:output)
|
168
|
-
@destinations << MIDISyncOutput.new(ports)
|
159
|
+
def initialize_midi_io(midi_ports, midi_clock = nil)
|
160
|
+
@source = ExternalMIDITempo.new(@actions, midi_clock) unless midi_clock.nil? || !@source.nil?
|
161
|
+
unless midi_ports.nil?
|
162
|
+
if midi_ports.kind_of?(Array)
|
163
|
+
midi_ports.each { |port| initialize_midi_io(port) }
|
164
|
+
elsif midi_ports.type.eql?(:output)
|
165
|
+
@destinations << MIDISyncOutput.new(midi_ports)
|
169
166
|
end
|
170
167
|
end
|
171
168
|
end
|
data/lib/topaz.rb
CHANGED