当前位置: 首页>>代码示例>>C#>>正文


C# Note.AddBendPoint方法代码示例

本文整理汇总了C#中AlphaTab.Model.Note.AddBendPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Note.AddBendPoint方法的具体用法?C# Note.AddBendPoint怎么用?C# Note.AddBendPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AlphaTab.Model.Note的用法示例。


在下文中一共展示了Note.AddBendPoint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NoteEffects

        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")
                {
                    // read points
                    NewSy();
                    if (_sy != AlphaTexSymbols.LParensis)
                    {
                        Error("bend-effect", AlphaTexSymbols.LParensis);
                    }
                    NewSy();

                    while (_sy != AlphaTexSymbols.RParensis && _sy != AlphaTexSymbols.Eof)
                    {
                        if (_sy != AlphaTexSymbols.Number)
                        {
                            Error("bend-effect-value", AlphaTexSymbols.Number);
                        }
                        var bendValue = (int)_syData;
                        note.AddBendPoint(new BendPoint(0, (Math.Abs(bendValue))));
                        NewSy();
                    }

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

                    // set positions
                    var count = note.BendPoints.Count;
                    var step = 60 / count;
                    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 == "gr") // TODO: Make this a beat effect!
                {
                    NewSy();
                    if (_syData.ToString().ToLower() == "ob")
                    {
                        note.Beat.GraceType = GraceType.OnBeat;
                        NewSy();
                    }
                    else
                    {
                        note.Beat.GraceType = GraceType.BeforeBeat;
                    }
                }
                else if (syData == "tr")
                {
                    NewSy();
                    if (_sy != AlphaTexSymbols.Number)
                    {
//.........这里部分代码省略.........
开发者ID:eriser,项目名称:alphaTab,代码行数:101,代码来源:AlphaTexImporter.cs

示例2: ParseNoteProperties


//.........这里部分代码省略.........
                                        note.IsPalmMute = true;
                                    break;
                                // case "Element":
                                // case "Variation":
                                // case "Tone":
                                case "Octave":
                                    note.Octave = Std.ParseInt(GetValue(FindChildElement(c, "Number"))) - 1;
                                    break;
                                case "Tone":
                                    note.Tone = Std.ParseInt(GetValue(FindChildElement(c, "Step")));
                                    break;
                                case "Bended":
                                    isBended = true;
                                    break;

                                case "BendOriginValue":
                                    if (bendOrigin == null) bendOrigin = new BendPoint();
                                    bendOrigin.Value = ToBendValue(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;
                                case "BendOriginOffset":
                                    if (bendOrigin == null) bendOrigin = new BendPoint();
                                    bendOrigin.Offset = ToBendOffset(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;

                                case "BendMiddleValue":
                                    bendMiddleValue = ToBendValue(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;

                                case "BendMiddleOffset1":
                                    bendMiddleOffset1 = ToBendOffset(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;
                                case "BendMiddleOffset2":
                                    bendMiddleOffset2 = ToBendOffset(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;

                                case "BendDestinationValue":
                                    if (bendDestination == null) bendDestination = new BendPoint(BendPoint.MaxPosition);
                                    // NOTE: If we directly cast the expression of value to (int) it is 3 instead of 4, strange compiler
                                    // optimizations happening here:
                                    // (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float")))* BendPointValueFactor) => (int)(100f * 0.04f) => 3
                                    // (Std.ParseFloat(GetValue(FindChildElement(c, "Float")))* BendPointValueFactor) => (100f * 0.04f) => 4.0
                                    bendDestination.Value = ToBendValue(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;

                                case "BendDestinationOffset":
                                    if (bendDestination == null) bendDestination = new BendPoint();
                                    bendDestination.Offset = ToBendOffset(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))));
                                    break;

                                case "HopoOrigin":
                                    if (FindChildElement(c, "Enable") != null)
                                        note.IsHammerPullOrigin = true;
                                    break;
                                case "HopoDestination":
                                    // NOTE: gets automatically calculated
                                    // if (FindChildElement(node, "Enable") != null)
                                    //     note.isHammerPullDestination = true;
                                    break;
                                case "Slide":
                                    var slideFlags = Std.ParseInt(GetValue(FindChildElement(c, "Flags")));
                                    if ((slideFlags & 0x01) != 0)
                                        note.SlideType = SlideType.Shift;
                                    if ((slideFlags & 0x02) != 0)
                                        note.SlideType = SlideType.Legato;
                                    if ((slideFlags & 0x04) != 0)
                                        note.SlideType = SlideType.OutDown;
                                    if ((slideFlags & 0x08) != 0)
                                        note.SlideType = SlideType.OutUp;
                                    if ((slideFlags & 0x10) != 0)
                                        note.SlideType = SlideType.IntoFromBelow;
                                    if ((slideFlags & 0x20) != 0)
                                        note.SlideType = SlideType.IntoFromAbove;
                                    break;
                            }
                            break;
                    }
                }
            });

            if (isBended)
            {
                if (bendOrigin == null) bendOrigin = new BendPoint();
                if (bendDestination == null) bendDestination = new BendPoint(BendPoint.MaxPosition);
                note.AddBendPoint(bendOrigin);
                if (bendMiddleOffset1 != null && bendMiddleValue != null)
                {
                    note.AddBendPoint(new BendPoint(bendMiddleOffset1.Value, bendMiddleValue.Value));
                }
                if (bendMiddleOffset2 != null && bendMiddleValue != null)
                {
                    note.AddBendPoint(new BendPoint(bendMiddleOffset2.Value, bendMiddleValue.Value));
                }

                if (bendMiddleOffset1 == null && bendMiddleOffset2 == null && bendMiddleValue != null)
                {
                    note.AddBendPoint(new BendPoint(BendPoint.MaxPosition / 2, bendMiddleValue.Value));
                }
                note.AddBendPoint(bendDestination);
            }
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:101,代码来源:GpxParser.cs

示例3: ReadBend

 public void ReadBend(Note note)
 {
     Data.ReadByte(); // type
     ReadInt32(); // value
     var pointCount = ReadInt32();
     if (pointCount > 0)
     {
         for (int i = 0; i < pointCount; i++)
         {
             var point = new BendPoint();
             point.Offset = ReadInt32(); // 0...60
             point.Value = ReadInt32() / BendStep; // 0..12 (amount of quarters)
             ReadBool(); // vibrato
             note.AddBendPoint(point);
         }
     }
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:17,代码来源:Gp3To5Importer.cs

示例4: JsObjectToScore


//.........这里部分代码省略.........
                }
                score2.AddMasterBar(masterBar2);
            }

            #endregion

            #region Tracks

            for (int t = 0; t < score.Tracks.Count; t++)
            {
                var track = score.Tracks[t];
                var track2 = new Track();
                Track.CopyTo(track, track2);
                score2.AddTrack(track2);

                PlaybackInformation.CopyTo(track.PlaybackInfo, track2.PlaybackInfo);

                foreach (var key in track.Chords.Keys)
                {
                    var chord = track.Chords[key];
                    var chord2 = new Chord();
                    Chord.CopyTo(chord, chord2);
                    track2.Chords[key] = chord2;
                }

                #region Bars

                for (int b = 0; b < track.Bars.Count; b++)
                {
                    var bar = track.Bars[b];
                    var bar2 = new Bar();
                    Bar.CopyTo(bar, bar2);
                    track2.AddBar(bar2);

                    #region Voices

                    for (int v = 0; v < bar.Voices.Count; v++)
                    {
                        var voice = bar.Voices[v];
                        var voice2 = new Voice();
                        Voice.CopyTo(voice, voice2);
                        bar2.AddVoice(voice2);

                        #region Beats

                        for (int bb = 0; bb < voice.Beats.Count; bb++)
                        {
                            var beat = voice.Beats[bb];
                            var beat2 = new Beat();
                            Beat.CopyTo(beat, beat2);
                            voice2.AddBeat(beat2);

                            for (int a = 0; a < beat.Automations.Count; a++)
                            {
                                var automation = new Automation();
                                Automation.CopyTo(beat.Automations[a], automation);
                                beat2.Automations.Add(automation);
                            }
                            
                            for (int i = 0; i < beat.WhammyBarPoints.Count; i++)
                            {
                                var point = new BendPoint();
                                BendPoint.CopyTo(beat.WhammyBarPoints[i], point);
                                beat2.WhammyBarPoints.Add(point);
                            }
                            
                            #region Notes

                            for (int n = 0; n < beat.Notes.Count; n++)
                            {
                                var note = beat.Notes[n];
                                var note2 = new Note();
                                Note.CopyTo(note, note2);
                                beat2.AddNote(note2);

                                for (int i = 0; i < note.BendPoints.Count; i++)
                                {
                                    var point = new BendPoint();
                                    BendPoint.CopyTo(note.BendPoints[i], point);
                                    note2.AddBendPoint(point);
                                }
                            }

                            #endregion
                        }

                        #endregion
                    }

                    #endregion
                }
                
                #endregion
            }

            #endregion

            score2.Finish();
            return score2;
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:101,代码来源:JsonConverter.cs

示例5: Clone

 public Note Clone()
 {
     var n = new Note();
     CopyTo(this, n);
     for (int i = 0, j = BendPoints.Count; i < j; i++)
     {
         n.AddBendPoint(BendPoints[i].Clone());
     }
     return n;
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:10,代码来源:Note.cs

示例6: NoteEffects

        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();
                }
//.........这里部分代码省略.........
开发者ID:CoderLine,项目名称:alphaTab,代码行数:101,代码来源:AlphaTexImporter.cs


注:本文中的AlphaTab.Model.Note.AddBendPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。