private void readArtificialHarmonic(TGNoteEffect effect) throws IOException { int type = readByte(); HarmonicEffect harmonic = null; switch (type) { case 1: harmonic = HarmonicEffect.NATURAL; break; case 2: skip(3); harmonic = HarmonicEffect.ARTIFICIAL; break; case 3: skip(1); harmonic = HarmonicEffect.TAPPED; break; case 4: harmonic = HarmonicEffect.PINCH; break; case 5: harmonic = HarmonicEffect.SEMI; break; } harmonic.setData(0); effect.setHarmonic(harmonic); }
private void readNoteEffects(TGNoteEffect noteEffect) throws IOException { int flags1 = readUnsignedByte(); int flags2 = readUnsignedByte(); noteEffect.setHammer(((flags1 & 0x02) != 0)); noteEffect.setLetRing(((flags1 & 0x08) != 0)); noteEffect.setVibrato(((flags2 & 0x40) != 0) || noteEffect.isVibrato()); noteEffect.setPalmMute(((flags2 & 0x02) != 0)); noteEffect.setStaccato(((flags2 & 0x01) != 0)); if ((flags1 & 0x01) != 0) { readBend(noteEffect); } if ((flags1 & 0x10) != 0) { readGrace(noteEffect); } if ((flags2 & 0x04) != 0) { readTremoloPicking(noteEffect); } if ((flags2 & 0x08) != 0) { noteEffect.setSlide(true); readByte(); } if ((flags2 & 0x10) != 0) { TGEffectHarmonic harmonic = getFactory().newEffectHarmonic(); int type = readByte(); if (type == 1) { harmonic.setType(TGEffectHarmonic.TYPE_NATURAL); } else if (type == 3) { harmonic.setType(TGEffectHarmonic.TYPE_TAPPED); } else if (type == 4) { harmonic.setType(TGEffectHarmonic.TYPE_PINCH); } else if (type == 5) { harmonic.setType(TGEffectHarmonic.TYPE_SEMI); } else if (type == 15) { harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL); harmonic.setData(2); } else if (type == 17) { harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL); harmonic.setData(3); } else if (type == 22) { harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL); harmonic.setData(0); } noteEffect.setHarmonic(harmonic); } if ((flags2 & 0x20) != 0) { byte fret = readByte(); byte period = readByte(); TGEffectTrill trill = getFactory().newEffectTrill(); trill.setFret(fret); if (period == 1) { trill.getDuration().setValue(TGDuration.SIXTEENTH); noteEffect.setTrill(trill); } else if (period == 2) { trill.getDuration().setValue(TGDuration.THIRTY_SECOND); noteEffect.setTrill(trill); } else if (period == 3) { trill.getDuration().setValue(TGDuration.SIXTY_FOURTH); noteEffect.setTrill(trill); } } }
private void readNoteEffect(TGNoteEffect effect) { int header = readHeader(3); // leo el bend if (((header & EFFECT_BEND) != 0)) { effect.setBend(readBendEffect()); } // leo el tremolo bar if (((header & EFFECT_TREMOLO_BAR) != 0)) { effect.setTremoloBar(readTremoloBarEffect()); } // leo el harmonic if (((header & EFFECT_HARMONIC) != 0)) { effect.setHarmonic(readHarmonicEffect()); } // leo el grace if (((header & EFFECT_GRACE) != 0)) { effect.setGrace(readGraceEffect()); } // leo el trill if (((header & EFFECT_TRILL) != 0)) { effect.setTrill(readTrillEffect()); } // leo el tremolo picking if (((header & EFFECT_TREMOLO_PICKING) != 0)) { effect.setTremoloPicking(readTremoloPickingEffect()); } // vibrato effect.setVibrato(((header & EFFECT_VIBRATO) != 0)); // dead note effect.setDeadNote(((header & EFFECT_DEAD) != 0)); // slide effect.setSlide(((header & EFFECT_SLIDE) != 0)); // hammer-on/pull-off effect.setHammer(((header & EFFECT_HAMMER) != 0)); // ghost note effect.setGhostNote(((header & EFFECT_GHOST) != 0)); // accentuated note effect.setAccentuatedNote(((header & EFFECT_ACCENTUATED) != 0)); // heavy accentuated note effect.setHeavyAccentuatedNote(((header & EFFECT_HEAVY_ACCENTUATED) != 0)); // palm mute effect.setPalmMute(((header & EFFECT_PALM_MUTE) != 0)); // staccato effect.setStaccato(((header & EFFECT_STACCATO) != 0)); // tapping effect.setTapping(((header & EFFECT_TAPPING) != 0)); // slapping effect.setSlapping(((header & EFFECT_SLAPPING) != 0)); // popping effect.setPopping(((header & EFFECT_POPPING) != 0)); // fade in effect.setFadeIn(((header & EFFECT_FADE_IN) != 0)); }