Class: Collavoce::Tracker
- Inherits:
-
Object
- Object
- Collavoce::Tracker
- Defined in:
- lib/collavoce/tracker.rb
Instance Method Summary collapse
-
#initialize(*tracks) ⇒ Tracker
constructor
A new instance of Tracker.
- #loop(bpm = 120) ⇒ Object
- #run(bpm = 120) ⇒ Object
Constructor Details
#initialize(*tracks) ⇒ Tracker
Returns a new instance of Tracker.
3 4 5 |
# File 'lib/collavoce/tracker.rb', line 3 def initialize(*tracks) @tracks = tracks end |
Instance Method Details
#loop(bpm = 120) ⇒ Object
19 20 21 |
# File 'lib/collavoce/tracker.rb', line 19 def loop(bpm=120) run(bpm) while true end |
#run(bpm = 120) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/collavoce/tracker.rb', line 7 def run(bpm = 120) @threads = [] @tracks.each do |track| @threads << Thread.new do track.each do |voice| voice.new(:bpm => bpm).run end end end @threads.map(&:join) end |