• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Model.Beat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AlphaTab.Model.Beat的典型用法代码示例。如果您正苦于以下问题:C# Beat类的具体用法?C# Beat怎么用?C# Beat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Beat类属于AlphaTab.Model命名空间,在下文中一共展示了Beat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FindStringForValue

        private int FindStringForValue(Track track, Beat beat, int value)
        {
            // find strings which are already taken
            var takenStrings = new FastDictionary<int, bool>();
            for (int i = 0; i < beat.Notes.Count; i++)
            {
                var note = beat.Notes[i];
                takenStrings[note.String] = true;
            }

            // find a string where the note matches into 0 to <upperbound>

            // first try to find a string from 0-14 (more handy to play)
            // then try from 0-20 (guitars with high frets)
            // then unlimited
            int[] steps = { 14, 20, int.MaxValue };
            for (int i = 0; i < steps.Length; i++)
            {
                for (int j = 0; j < track.Tuning.Length; j++)
                {
                    if (!takenStrings.ContainsKey(j))
                    {
                        var min = track.Tuning[j];
                        var max = track.Tuning[j] + steps[i];

                        if (value >= min && value <= max)
                        {
                            return track.Tuning.Length - j;
                        }
                    }
                }
            }
            // will not happen
            return 1;
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:35,代码来源:MusicXml2Importer.cs


示例2: AddBeat

 public void AddBeat(Beat beat)
 {
     // chaining
     beat.Voice = this;
     beat.Index = Beats.Count;
     Beats.Add(beat);
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:7,代码来源:Voice.cs


示例3: BeatContainerGlyph

 public BeatContainerGlyph(Beat beat, VoiceContainerGlyph voiceContainer, bool useLayoutingInfo = false)
     : base(0, 0)
 {
     Beat = beat;
     Ties = new FastList<Glyph>();
     VoiceContainer = voiceContainer;
     UseLayoutingInfo = useLayoutingInfo;
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:8,代码来源:BeatContainerGlyph.cs


示例4: ShouldCreateGlyph

 public bool ShouldCreateGlyph(EffectBarRenderer renderer, Beat beat)
 {
     return beat.Index == 0 &&
         (
             (beat.Voice.Bar.MasterBar.Index == 0 && beat.Voice.Bar.MasterBar.TripletFeel != TripletFeel.NoTripletFeel)
             || (beat.Voice.Bar.MasterBar.Index > 0 && beat.Voice.Bar.MasterBar.TripletFeel != beat.Voice.Bar.MasterBar.PreviousMasterBar.TripletFeel)
         );
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:8,代码来源:TripletFeelEffectInfo.cs


示例5: GetBeatDirection

 public BeamDirection GetBeatDirection(Beat beat)
 {
     ScoreBeatGlyph g = (ScoreBeatGlyph)GetOnNotesPosition(beat.Voice.Index, beat.Index);
     if (g != null)
     {
         return g.NoteHeads.Direction;
     }
     return BeamDirection.Up;
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:9,代码来源:ScoreBarRenderer.cs


示例6: GetBeatX

 public float GetBeatX(Beat beat)
 {
     var bg = (TabBeatGlyph)GetPreNotesPosition(beat.Voice.Index, beat.Index);
     if (bg != null)
     {
         return bg.Container.X + bg.X;
     }
     return 0;
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:9,代码来源:TabBarRenderer.cs


示例7: ShouldCreateGlyphForNote

 protected override bool ShouldCreateGlyphForNote(EffectBarRenderer renderer, Note note)
 {
     if (!note.IsHarmonic) return false;
     if (note.Beat != _beat || note.HarmonicType > _beatType)
     {
         _beat = note.Beat;
         _beatType = note.HarmonicType;
     }
     return true;
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:10,代码来源:HarmonicsEffectInfo.cs


示例8: CreateNewGlyph

 public EffectGlyph CreateNewGlyph(EffectBarRenderer renderer, Beat beat)
 {
     var res = renderer.Resources;
     if (beat.Slap)
     {
         return new TextGlyph(0, 0, "S", res.EffectFont);
     }
     if (beat.Pop)
     {
         return new TextGlyph(0, 0, "P", res.EffectFont);
     }
     return new TextGlyph(0, 0, "T", res.EffectFont);
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:13,代码来源:TapEffectInfo.cs


示例9: Check

 public bool Check(Beat beat)
 {
     if (Beats.Count == 0)
     {
         Tuplet = beat.TupletNumerator;
     }
     else if (beat.Voice.Index != VoiceIndex || beat.TupletNumerator != Tuplet || IsFull || _isFinished)
     {
         return false;
     }
     Beats.Add(beat);
     return true;
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:13,代码来源:TupletHelper.cs


示例10: CreateNewGlyph

 public EffectGlyph CreateNewGlyph(EffectBarRenderer renderer, Beat beat)
 {
     int tempo;
     if (beat.Voice.Bar.MasterBar.TempoAutomation != null)
     {
         tempo = (int)(beat.Voice.Bar.MasterBar.TempoAutomation.Value);
     }
     else
     {
         tempo = beat.Voice.Bar.Staff.Track.Score.Tempo;
     }
     return new TempoGlyph(0, 0, tempo);
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:13,代码来源:TempoEffectInfo.cs


示例11: ShouldCreateGlyph

 public virtual bool ShouldCreateGlyph(EffectBarRenderer renderer, Beat beat)
 {
     LastCreateInfo = new FastList<Note>();
     for (int i = 0, j = beat.Notes.Count; i < j; i++)
     {
         var n = beat.Notes[i];
         if (ShouldCreateGlyphForNote(renderer, n))
         {
             LastCreateInfo.Add(n);
         }
     }
     return LastCreateInfo.Count > 0;
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:13,代码来源:NoteEffectInfoBase.cs


示例12: AddGraceBeat

        public void AddGraceBeat(Beat beat)
        {
            if (Beats.Count == 0)
            {
                AddBeat(beat);
                return;
            }

            // remove last beat
            var lastBeat = Beats[Beats.Count - 1];
            Beats.RemoveAt(Beats.Count - 1);

            // insert grace beat
            AddBeat(beat);
            // reinsert last beat
            AddBeat(lastBeat);
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:17,代码来源:Voice.cs


示例13: Chain

 private void Chain(Beat beat)
 {
     if (Bar == null) return;
     if (Bar.Index == 0 && beat.Index == 0)
     {
         // very first beat
         beat.PreviousBeat = null; 
     }
     else if (beat.Index == 0)
     {
         // first beat of bar
         var previousVoice = Bar.PreviousBar.Voices[Index];
         beat.PreviousBeat = previousVoice.Beats[previousVoice.Beats.Count - 1];
         beat.PreviousBeat.NextBeat = beat;
     }
     else
     {
         // other beats of bar
         beat.PreviousBeat = Beats[beat.Index - 1];
         beat.PreviousBeat.NextBeat = beat;
     }
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:22,代码来源:Voice.cs


示例14: ApplyNoteStringFrets

 private void ApplyNoteStringFrets(Track track, Beat beat, Note note, int fullNoteValue)
 {
     note.String = FindStringForValue(track, beat, fullNoteValue);
     note.Fret = fullNoteValue - Note.GetStringTuning(track, note.String);
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:5,代码来源:MusicXml2Importer.cs


示例15: ParseNoteBeat

        private bool ParseNoteBeat(IXmlNode element, Track track, Bar bar, bool chord, bool isFirstBeat)
        {
            int voiceIndex = 0;
            var voiceNodes = element.GetElementsByTagName("voice");
            if (voiceNodes.Length > 0)
            {
                voiceIndex = Std.ParseInt(Std.GetNodeValue(voiceNodes[0])) - 1;
            }

            Beat beat;
            var voice = GetOrCreateVoice(bar, voiceIndex);
            if (chord || (isFirstBeat && voice.Beats.Count == 1))
            {
                beat = voice.Beats[voice.Beats.Count - 1];
            }
            else
            {
                beat = new Beat();
                voice.AddBeat(beat);
            }

            var note = new Note();
            beat.AddNote(note);
            beat.IsEmpty = false;

            element.IterateChildren(c =>
            {
                if (c.NodeType == XmlNodeType.Element)
                {
                    switch (c.LocalName)
                    {
                        case "grace":
                            //var slash = e.GetAttribute("slash");
                            //var makeTime = Std.ParseInt(e.GetAttribute("make-time"));
                            //var stealTimePrevious = Std.ParseInt(e.GetAttribute("steal-time-previous"));
                            //var stealTimeFollowing = Std.ParseInt(e.GetAttribute("steal-time-following"));
                            beat.GraceType = GraceType.BeforeBeat;
                            beat.Duration = Duration.ThirtySecond;
                            break;
                        case "duration":
                            beat.Duration = (Duration)Std.ParseInt(Std.GetNodeValue(c));
                            break;
                        case "tie":
                            ParseTied(c, note);
                            break;
                        case "cue":
                            // not supported
                            break;
                        case "instrument":
                            // not supported
                            break;
                        case "type":
                            switch (Std.GetNodeValue(c))
                            {
                                case "256th":
                                    beat.Duration = Duration.TwoHundredFiftySixth;
                                    break;
                                case "128th":
                                    beat.Duration = Duration.OneHundredTwentyEighth;
                                    break;
                                case "breve":
                                    beat.Duration = Duration.DoubleWhole;
                                    break;
                                case "long":
                                    beat.Duration = Duration.QuadrupleWhole;
                                    break;
                                case "64th":
                                    beat.Duration = Duration.SixtyFourth;
                                    break;
                                case "32nd":
                                    beat.Duration = Duration.ThirtySecond;
                                    break;
                                case "16th":
                                    beat.Duration = Duration.Sixteenth;
                                    break;
                                case "eighth":
                                    beat.Duration = Duration.Eighth;
                                    break;
                                case "quarter":
                                    beat.Duration = Duration.Quarter;
                                    break;
                                case "half":
                                    beat.Duration = Duration.Half;
                                    break;
                                case "whole":
                                    beat.Duration = Duration.Whole;
                                    break;
                            }
                            break;
                        case "dot":
                            note.IsStaccato = true;
                            break;
                        case "accidental":
                            ParseAccidental(c, note);
                            break;
                        case "time-modification":
                            ParseTimeModification(c, beat);
                            break;
                        case "stem":
                            // not supported
//.........这里部分代码省略.........
开发者ID:CoderLine,项目名称:alphaTab,代码行数:101,代码来源:MusicXml2Importer.cs


示例16: ParseNotations

 private void ParseNotations(IXmlNode element, Beat beat, Note note)
 {
     element.IterateChildren(c =>
     {
         if (c.NodeType == XmlNodeType.Element)
         {
             switch (c.LocalName)
             {
                 case "tied":
                     ParseTied(c, note);
                     break;
                 case "slide":
                     if (c.GetAttribute("type") == "start")
                     {
                         note.SlideType = SlideType.Legato;
                     }
                     break;
                 case "dynamics":
                     ParseDynamics(c, beat);
                     break;
             }
         }
     });
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:24,代码来源:MusicXml2Importer.cs


示例17: ParseMeasure

        private void ParseMeasure(IXmlNode element, Track track, bool isFirstMeasure)
        {
            var barIndex = 0;
            if (isFirstMeasure)
            {
                _trackFirstMeasureNumber = Std.ParseInt(element.GetAttribute("number"));
                barIndex = 0;
            }
            else
            {
                barIndex = Std.ParseInt(element.GetAttribute("number")) - _trackFirstMeasureNumber;
            }

            // create empty bars to the current index
            Bar bar = null;
            MasterBar masterBar = null;
            for (int i = track.Staves[0].Bars.Count; i <= barIndex; i++)
            {
                bar = new Bar();
                masterBar = GetOrCreateMasterBar(barIndex);
                track.AddBarToStaff(0, bar);

                for (int j = 0; j < _maxVoices; j++)
                {
                    var emptyVoice = new Voice();
                    bar.AddVoice(emptyVoice);
                    var emptyBeat = new Beat { IsEmpty = true };
                    emptyVoice.AddBeat(emptyBeat);
                }
            }

            bool chord = false;
            bool isFirstBeat = true;

            element.IterateChildren(c =>
            {
                if (c.NodeType == XmlNodeType.Element)
                {
                    switch (c.LocalName)
                    {
                        case "note":
                            chord = ParseNoteBeat(c, track, bar, chord, isFirstBeat);
                            isFirstBeat = false;
                            break;
                        case "forward":
                            break;
                        case "direction":
                            ParseDirection(c, masterBar);
                            break;
                        case "attributes":
                            ParseAttributes(c, bar, masterBar);
                            break;
                        case "harmony":
                            // TODO
                            break;
                        case "sound":
                            // TODO
                            break;
                        case "barline":
                            // TODO
                            break;
                    }
                }
            });
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:65,代码来源:MusicXml2Importer.cs


示例18: ParseDynamics

 private void ParseDynamics(IXmlNode element, Beat beat)
 {
     element.IterateChildren(c =>
     {
         if (c.NodeType == XmlNodeType.Element)
         {
             switch (c.LocalName)
             {
                 case "p":
                     beat.Dynamic = DynamicValue.P;
                     break;
                 case "pp":
                     beat.Dynamic = DynamicValue.PP;
                     break;
                 case "ppp":
                     beat.Dynamic = DynamicValue.PPP;
                     break;
                 case "f":
                     beat.Dynamic = DynamicValue.F;
                     break;
                 case "ff":
                     beat.Dynamic = DynamicValue.FF;
                     break;
                 case "fff":
                     beat.Dynamic = DynamicValue.FFF;
                     break;
                 case "mp":
                     beat.Dynamic = DynamicValue.MP;
                     break;
                 case "mf":
                     beat.Dynamic = DynamicValue.MF;
                     break;
             }
         }
     });
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:36,代码来源:MusicXml2Importer.cs


示例19: ExpandTo

 public override void ExpandTo(Beat beat)
 {
     _isExpanded = true;
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:4,代码来源:LineRangedGlyph.cs


示例20: ApplyBeatEffect

        /// <summary>
        /// Tries to apply a beat effect to the given beat.
        /// </summary>
        /// <returns>true if a effect could be applied, otherwise false</returns>
        private bool ApplyBeatEffect(Beat beat)
        {
            var syData = _syData.ToString().ToLower();
            if (syData == "f")
            {
                beat.FadeIn = true;
                NewSy();
                return true;
            }
            if (syData == "v")
            {
                beat.Vibrato = VibratoType.Slight;
                NewSy();
                return true;
            }
            if (syData == "s")
            {
                beat.Slap = true;
                NewSy();
                return true;
            }
            if (syData == "p")
            {
                beat.Pop = true;
                NewSy();
                return true;
            }
            if (syData == "dd")
            {
                beat.Dots = 2;
                NewSy();
                return true;
            }
            if (syData == "d")
            {
                beat.Dots = 1;
                NewSy();
                return true;
            }
            if (syData == "su")
            {
                beat.PickStroke = PickStrokeType.Up;
                NewSy();
                return true;
            }
            if (syData == "sd")
            {
                beat.PickStroke = PickStrokeType.Down;
                NewSy();
                return true;
            }
            if (syData == "tu")
            {
                NewSy();
                if (_sy != AlphaTexSymbols.Number)
                {
                    Error("tuplet", AlphaTexSymbols.Number);
                    return false;
                }
                var tuplet = (int)_syData;
                switch (tuplet)
                {
                    case 3:
                        beat.TupletDenominator = 3;
                        beat.TupletNumerator = 2;
                        break;
                    case 5:
                        beat.TupletDenominator = 5;
                        beat.TupletNumerator = 4;
                        break;
                    case 6:
                        beat.TupletDenominator = 6;
                        beat.TupletNumerator = 4;
                        break;
                    case 7:
                        beat.TupletDenominator = 7;
                        beat.TupletNumerator = 4;
                        break;
                    case 9:
                        beat.TupletDenominator = 9;
                        beat.TupletNumerator = 8;
                        break;
                    case 10:
                        beat.TupletDenominator = 10;
                        beat.TupletNumerator = 8;
                        break;
                    case 11:
                        beat.TupletDenominator = 11;
                        beat.TupletNumerator = 8;
                        break;
                    case 12:
                        beat.TupletDenominator = 12;
                        beat.TupletNumerator = 8;
                        break;
                }
                NewSy();
//.........这里部分代码省略.........
开发者ID:eriser,项目名称:alphaTab,代码行数:101,代码来源:AlphaTexImporter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Model.Note类代码示例发布时间:2022-05-24
下一篇:
C# DataAccess.CSSDataContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap