class Alda::Voice

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

Alda::Score.new do
  piano_ v1 c d e f v2 e f g a
end

Attributes

num[RW]

The string representing the voice’s number.

Public Class Methods

new(num) → Alda::Voice click to toggle source

Creates an Alda::Voice.

Calls superclass method
# File lib/alda-rb/event.rb, line 920
def initialize num
  super()
  @num = num
end

Public Instance Methods

voice == other → true or false click to toggle source

Overrides Alda::Event#==. Returns true if other is an Alda::Voice and has the same num as voice (using ==).

Calls superclass method Alda::Event#==
# File lib/alda-rb/event.rb, line 941
def == other
  super || other.is_a?(Alda::Voice) && @num == other.num
end
to_alda_code() → String click to toggle source

Overrides Alda::Event#to_alda_code.

# File lib/alda-rb/event.rb, line 930
def to_alda_code
  ?V + num + ?:
end