AlphaTab.Importer.AlphaTexImporter.NoteEffects C# (CSharp) Method

NoteEffects() private method

private NoteEffects ( Note note ) : void
note AlphaTab.Model.Note
return void
        private void NoteEffects(Note note)
        {
            if (_sy != AlphaTexSymbols.LBrace)
            {
                return;
            }
            NewSy();

            while (_sy == AlphaTexSymbols.String)
            {
                var syData = _syData.ToString().ToLower();
                _syData = syData;
                if (syData == "b" || syData == "be")
                {
                    var exact = (string) _syData == "be";
                    // read points
                    NewSy();
                    if (_sy != AlphaTexSymbols.LParensis)
                    {
                        Error("bend-effect", AlphaTexSymbols.LParensis);
                    }

                    NewSy();
                    while (_sy != AlphaTexSymbols.RParensis && _sy != AlphaTexSymbols.Eof)
                    {
                        var offset = 0;
                        var value = 0;
                        if (exact)
                        {
                            if (_sy != AlphaTexSymbols.Number)
                            {
                                Error("bend-effect-value", AlphaTexSymbols.Number);
                            }
                            offset = (int)_syData;

                            NewSy();
                            if (_sy != AlphaTexSymbols.Number)
                            {
                                Error("bend-effect-value", AlphaTexSymbols.Number);
                            }
                            value = (int)_syData;
                        }
                        else
                        {
                            if (_sy != AlphaTexSymbols.Number)
                            {
                                Error("bend-effect-value", AlphaTexSymbols.Number);
                            }
                            value = (int)_syData;
                        }

                        note.AddBendPoint(new BendPoint(offset, value));
                        NewSy();
                    }

                    while (note.BendPoints.Count > 60)
                    {
                        note.BendPoints.RemoveAt(note.BendPoints.Count - 1);
                    }

                    // set positions
                    if (exact)
                    {
                        note.BendPoints.Sort((a, b) => a.Offset - b.Offset);
                    }
                    else
                    {
                        var count = note.BendPoints.Count;
                        var step = 60 / (count - 1);
                        var i = 0;
                        while (i < count)
                        {
                            note.BendPoints[i].Offset = Math.Min(60, (i * step));
                            i++;
                        }
                    }

                    if (_sy != AlphaTexSymbols.RParensis)
                    {
                        Error("bend-effect", AlphaTexSymbols.RParensis);
                    }
                    NewSy();
                }
                else if (syData == "nh")
                {
                    note.HarmonicType = HarmonicType.Natural;
                    NewSy();
                }
                else if (syData == "ah")
                {
                    // todo: Artificial Key
                    note.HarmonicType = HarmonicType.Artificial;
                    NewSy();
                }
                else if (syData == "th")
                {
                    // todo: store tapped fret in data
                    note.HarmonicType = HarmonicType.Tap;
                    NewSy();
                }
                else if (syData == "ph")
                {
                    note.HarmonicType = HarmonicType.Pinch;
                    NewSy();
                }
                else if (syData == "sh")
                {
                    note.HarmonicType = HarmonicType.Semi;
                    NewSy();
                }
                else if (syData == "tr")
                {
                    NewSy();
                    if (_sy != AlphaTexSymbols.Number)
                    {
                        Error("trill-effect", AlphaTexSymbols.Number);
                    }
                    int fret = (int)_syData;
                    NewSy();

                    var duration = Duration.Sixteenth;
                    if (_sy == AlphaTexSymbols.Number)
                    {
                        switch ((int)_syData)
                        {
                            case 16:
                                duration = Duration.Sixteenth;
                                break;
                            case 32:
                                duration = Duration.ThirtySecond;
                                break;
                            case 64:
                                duration = Duration.SixtyFourth;
                                break;
                            default:
                                duration = Duration.Sixteenth;
                                break;
                        }
                        NewSy();
                    }

                    note.TrillValue = fret + note.StringTuning;
                    note.TrillSpeed = duration;
                }
                else if (syData == "v")
                {
                    NewSy();
                    note.Vibrato = VibratoType.Slight;
                }
                else if (syData == "sl")
                {
                    NewSy();
                    note.SlideType = SlideType.Legato;
                }
                else if (syData == "ss")
                {
                    NewSy();
                    note.SlideType = SlideType.Shift;
                }
                else if (syData == "h")
                {
                    NewSy();
                    note.IsHammerPullOrigin = true;
                }
                else if (syData == "g")
                {
                    NewSy();
                    note.IsGhost = true;
                }
                else if (syData == "ac")
                {
                    NewSy();
                    note.Accentuated = AccentuationType.Normal;
                }
                else if (syData == "hac")
                {
                    NewSy();
                    note.Accentuated = AccentuationType.Heavy;
                }
                else if (syData == "pm")
                {
                    NewSy();
                    note.IsPalmMute = true;
                }
                else if (syData == "st")
                {
                    NewSy();
                    note.IsStaccato = true;
                }
                else if (syData == "lr")
                {
                    NewSy();
                    note.IsLetRing = true;
                }
                else if (syData == "x")
                {
                    NewSy();
                    note.Fret = 0;
                    note.IsDead = true;
                }
                else if (syData == "lf")
                {
                    NewSy();
                    var finger = Fingers.Thumb;
                    if (_sy == AlphaTexSymbols.Number)
                    {
                        finger = ToFinger((int)_syData);
                        NewSy();
                    }
                    note.LeftHandFinger = finger;
                }
                else if (syData == "rf")
                {
                    NewSy();
                    var finger = Fingers.Thumb;
                    if (_sy == AlphaTexSymbols.Number)
                    {
                        finger = ToFinger((int)_syData);
                        NewSy();
                    }
                    note.RightHandFinger = finger;
                }
                else if (ApplyBeatEffect(note.Beat)) // also try beat effects
                {
                    // Success
                }
                else
                {
                    Error(syData, AlphaTexSymbols.String, false);
                }
            }

            if (_sy != AlphaTexSymbols.RBrace)
            {
                Error("note-effect", AlphaTexSymbols.RBrace, false);
            }
            NewSy();
        }