Class: Negasonic::LoopedEvent::Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/negasonic/looped_event/sequence.rb

Instance Method Summary collapse

Constructor Details

#initialize(synth, segments = []) ⇒ Sequence

Returns a new instance of Sequence.



4
5
6
7
# File 'lib/negasonic/looped_event/sequence.rb', line 4

def initialize(synth, segments = [])
  @synth = synth
  @segments = segments
end

Instance Method Details

#play(*notes) ⇒ Object



15
16
17
# File 'lib/negasonic/looped_event/sequence.rb', line 15

def play(*notes)
  @segments << LoopedEvent.to_tone_notes(notes)
end

#start(duration) ⇒ Object



9
10
11
12
13
# 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