midi-topaz 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/topaz.rb +1 -1
- data/lib/topaz/clock.rb +1 -0
- data/lib/topaz/midi_clock_input.rb +8 -4
- data/lib/topaz/tempo_source.rb +2 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b328af933373fcd7e339796494153ba0a6a3bc0
|
4
|
+
data.tar.gz: 4be13f7763a72d50c8724432fddbf40a7472f737
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0823fe40d0237d0a7e76b0f8cfa55b2df99de7bd1f0c59ee044cf6d162e1c7f5ad80e03fee1b0d0a815608a41184a26571bc6a665d81ad7454b64314e6f2301c
|
7
|
+
data.tar.gz: 9241cbccdfd2b965d99f0c4f210526fd372066e2c563b19601552b35d463a4f3708451591cdda10119e56395b0337eff008698f24ea42153f25e33337088075a
|
data/lib/topaz.rb
CHANGED
data/lib/topaz/clock.rb
CHANGED
@@ -9,6 +9,7 @@ module Topaz
|
|
9
9
|
|
10
10
|
# @param [Fixnum, UniMIDI::Input] tempo_or_input
|
11
11
|
# @param [Hash] options
|
12
|
+
# @option options [Boolean] :midi_transport Whether to respect start/stop MIDI commands from a MIDI input
|
12
13
|
# @param [Proc] tick_event
|
13
14
|
def initialize(tempo_or_input, options = {}, &tick_event)
|
14
15
|
# The MIDI clock output is initialized regardless of whether there are devices
|
@@ -12,8 +12,10 @@ module Topaz
|
|
12
12
|
# @param [UniMIDI::Input] input
|
13
13
|
# @param [Hash] options
|
14
14
|
# @option options [Clock::Event] :event
|
15
|
+
# @option options [Boolean] :midi_transport Whether to respect start/stop MIDI commands from a MIDI input
|
15
16
|
def initialize(input, options = {})
|
16
17
|
@event = options[:event]
|
18
|
+
@use_transport = !!options[:midi_transport]
|
17
19
|
@tick_counter = 0
|
18
20
|
@pause = false
|
19
21
|
@listening = false
|
@@ -137,10 +139,12 @@ module Topaz
|
|
137
139
|
# @param [Hash] message
|
138
140
|
# @return [Fixnum] The current counter
|
139
141
|
def handle_clock_message(message)
|
140
|
-
@running
|
141
|
-
|
142
|
-
|
143
|
-
|
142
|
+
if @running || !@use_transport
|
143
|
+
@running ||= true
|
144
|
+
thru
|
145
|
+
log(message)
|
146
|
+
tick? ? tick : advance
|
147
|
+
end
|
144
148
|
end
|
145
149
|
|
146
150
|
# Advance the tick counter
|
data/lib/topaz/tempo_source.rb
CHANGED
@@ -9,6 +9,7 @@ module Topaz
|
|
9
9
|
# @param [Fixnum, UniMIDI::Input] tempo_or_input
|
10
10
|
# @param [Hash] options
|
11
11
|
# @option options [Clock::Event] :event
|
12
|
+
# @option options [Boolean] :midi_transport Whether to respect start/stop commands when the input is MIDI
|
12
13
|
# @return [MIDIClockInput, Timer]
|
13
14
|
def new(tempo_or_input, options = {})
|
14
15
|
klass = case tempo_or_input
|
@@ -17,9 +18,7 @@ module Topaz
|
|
17
18
|
else
|
18
19
|
raise "Not a valid tempo source"
|
19
20
|
end
|
20
|
-
|
21
|
-
source.interval = options[:interval] unless options[:interval].nil?
|
22
|
-
source
|
21
|
+
klass.new(tempo_or_input, options)
|
23
22
|
end
|
24
23
|
|
25
24
|
end
|