Class: HeadMusic::Notation::LilyPond::FlowBuilder::Cursor
- Inherits:
-
Object
- Object
- HeadMusic::Notation::LilyPond::FlowBuilder::Cursor
- Defined in:
- lib/head_music/notation/lily_pond/flow_builder.rb
Overview
One voice's place in the replay: the events it has left, and the voice they are being placed on.
Instance Attribute Summary collapse
-
#voice ⇒ Object
readonly
Returns the value of attribute voice.
Instance Method Summary collapse
- #advance ⇒ Object
- #done? ⇒ Boolean
- #event ⇒ Object
-
#initialize(stream, voice) ⇒ Cursor
constructor
A new instance of Cursor.
-
#sort_key ⇒ Object
Key and meter changes are answered before the notes of the same position, so a bar is placed under the meter that governs it.
Constructor Details
#initialize(stream, voice) ⇒ Cursor
Returns a new instance of Cursor.
16 17 18 19 |
# File 'lib/head_music/notation/lily_pond/flow_builder.rb', line 16 def initialize(stream, voice) @events = stream.events.dup @voice = voice end |
Instance Attribute Details
#voice ⇒ Object (readonly)
Returns the value of attribute voice.
14 15 16 |
# File 'lib/head_music/notation/lily_pond/flow_builder.rb', line 14 def voice @voice end |
Instance Method Details
#advance ⇒ Object
29 30 31 |
# File 'lib/head_music/notation/lily_pond/flow_builder.rb', line 29 def advance @events.shift end |
#done? ⇒ Boolean
25 26 27 |
# File 'lib/head_music/notation/lily_pond/flow_builder.rb', line 25 def done? @events.empty? end |
#event ⇒ Object
21 22 23 |
# File 'lib/head_music/notation/lily_pond/flow_builder.rb', line 21 def event @events.first end |
#sort_key ⇒ Object
Key and meter changes are answered before the notes of the same position, so a bar is placed under the meter that governs it.
35 36 37 |
# File 'lib/head_music/notation/lily_pond/flow_builder.rb', line 35 def sort_key [voice.next_position, event.music? ? 1 : 0] end |