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


C# Model.Beat类代码示例

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


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


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