Module: Negasonic::LoopedEvent

Defined in:
lib/negasonic/looped_event.rb,
lib/negasonic/looped_event/part.rb,
lib/negasonic/looped_event/pattern.rb,
lib/negasonic/looped_event/sequence.rb

Defined Under Namespace

Classes: Part, Pattern, Sequence

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.eventsObject

Returns the value of attribute events.



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

def events
  @events
end

Class Method Details

.dispose_allObject



13
14
15
16
# File 'lib/negasonic/looped_event.rb', line 13

def dispose_all
  @events.each(&:dispose)
  @events = []
end

.start(looped_element) ⇒ Object



18
19
20
21
22
# File 'lib/negasonic/looped_event.rb', line 18

def start(looped_element)
  looped_element.start(0)
  looped_element.loop = true
  @events << looped_element
end

.to_tone_notes(notes) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/negasonic/looped_event.rb', line 24

def to_tone_notes(notes)
  notes.map do |note|
    if JS.typeof(note) == 'string'
      note
    else
      # is a midi note
      (2**((note-69)/12) * 440).to_f
    end
  end
end