midi-topaz 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/topaz/tempo.rb +24 -10
- data/lib/topaz.rb +1 -1
- metadata +2 -2
data/lib/topaz/tempo.rb
CHANGED
@@ -11,6 +11,7 @@ module Topaz
|
|
11
11
|
def_delegators :source, :tempo, :interval, :interval=, :join
|
12
12
|
|
13
13
|
def initialize(*args, &event)
|
14
|
+
@paused = false
|
14
15
|
@destinations = []
|
15
16
|
@actions = {
|
16
17
|
:start => nil,
|
@@ -32,7 +33,6 @@ module Topaz
|
|
32
33
|
|
33
34
|
unless options.nil?
|
34
35
|
@source.interval = options[:interval] unless options[:interval].nil?
|
35
|
-
initialize_sync(options[:children], options[:sync_to])
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -50,6 +50,25 @@ module Topaz
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
# pause the clock
|
54
|
+
def pause
|
55
|
+
@pause = true
|
56
|
+
end
|
57
|
+
|
58
|
+
# unpause the clock
|
59
|
+
def unpause
|
60
|
+
@pause = false
|
61
|
+
end
|
62
|
+
|
63
|
+
# is this clock paused?
|
64
|
+
def paused?
|
65
|
+
@pause
|
66
|
+
end
|
67
|
+
|
68
|
+
def toggle_pause
|
69
|
+
paused? ? unpause : pause
|
70
|
+
end
|
71
|
+
|
53
72
|
# pass in a callback that is called when start is called
|
54
73
|
def on_start(&block)
|
55
74
|
@actions[:start] = block
|
@@ -76,8 +95,10 @@ module Topaz
|
|
76
95
|
# pass in a callback which will be fired on each tick
|
77
96
|
def on_tick(&block)
|
78
97
|
proc = Proc.new do
|
79
|
-
|
80
|
-
|
98
|
+
unless paused?
|
99
|
+
@destinations.each { |d| d.send(:tick) if d.respond_to?(:tick) }
|
100
|
+
yield
|
101
|
+
end
|
81
102
|
end
|
82
103
|
@actions[:tick] = proc
|
83
104
|
end
|
@@ -135,13 +156,6 @@ module Topaz
|
|
135
156
|
end
|
136
157
|
|
137
158
|
private
|
138
|
-
|
139
|
-
def initialize_sync(children, sync_to)
|
140
|
-
children = [children].flatten.compact
|
141
|
-
sync_to = [sync_to].flatten.compact
|
142
|
-
children.each { |t| add_destination(t) }
|
143
|
-
sync_to.each { |t| sync_to(t) }
|
144
|
-
end
|
145
159
|
|
146
160
|
def initialize_midi_io(args)
|
147
161
|
ports = args.kind_of?(Hash) ? args[:midi] : args
|
data/lib/topaz.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: midi-topaz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ari Russo
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-30 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|