Class: Stretto::MusicElements::ControllerChange
- Inherits:
-
MusicElement
- Object
- MusicElement
- Stretto::MusicElements::ControllerChange
- 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)
-
- (Object) controller
readonly
Returns the value of attribute controller.
-
- (Object) value
readonly
Returns the value of attribute value.
Attributes inherited from MusicElement
Attributes included from Node
Instance Method Summary (collapse)
-
- (ControllerChange) initialize(string_or_options, pattern = nil)
constructor
A new instance of ControllerChange.
Methods inherited from MusicElement
#build_music_string, #duration, #end_of_tie?, #start_of_tie?, #to_s
Constructor Details
- (ControllerChange) initialize(string_or_options, pattern = nil)
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(, pattern = nil) token = case when String then Stretto::Parser.parse_controller_change!() else end super(token[:text_value], pattern) @original_controller = token[:controller] @original_value = token[:value] end |
Instance Attribute Details
- (Object) controller (readonly)
Returns the value of attribute controller
18 19 20 |
# File 'lib/stretto/music_elements/controller_change.rb', line 18 def controller @controller || @original_controller.to_i(@pattern) end |
- (Object) value (readonly)
Returns the value of attribute value
18 19 20 |
# File 'lib/stretto/music_elements/controller_change.rb', line 18 def value @value || @original_value.to_i(@pattern) end |