Class: Stretto::MusicElements::Timing
- Inherits:
-
MusicElement
- Object
- MusicElement
- Stretto::MusicElements::Timing
- Defined in:
- lib/stretto/music_elements/timing.rb
Overview
Timing information places the elements at the specified position in time,
This information is mostly used when reading a MIDI file or using it live, to synchronize with playback. The quantity is expressed in miliseconds.
Instance Attribute Summary
Attributes inherited from MusicElement
Attributes included from Node
Instance Method Summary collapse
-
#initialize(string_or_options, pattern = nil) ⇒ Timing
constructor
A new instance of Timing.
-
#substitute_variables! ⇒ Object
private.
- #value ⇒ Object
Methods inherited from MusicElement
#build_music_string, #duration, #end_of_tie?, #start_of_tie?, #to_s
Constructor Details
#initialize(string_or_options, pattern = nil) ⇒ Timing
Returns a new instance of Timing.
12 13 14 15 16 17 18 19 |
# File 'lib/stretto/music_elements/timing.rb', line 12 def initialize(, pattern = nil) token = case when String then Stretto::Parser.parse_timing!() else end super(token[:text_value], pattern) @original_value = token[:value] end |
Instance Method Details
#substitute_variables! ⇒ Object
private
26 27 28 |
# File 'lib/stretto/music_elements/timing.rb', line 26 def substitute_variables! @value = self.value end |
#value ⇒ Object
21 22 23 |
# File 'lib/stretto/music_elements/timing.rb', line 21 def value @value || @original_value.to_i(@pattern) end |