Class: GuitarProParser::Bar

Inherits:
Object
  • Object
show all
Defined in:
lib/guitar_pro_parser/bar.rb

Overview

This class represents bars as containers of notes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBar

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

#voicesObject

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