Class: MTK::Sequencers::RhythmicSequencer
- Defined in:
- lib/mtk/sequencers/rhythmic_sequencer.rb
Overview
A Sequencer which uses a :rhythm type Patterns::Pattern to determine the delta times between entries in the Events::Timeline.
Instance Attribute Summary
Attributes inherited from Sequencer
#event_builder, #max_steps, #max_time, #patterns, #step, #time
Instance Method Summary collapse
-
#advance ⇒ Object
protected
Advance @time to the next time for the Events::Timeline being produced by Sequencer#to_timeline.
-
#initialize(patterns, options = {}) ⇒ RhythmicSequencer
constructor
A new instance of RhythmicSequencer.
- #rewind ⇒ Object
Methods inherited from Sequencer
Constructor Details
#initialize(patterns, options = {}) ⇒ RhythmicSequencer
Returns a new instance of RhythmicSequencer.
7 8 9 10 |
# File 'lib/mtk/sequencers/rhythmic_sequencer.rb', line 7 def initialize(patterns, ={}) super @rhythm = [:rhythm] or raise ArgumentError.new(":rhythm option is required") end |
Instance Method Details
#advance ⇒ Object (protected)
Advance @time to the next time for the Events::Timeline being produced by Sequencer#to_timeline
21 22 23 |
# File 'lib/mtk/sequencers/rhythmic_sequencer.rb', line 21 def advance @time += @rhythm.next.length end |
#rewind ⇒ Object
12 13 14 15 |
# File 'lib/mtk/sequencers/rhythmic_sequencer.rb', line 12 def rewind super @rhythm.rewind if @rhythm end |