Class: Topaz::InternalTempo
- Inherits:
-
Gamelan::Timer
- Object
- Gamelan::Timer
- Topaz::InternalTempo
- Defined in:
- lib/topaz/internal_tempo.rb
Instance Method Summary collapse
-
#initialize(events, 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.
Constructor Details
#initialize(events, tempo, options = {}) ⇒ InternalTempo
Returns a new instance of InternalTempo.
5 6 7 8 9 10 11 12 |
# File 'lib/topaz/internal_tempo.rb', line 5 def initialize(events, tempo, = {}) @events = events @last = 0 @last_sync = 0 self.interval = [:interval] || 4 super({:tempo => tempo}) end |
Instance Method Details
#interval ⇒ Object
27 28 29 |
# File 'lib/topaz/internal_tempo.rb', line 27 def interval @interval * 4 end |
#interval=(val) ⇒ Object
change the timer’s click interval
23 24 25 |
# File 'lib/topaz/internal_tempo.rb', line 23 def interval=(val) @interval = val / 4 end |
#join ⇒ Object
37 38 39 40 |
# File 'lib/topaz/internal_tempo.rb', line 37 def join super() self end |
#start(options = {}) ⇒ Object
start the internal timer pass :background => true to keep the timer in a background thread
16 17 18 19 20 |
# File 'lib/topaz/internal_tempo.rb', line 16 def start( = {}) run join unless !![:background] self end |
#stop(*a) ⇒ Object
stop the timer
32 33 34 35 |
# File 'lib/topaz/internal_tempo.rb', line 32 def stop(*a) super() self end |