Class: Negasonic::LoopedEvent::Part

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

Instance Method Summary collapse

Constructor Details

#initialize(synth) ⇒ Part

Returns a new instance of Part.



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

def initialize(synth)
  @synth = synth
  @definitions = []
end

Instance Method Details

#play(note, time, duration) ⇒ Object



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

def play(note, time, duration)
  @definitions << { note: note, time: time, duration: duration }
end

#startObject



9
10
11
12
13
# File 'lib/negasonic/looped_event/part.rb', line 9

def start
  do_start do |time, event|
    @synth.trigger_attack_release(event.JS['note'], event.JS['duration'], time)
  end
end