Class: Stretto::MusicElements::ControllerChange

Inherits:
MusicElement show all
Defined in:
lib/stretto/music_elements/controller_change.rb

Overview

Represents a MIDI controller event.

MIDI specification defines about 100 controller events, that are used by the instruments or synthesizer to perform a range of effects and control settings.

JFugue defines the most common ones (See Variables::CONTROLLER_VARIABLES), and provides a shortcut for mixed (coarse and fine values) controllers.

The syntax for a controller change is X_controller_=value, where controller is the number of the controller event, and value is the value that is going to be set.

Instance Attribute Summary collapse

Attributes inherited from MusicElement

#original_string, #pattern

Attributes included from Node

#next, #prev

Instance Method Summary collapse

Methods inherited from MusicElement

#build_music_string, #duration, #end_of_tie?, #start_of_tie?, #to_s

Constructor Details

#initialize(string_or_options, pattern = nil) ⇒ ControllerChange

Returns a new instance of ControllerChange.



20
21
22
23
24
25
26
27
28
# File 'lib/stretto/music_elements/controller_change.rb', line 20

def initialize(string_or_options, pattern = nil)
  token = case string_or_options
    when String then Stretto::Parser.parse_controller_change!(string_or_options)
    else string_or_options
  end
  super(token[:text_value], pattern)
  @original_controller = token[:controller]
  @original_value      = token[:value]
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



18
19
20
# File 'lib/stretto/music_elements/controller_change.rb', line 18

def controller
  @controller
end

#valueObject (readonly)

Returns the value of attribute value.



18
19
20
# File 'lib/stretto/music_elements/controller_change.rb', line 18

def value
  @value
end