/** * Reads tremolo bar * * @param NoteEffect $noteEffect */ public function readTremoloBar(NoteEffect $effect) { $tremoloBar = new EffectTremoloBar(); $this->reader->skip(5); $points = $this->reader->readInt(); for ($i = 0; $i < $points; $i++) { $position = $this->reader->readInt(); $value = $this->reader->readInt(); $this->reader->readByte(); $pointPosition = round($position * EffectTremoloBar::MAX_POSITION_LENGTH / GuitarProReaderInterface::GP_BEND_POSITION); $pointValue = round($value / (GuitarProReaderInterface::GP_BEND_SEMITONE * 2)); $tremoloBar->addPoint($pointPosition, $pointValue); } if (count($tremoloBar->getPoints())) { $effect->setTremoloBar($tremoloBar); } }
/** * Reads tremolo bar * * @param NoteEffect $noteEffect */ public function readTremoloBar(NoteEffect $noteEffect) { $value = $this->reader->readInt(); $effect = new EffectTremoloBar(); $effect->addPoint(0, 0); $effect->addPoint(round(EffectTremoloBar::MAX_POSITION_LENGTH / 2), round(-($value / (GuitarProReaderInterface::GP_BEND_SEMITONE * 2)))); $effect->addPoint(EffectTremoloBar::MAX_POSITION_LENGTH, 0); $noteEffect->setTremoloBar($effect); }