Class: Topaz::InternalTempo
- Inherits:
-
Gamelan::Timer
- Object
- Gamelan::Timer
- Topaz::InternalTempo
- Includes:
- TempoSource
- Defined in:
- lib/topaz/internal_tempo.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
Instance Method Summary collapse
-
#initialize(actions, tempo, options = {}) ⇒ InternalTempo
constructor
A new instance of InternalTempo.
- #interval ⇒ Object
-
#interval=(val) ⇒ Object
change the timer’s click interval.
- #join ⇒ Object
-
#start(options = {}) ⇒ Object
start the internal timer pass :background => true to keep the timer in a background thread.
-
#stop(*a) ⇒ Object
stop the timer.
Methods included from TempoSource
#do_midi_clock, #do_tick, #stop?
Constructor Details
#initialize(actions, tempo, options = {}) ⇒ InternalTempo
Returns a new instance of InternalTempo.
10 11 12 13 14 15 16 |
# File 'lib/topaz/internal_tempo.rb', line 10 def initialize(actions, tempo, = {}) @actions = actions self.interval = [:interval] || 4 @last = 0 @last_sync = 0 super({:tempo => tempo}) end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
8 9 10 |
# File 'lib/topaz/internal_tempo.rb', line 8 def action @action end |
Instance Method Details
#interval ⇒ Object
31 32 33 |
# File 'lib/topaz/internal_tempo.rb', line 31 def interval @interval * 4 end |
#interval=(val) ⇒ Object
change the timer’s click interval
27 28 29 |
# File 'lib/topaz/internal_tempo.rb', line 27 def interval=(val) @interval = val / 4 end |
#join ⇒ Object
41 42 43 44 |
# File 'lib/topaz/internal_tempo.rb', line 41 def join super() self end |
#start(options = {}) ⇒ Object
start the internal timer pass :background => true to keep the timer in a background thread
20 21 22 23 24 |
# File 'lib/topaz/internal_tempo.rb', line 20 def start( = {}) run join unless [:background] self end |
#stop(*a) ⇒ Object
stop the timer
36 37 38 39 |
# File 'lib/topaz/internal_tempo.rb', line 36 def stop(*a) super() self end |