Class: GuitarProParser::Bar
- Inherits:
-
Object
- Object
- GuitarProParser::Bar
- Defined in:
- lib/guitar_pro_parser/bar.rb
Overview
This class represents bars as containers of notes.
Instance Attribute Summary collapse
-
#voices ⇒ Object
Hash of voices of this bar.
Instance Method Summary collapse
-
#get_beat(number, voice = :lead) ⇒ Object
Returns selected beat of selected voice.
-
#initialize ⇒ Bar
constructor
A new instance of Bar.
Constructor Details
#initialize ⇒ Bar
Returns a new instance of Bar.
13 14 15 |
# File 'lib/guitar_pro_parser/bar.rb', line 13 def initialize @voices = {lead: [], bass: []} end |
Instance Attribute Details
#voices ⇒ Object
Hash of voices of this bar. Guitar Pro 5 files has :lead and :bass voices. Guitar Pro 4 and less files has only :lead voice. Each voice is array of beats.
11 12 13 |
# File 'lib/guitar_pro_parser/bar.rb', line 11 def voices @voices end |
Instance Method Details
#get_beat(number, voice = :lead) ⇒ Object
Returns selected beat of selected voice
18 19 20 |
# File 'lib/guitar_pro_parser/bar.rb', line 18 def get_beat(number, voice = :lead) @voices.fetch(voice).fetch(number) end |