Exemple #1
0
 private function readFret(Chord $chord, $index)
 {
     $fret = $this->reader->readInt();
     if ($index < $chord->countStrings()) {
         $chord->addFretValue($index, $fret);
     }
 }
Exemple #2
0
 private function readStrings(Chord $chord)
 {
     for ($i = 0; $i < 6; $i++) {
         $fret = $this->reader->readInt();
         if ($i < $chord->countStrings()) {
             $chord->addFretValue($i, $fret);
         }
     }
 }
Exemple #3
0
 /**
  * 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);
     }
 }
Exemple #4
0
 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);
 }
Exemple #5
0
 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);
 }