class Alda::Sequence

A sequence event. Includes Alda::EventList.

An Alda::EventContainer containing an Alda::Sequence can be created using event list sugar. See Alda::EventList#method_missing.

Alda::Score.new do
  p s{ c; d; e; f }.event.class # => Alda::Sequence
end

There is also a special sequence sugar.

Alda::Score.new do
  p((c d e f).event.class) # => Alda::Sequence
end

The effects of the two examples above are the same.

Public Class Methods

join(*events) → Alda::Sequence click to toggle source

Creates an Alda::Sequence object by joining events.

The Alda::EventContainer objects are extracted, and the Alda::Sequence objects are flattened.

# File lib/alda-rb/event.rb, line 857
def self.join *events
  new do
    @events = events.map do |event|
      while event.is_a?(Alda::EventContainer) && !event.count && event.labels.empty?
        event = event.event
      end
      event.is_a?(Alda::Sequence) ? event.events : event
    end.flatten
  end
end

Public Instance Methods

to_alda_code() click to toggle source
# File lib/alda-rb/event.rb, line 845
def to_alda_code
  @events.to_alda_code
end