protected EffectsOnBeat ReadEffectsOnBeat() { EffectsOnBeat effs = new EffectsOnBeat(); var header = new byte[2]; header[0] = ReadByte(); header[1] = ReadByte(); effs.Header = header; if ((header[0] & 0x20) != 0) { byte effect = ReadByte(); switch (effect) { case 0: break; // no effect case 1: effs.Tapping = true; break; case 2: effs.Slapping = true; break; case 3: effs.Popping = true; break; /*default: * // return effs; * throw new BodyFileStructureException( * String.Format("{0}:{1}", SR.UnexpectedEffectValue, effect));*/ } } // Tremolo bar effect if ((header[1] & 0x04) != 0) { //effs.TremoloBar = ReadBend(); /*skip(5); * TGEffectTremoloBar tremoloBar = getFactory().newEffectTremoloBar(); * int numPoints = readInt(); * for (int i = 0; i < numPoints; i++) { * int position = readInt(); * int value = readInt(); * readByte(); * * int pointPosition = Math.round(position * TGEffectTremoloBar.MAX_POSITION_LENGTH / GP_BEND_POSITION); * int pointValue = Math.round(value / (GP_BEND_SEMITONE * 2f)); * tremoloBar.addPoint(pointPosition,pointValue); * } * if(!tremoloBar.getPoints().isEmpty()){ * effect.setTremoloBar(tremoloBar); * } * }*/ ReadTremoloBar(); } if ((header[0] & 0x40) != 0) { //TODO /* // Upstroke * int durationValue = ReadByte(); * if (durationValue != 0) * effs.UpStroke = (Duration) Enum.ToObject(typeof (Duration), (byte) (6 - durationValue)); * // Downstroke * durationValue = ReadByte(); * if (durationValue != 0) * effs.DownStroke = (Duration)Enum.ToObject(typeof(Duration), (byte)(6 - durationValue));*/ int strokeUp = ReadByte(); int strokeDown = ReadByte(); if (strokeUp > 0) { /*beat.getStroke().setDirection(TGStroke.STROKE_UP); * beat.getStroke().setValue(toStrokeValue(strokeUp));*/ } else if (strokeDown > 0) { /*beat.getStroke().setDirection(TGStroke.STROKE_DOWN); * beat.getStroke().setValue(toStrokeValue(strokeDown));*/ } } // Rasgueado if ((header[1] & 0x01) != 0) { effs.HasRasgueado = true; } if ((header[1] & 0x02) != 0) { /*effs.PickStroke = ReadEnum<PickStroke>();*/ ReadByte(); } return(effs); }
protected EffectsOnBeat ReadEffectsOnBeat() { EffectsOnBeat effs = new EffectsOnBeat(); var header = new byte[1]; header[0] = ReadByte(); effs.Header = header; //TODO: /* * effect.setVibrato(((flags & 0x01) != 0) || ((flags & 0x02) != 0)); * effect.setFadeIn(((flags & 0x10) != 0)); * */ if ((header[0] & 0x20) != 0) { int type = ReadByte(); if (type == 0) { //effs.TremoloBar = ReadBend(); ReadInt(); } else { effs.Tapping = (type == 1); effs.Slapping = (type == 2); effs.Popping = (type == 3); ReadInt(); } } if ((header[0] & 0x40) != 0) { // Upstroke int durationValue = ReadByte(); if (durationValue != 0) { effs.UpStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); } // Downstroke durationValue = ReadByte(); if (durationValue != 0) { effs.DownStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); } } if ((header[0] & 0x04) != 0) { /*TGEffectHarmonic harmonic = getFactory().newEffectHarmonic(); * harmonic.setType(TGEffectHarmonic.TYPE_NATURAL); * effect.setHarmonic(harmonic);*/ } if ((header[0] & 0x08) != 0) { /*TGEffectHarmonic harmonic = getFactory().newEffectHarmonic(); * harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL); * harmonic.setData(0); * effect.setHarmonic(harmonic);*/ } /*// Rasgueado * if ((header[1] & 0x01) != 0) * effs.HasRasgueado = true; * * if ((header[1] & 0x02) != 0) * effs.PickStroke = ReadEnum<PickStroke>();*/ return(effs); }
protected EffectsOnBeat ReadEffectsOnBeat() { EffectsOnBeat effs = new EffectsOnBeat(); var header = new byte[2]; header[0] = ReadByte(); header[1] = ReadByte(); effs.Header = header; if ((header[0] & 0x20) != 0) { byte effect = ReadByte(); switch (effect) { case 0: break; // no effect case 1: effs.Tapping = true; break; case 2: effs.Slapping = true; break; case 3: effs.Popping = true; break; default: // return effs; throw new BodyFileStructureException( String.Format("{0}:{1}", SR.UnexpectedEffectValue, effect)); } } // Tremolo bar effect if ((header[1] & 0x04) != 0) { //effs.TremoloBar = ReadBend(); /* * skip(5); int points = readInt(); for (int i = 0; i < points; i++) { int position = readInt(); int value = readInt(); readByte(); int pointPosition = Math.round(position * TGEffectTremoloBar.MAX_POSITION_LENGTH / GP_BEND_POSITION); int pointValue = Math.round(value / (GP_BEND_SEMITONE * 2f)); tremoloBar.addPoint(pointPosition,pointValue); } if(!tremoloBar.getPoints().isEmpty()){ effect.setTremoloBar(tremoloBar); } * */ //Skip(18); ReadTremoloBar(); } if ((header[0] & 0x40) != 0) { // Upstroke int durationValue = ReadByte(); if (durationValue != 0) effs.UpStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); // Downstroke durationValue = ReadByte(); if (durationValue != 0) effs.DownStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); } // Rasgueado if ((header[1] & 0x01) != 0) effs.HasRasgueado = true; if ((header[1] & 0x02) != 0) effs.PickStroke = ReadEnum<PickStroke>(); return effs; }
protected EffectsOnBeat ReadEffectsOnBeat() { EffectsOnBeat effs = new EffectsOnBeat(); var header = new byte[2]; header[0] = ReadByte(); header[1] = ReadByte(); effs.Header = header; if ((header[0] & 0x20) != 0) { byte effect = ReadByte(); switch (effect) { case 0: break; // no effect case 1: effs.Tapping = true; break; case 2: effs.Slapping = true; break; case 3: effs.Popping = true; break; default: // return effs; throw new BodyFileStructureException( String.Format("{0}:{1}", SR.UnexpectedEffectValue, effect)); } } // Tremolo bar effect if ((header[1] & 0x04) != 0) { //effs.TremoloBar = ReadBend(); /* * skip(5); * int points = readInt(); * for (int i = 0; i < points; i++) { * int position = readInt(); * int value = readInt(); * readByte(); * * int pointPosition = Math.round(position * TGEffectTremoloBar.MAX_POSITION_LENGTH / GP_BEND_POSITION); * int pointValue = Math.round(value / (GP_BEND_SEMITONE * 2f)); * tremoloBar.addPoint(pointPosition,pointValue); * } * if(!tremoloBar.getPoints().isEmpty()){ * effect.setTremoloBar(tremoloBar); * } * */ //Skip(18); ReadTremoloBar(); } if ((header[0] & 0x40) != 0) { // Upstroke int durationValue = ReadByte(); if (durationValue != 0) { effs.UpStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); } // Downstroke durationValue = ReadByte(); if (durationValue != 0) { effs.DownStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); } } // Rasgueado if ((header[1] & 0x01) != 0) { effs.HasRasgueado = true; } if ((header[1] & 0x02) != 0) { effs.PickStroke = ReadEnum <PickStroke>(); } return(effs); }
protected EffectsOnBeat ReadEffectsOnBeat() { EffectsOnBeat effs = new EffectsOnBeat(); var header = new byte[1]; header[0] = ReadByte(); effs.Header = header; //TODO: /* * effect.setVibrato(((flags & 0x01) != 0) || ((flags & 0x02) != 0)); effect.setFadeIn(((flags & 0x10) != 0)); * */ if ((header[0] & 0x20) != 0) { int type = ReadByte(); if (type == 0) { //effs.TremoloBar = ReadBend(); ReadInt(); } else { effs.Tapping = (type == 1); effs.Slapping = (type == 2); effs.Popping = (type == 3); ReadInt(); } } if ((header[0] & 0x40) != 0) { // Upstroke int durationValue = ReadByte(); if (durationValue != 0) effs.UpStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); // Downstroke durationValue = ReadByte(); if (durationValue != 0) effs.DownStroke = (Duration)Enum.ToObject(typeof(Duration), 6 - durationValue); } if ((header[0] & 0x04) != 0) { /*TGEffectHarmonic harmonic = getFactory().newEffectHarmonic(); harmonic.setType(TGEffectHarmonic.TYPE_NATURAL); effect.setHarmonic(harmonic);*/ } if ((header[0] & 0x08) != 0) { /*TGEffectHarmonic harmonic = getFactory().newEffectHarmonic(); harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL); harmonic.setData(0); effect.setHarmonic(harmonic);*/ } /*// Rasgueado if ((header[1] & 0x01) != 0) effs.HasRasgueado = true; if ((header[1] & 0x02) != 0) effs.PickStroke = ReadEnum<PickStroke>();*/ return effs; }