Class: MTK::Sequencers::RhythmicSequencer

Inherits:
Sequencer
  • Object
show all
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

Methods inherited from Sequencer

#next, #to_timeline

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, options={})
  super
  @rhythm = options[:rhythm] or raise ArgumentError.new(":rhythm option is required")
end

Instance Method Details

#advanceObject (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

#rewindObject



12
13
14
15
# File 'lib/mtk/sequencers/rhythmic_sequencer.rb', line 12

def rewind
  super
  @rhythm.rewind if @rhythm
end