class Negasonic::LoopedEvent::Sequence

Public Class Methods

new(synth, segments = []) click to toggle source
# File lib/negasonic/looped_event/sequence.rb, line 4
def initialize(synth, segments = [])
  @synth = synth
  @segments = segments
end

Public Instance Methods

play(*notes) click to toggle source
# File lib/negasonic/looped_event/sequence.rb, line 15
def play(*notes)
  @segments << LoopedEvent.to_tone_notes(notes)
end
start(duration) click to toggle source
# File lib/negasonic/looped_event/sequence.rb, line 9
def start(duration)
  do_start(duration) do |time, note|
    @synth.trigger_attack_release(note, duration, time)
  end
end

Private Instance Methods

do_start(duration, &block) click to toggle source
# File lib/negasonic/looped_event/sequence.rb, line 21
def do_start(duration, &block)
  LoopedEvent.start(Tone::Event::Sequence.new @segments, duration, &block)
end