/** * Reads Chord informations * * @param integer $strings * @param Beat $beat */ public function readChord($strings, Beat $beat) { $chord = new Chord($strings); if (($this->reader->readUnsignedByte() & 0x1) == 0) { $chord->setName($this->reader->readStringByteSizeOfInteger()); $chord->setFirstFret($this->reader->readInt()); if ($chord->getFirstFret() != 0) { for ($i = 0; $i < 6; $i++) { $this->readFret($chord, $i); } } } else { $this->reader->skip(16); $chord->setName($this->reader->readStringByte(21)); $this->reader->skip(4); $chord->setFirstFret($this->reader->readInt()); for ($i = 0; $i < 7; $i++) { $this->readFret($chord, $i); } $this->reader->skip(32); } if ($chord->countNotes() > 0) { $beat->setChord($chord); } }
/** * Reads Chord informations * * @param integer $strings * @param Beat $beat */ public function readChord($strings, Beat $beat) { $chord = new Chord($strings); $this->reader->skip(17); $chord->setName($this->reader->readStringByte(21)); $this->reader->skip(4); $chord->setFirstFret($this->reader->readInt()); for ($i = 0; $i < 7; $i++) { $fret = $this->reader->readInt(); if ($i < $chord->countStrings()) { $chord->addFretValue($i, $fret); } } $this->reader->skip(32); if ($chord->countNotes() > 0) { $beat->setChord($chord); } }
/** * Read Chord informations * * @param integer $strings * @param Beat $beat */ public function readChord($strings, Beat $beat) { $chord = new Chord($strings); $header = $this->reader->readUnsignedByte(); if (($header & 0x1) == 0) { $chord->setName($this->reader->readStringByteSizeOfInteger()); $chord->setFirstFret($this->reader->readInt()); if ($chord->getFirstFret() != 0) { $this->readStrings($chord); } } else { $this->reader->skip(25); $chord->setName($this->reader->readStringByte(34)); $chord->setFirstFret($this->reader->readInt()); $this->readStrings($chord); $this->reader->skip(36); } if ($chord->countNotes() > 0) { $beat->setChord($chord); } }