Class: HeadMusic::Notation::ABC::Parser::VoiceState

Inherits:
Object
  • Object
show all
Defined in:
lib/head_music/notation/abc/parser.rb

Overview

Per-voice interpretation state. Accidentals, the deferred note, and volta tracking are all independent between voices.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice, pitch_builder) ⇒ VoiceState

Returns a new instance of VoiceState.



49
50
51
52
# File 'lib/head_music/notation/abc/parser.rb', line 49

def initialize(voice, pitch_builder)
  @voice = voice
  @pitch_builder = pitch_builder
end

Instance Attribute Details

#active_passesObject

Returns the value of attribute active_passes.



46
47
48
# File 'lib/head_music/notation/abc/parser.rb', line 46

def active_passes
  @active_passes
end

#awaiting_scaleObject

Returns the value of attribute awaiting_scale.



46
47
48
# File 'lib/head_music/notation/abc/parser.rb', line 46

def awaiting_scale
  @awaiting_scale
end

#broken_lineObject

Returns the value of attribute broken_line.



46
47
48
# File 'lib/head_music/notation/abc/parser.rb', line 46

def broken_line
  @broken_line
end

#pending_noteObject

Returns the value of attribute pending_note.



46
47
48
# File 'lib/head_music/notation/abc/parser.rb', line 46

def pending_note
  @pending_note
end

#pitch_builderObject (readonly)

Returns the value of attribute pitch_builder.



45
46
47
# File 'lib/head_music/notation/abc/parser.rb', line 45

def pitch_builder
  @pitch_builder
end

#voiceObject (readonly)

Returns the value of attribute voice.



45
46
47
# File 'lib/head_music/notation/abc/parser.rb', line 45

def voice
  @voice
end

#volta_start_barObject

Returns the value of attribute volta_start_bar.



46
47
48
# File 'lib/head_music/notation/abc/parser.rb', line 46

def volta_start_bar
  @volta_start_bar
end

Instance Method Details

#completed_bar_numberObject



54
55
56
# File 'lib/head_music/notation/abc/parser.rb', line 54

def completed_bar_number
  voice.last_placement&.position&.bar_number
end

#entered_bar_numberObject



58
59
60
# File 'lib/head_music/notation/abc/parser.rb', line 58

def entered_bar_number
  voice.next_position.bar_number
end