コード例 #1
0
ファイル: GuitarPro4Chord.php プロジェクト: stdtabs/phptabs
 /**
  * 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);
     }
 }
コード例 #2
0
ファイル: GuitarPro3Chord.php プロジェクト: stdtabs/phptabs
 /**
  * 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);
     }
 }
コード例 #3
0
ファイル: GuitarPro5Writer.php プロジェクト: stdtabs/phptabs
 private function writeChord(Chord $chord)
 {
     $this->writeBytes(array(1, 1, 0, 0, 0, 12, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0));
     $this->writeStringByte($chord->getName(), 21);
     $this->skipBytes(4);
     $this->writeInt($chord->getFirstFret());
     for ($i = 0; $i < 7; $i++) {
         $this->writeInt($i < $chord->countStrings() ? $chord->getFretValue($i) : -1);
     }
     $this->skipBytes(32);
 }
コード例 #4
0
ファイル: GuitarPro4Writer.php プロジェクト: stdtabs/phptabs
 private function writeChord(Chord $chord)
 {
     $this->writeUnsignedByte(0x1);
     $this->skipBytes(16);
     $this->writeStringByte($chord->getName(), 21);
     $this->skipBytes(4);
     $this->writeInt($chord->getFirstFret());
     for ($i = 0; $i < 7; $i++) {
         $this->writeInt($i < $chord->countStrings() ? $chord->getFretValue($i) : -1);
     }
     $this->skipBytes(32);
 }