Class: GuitarProParser::Reader
- Inherits:
-
Object
- Object
- GuitarProParser::Reader
- Defined in:
- lib/guitar_pro_parser/io/reader.rb
Instance Method Summary collapse
-
#initialize(song, file_path, headers_only) ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize(song, file_path, headers_only) ⇒ Reader
Returns a new instance of Reader.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/guitar_pro_parser/io/reader.rb', line 8 def initialize(song, file_path, headers_only) @song = song @file_path = file_path @input = InputStream.new(file_path) read_version read_info read_notices @song.triplet_feel = @input.read_boolean if @version < 5.0 read_lyrics if @version >= 4.0 if @version > 5.0 @song.master_volume = @input.read_integer @input.skip_integer 11.times { |n| @song.equalizer[n] = @input.read_byte } end read_page_setup if @version >= 5.0 read_tempo read_key @song.octave = @input.read_byte if @version >= 4.0 read_channels read_musical_directions if @version >= 5.0 @song.master_reverb = @input.read_integer if @version >= 5.0 = @input.read_integer tracks_count = @input.read_integer if headers_only .times { @song. } tracks_count.times { @song.add_track } return end .times { } tracks_count.times { read_track } @input.skip_byte if @version >= 5.0 @song..each do || @song.tracks.each do |track| = Bar.new voices_count = @version >= 5.0 ? 2 : 1 voices_count.times do |voice_number| voice = GuitarProHelper::VOICES.fetch(voice_number) beats_count = @input.read_integer beats_count.times { read_beat(track, , voice) } end track. << # Padding @input.skip_byte if @version >= 5.0 end end end |