private function writeBeatEffects(Beat $beat, NoteEffect $noteEffect) { $flags = 0; if ($noteEffect->isVibrato()) { $flags += 0x1; } if ($noteEffect->isTremoloBar() || $noteEffect->isTapping() || $noteEffect->isSlapping() || $noteEffect->isPopping()) { $flags += 0x20; } if ($beat->getStroke()->getDirection() != Stroke::STROKE_NONE) { $flags |= 0x40; } if ($noteEffect->isHarmonic() && $noteEffect->getHarmonic()->getType() == EffectHarmonic::TYPE_NATURAL) { $flags += 0x4; } if ($noteEffect->isHarmonic() && $noteEffect->getHarmonic()->getType() != EffectHarmonic::TYPE_NATURAL) { $flags += 0x8; } if ($noteEffect->isFadeIn()) { $flags += 0x10; } $this->writeUnsignedByte($flags); if (($flags & 0x20) != 0) { if ($noteEffect->isTremoloBar()) { $this->writeUnsignedByte(0); $this->writeInt(100); } else { if ($noteEffect->isTapping()) { $this->writeUnsignedByte(1); $this->writeInt(0); } else { if ($noteEffect->isSlapping()) { $this->writeUnsignedByte(2); $this->writeInt(0); } else { if ($noteEffect->isPopping()) { $this->writeUnsignedByte(3); $this->writeInt(0); } } } } } if (($flags & 0x40) != 0) { $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_DOWN ? $this->toStrokeValue($beat->getStroke()) : 0); $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_UP ? $this->toStrokeValue($beat->getStroke()) : 0); } }
private function writeBeatEffects(Beat $beat, NoteEffect $noteEffect) { $flags1 = 0; $flags2 = 0; if ($noteEffect->isFadeIn()) { $flags1 |= 0x10; } if ($noteEffect->isTapping() || $noteEffect->isSlapping() || $noteEffect->isPopping()) { $flags1 |= 0x20; } if ($noteEffect->isTremoloBar()) { $flags2 |= 0x4; } if ($beat->getStroke()->getDirection() != Stroke::STROKE_NONE) { $flags1 |= 0x40; } $this->writeUnsignedByte($flags1); $this->writeUnsignedByte($flags2); if (($flags1 & 0x20) != 0) { if ($noteEffect->isTapping()) { $this->writeUnsignedByte(1); } else { if ($noteEffect->isSlapping()) { $this->writeUnsignedByte(2); } else { if ($noteEffect->isPopping()) { $this->writeUnsignedByte(3); } } } } if (($flags2 & 0x4) != 0) { $this->writeTremoloBar($noteEffect->getTremoloBar()); } if (($flags1 & 0x40) != 0) { $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_UP ? $this->toStrokeValue($beat->getStroke()) : 0); $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_DOWN ? $this->toStrokeValue($beat->getStroke()) : 0); } }