Class: Topaz::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/topaz/events.rb

Overview

User defined callbacks for tempo events

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEvents

Returns a new instance of Events.



9
10
11
12
13
14
15
16
17
18
# File 'lib/topaz/events.rb', line 9

def initialize()
  @start = []
  @stop = []
  @tick = [] 

  @midi_clock = nil
  @midi_start = nil
  @midi_stop = nil
  @stop_when = nil
end

Instance Attribute Details

#midi_clockObject

Returns the value of attribute midi_clock.



7
8
9
# File 'lib/topaz/events.rb', line 7

def midi_clock
  @midi_clock
end

#midi_startObject

Returns the value of attribute midi_start.



7
8
9
# File 'lib/topaz/events.rb', line 7

def midi_start
  @midi_start
end

#midi_stopObject

Returns the value of attribute midi_stop.



7
8
9
# File 'lib/topaz/events.rb', line 7

def midi_stop
  @midi_stop
end

#startObject

Returns the value of attribute start.



7
8
9
# File 'lib/topaz/events.rb', line 7

def start
  @start
end

#stopObject

Returns the value of attribute stop.



7
8
9
# File 'lib/topaz/events.rb', line 7

def stop
  @stop
end

#stop_whenObject

Returns the value of attribute stop_when.



7
8
9
# File 'lib/topaz/events.rb', line 7

def stop_when
  @stop_when
end

#tickObject (readonly)

Returns the value of attribute tick.



6
7
8
# File 'lib/topaz/events.rb', line 6

def tick
  @tick
end

Instance Method Details

#do_midi_clockObject



20
21
22
# File 'lib/topaz/events.rb', line 20

def do_midi_clock
  @midi_clock.call
end

#do_startObject



24
25
26
27
# File 'lib/topaz/events.rb', line 24

def do_start
  @midi_start.call
  @start.each(&:call)
end

#do_stopObject



29
30
31
32
# File 'lib/topaz/events.rb', line 29

def do_stop
  @midi_stop.call
  @stop.each(&:call)
end

#do_tickObject



34
35
36
# File 'lib/topaz/events.rb', line 34

def do_tick
  @tick.each(&:call)
end

#stop?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/topaz/events.rb', line 38

def stop?
  @stop_when.call unless @stop_when.nil?
end