本文整理汇总了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;
}
示例2: AddBeat
public void AddBeat(Beat beat)
{
// chaining
beat.Voice = this;
beat.Index = Beats.Count;
Beats.Add(beat);
}
示例3: BeatContainerGlyph
public BeatContainerGlyph(Beat beat, VoiceContainerGlyph voiceContainer, bool useLayoutingInfo = false)
: base(0, 0)
{
Beat = beat;
Ties = new FastList<Glyph>();
VoiceContainer = voiceContainer;
UseLayoutingInfo = useLayoutingInfo;
}
示例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)
);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例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
//.........这里部分代码省略.........