本文整理汇总了C#中AlphaTab.Model.Beat.RefreshNotes方法的典型用法代码示例。如果您正苦于以下问题:C# Beat.RefreshNotes方法的具体用法?C# Beat.RefreshNotes怎么用?C# Beat.RefreshNotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlphaTab.Model.Beat
的用法示例。
在下文中一共展示了Beat.RefreshNotes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetNotes
//.........这里部分代码省略.........
int i = 0;
int qn_per_bar = 4;
int durs = 0;
int avg_octave = mel.CalculateAverageOctave();
int dist4 = 4 - avg_octave;
foreach (var n in mel.Notes)
{
Beat be = new Beat();
be.Index = i++;
GeneticMIDI.Representation.Durations dur;
int remainder;
n.GetClosestLowerDurationAndRemainder(out dur, out remainder);
int dots = n.GetNumberOfDots();
durs += n.Duration;
/* if(durs >= qn_per_bar * (int)GeneticMIDI.Representation.Durations.qn)
{
durs = 0;
b = new Bar();
t.AddBar(b);
v.Bar = b;
b.Finish();
}*/
switch (((GeneticMIDI.Representation.Durations)n.Duration))
{
case GeneticMIDI.Representation.Durations.bn:
be.Duration = AlphaTab.Model.Duration.Whole;
dots = 2;
break;
case GeneticMIDI.Representation.Durations.en:
be.Duration = AlphaTab.Model.Duration.Eighth;
break;
case GeneticMIDI.Representation.Durations.hn:
be.Duration = AlphaTab.Model.Duration.Half;
break;
case GeneticMIDI.Representation.Durations.qn:
be.Duration = AlphaTab.Model.Duration.Quarter;
break;
case GeneticMIDI.Representation.Durations.sn:
be.Duration = AlphaTab.Model.Duration.Sixteenth;
break;
case GeneticMIDI.Representation.Durations.tn:
be.Duration = AlphaTab.Model.Duration.ThirtySecond;
break;
case GeneticMIDI.Representation.Durations.wn:
be.Duration = AlphaTab.Model.Duration.Whole;
break;
default:
break;
}
be.Dots = dots;
Note note = new Note();
if (!n.IsRest())
{
note.Tone = n.NotePitch;
note.Octave = n.Octave + dist4;
be.AddNote(note);
be.IsEmpty = false;
}
if (n.IsRest() && n.Duration < 2)
{
}
else
v.AddBeat(be);
be.RefreshNotes();
}
v.Bar = b;
v.Finish();
b.Finish();
t.Finish();
score.Finish();
//TablatureControl
_renderer.Render(t);
return;
/*TablatureControl.Track = t;
TablatureControl.InvalidateVisual();
TablatureControl.InvalidateTrack(); */
}
示例2: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
var comp = GeneticMIDI.Representation.Composition.LoadFromMIDI(@"C:\Users\1gn1t0r\Documents\git\GeneticMIDI\GeneticMIDI\bin\Debug\test\harry.mid");
var mel = comp.Tracks[0].GetMainSequence() as GeneticMIDI.Representation.MelodySequence;
Score score = new Score();
Track t = new Track();
var pc = t.IsPercussion;
MasterBar mb = new MasterBar();
score.AddMasterBar(mb);
mb.KeySignature = 2;
Bar b = new Bar();
t.AddBar(b);
score.AddTrack(t);
Voice v = new Voice();
b.AddVoice(v);
int i = 0;
int qn_per_bar = 4;
int durs = 0;
int avg_octave = mel.CalculateAverageOctave();
int dist4 = 4 - avg_octave;
foreach(var n in mel.Notes)
{
Beat be = new Beat();
be.Index = i++;
GeneticMIDI.Representation.Durations dur;
int remainder;
n.GetClosestLowerDurationAndRemainder(out dur, out remainder);
int dots = n.GetNumberOfDots();
durs += n.Duration;
/* if(durs >= qn_per_bar * (int)GeneticMIDI.Representation.Durations.qn)
{
durs = 0;
b = new Bar();
t.AddBar(b);
v.Bar = b;
b.Finish();
}*/
switch (((GeneticMIDI.Representation.Durations)n.Duration))
{
case GeneticMIDI.Representation.Durations.bn:
be.Duration = Model.Duration.Whole;
dots = 2;
break;
case GeneticMIDI.Representation.Durations.en:
be.Duration = Model.Duration.Eighth;
break;
case GeneticMIDI.Representation.Durations.hn:
be.Duration = Model.Duration.Half;
break;
case GeneticMIDI.Representation.Durations.qn:
be.Duration = Model.Duration.Quarter;
break;
case GeneticMIDI.Representation.Durations.sn:
be.Duration = Model.Duration.Sixteenth;
break;
case GeneticMIDI.Representation.Durations.tn:
be.Duration = Model.Duration.ThirtySecond;
break;
case GeneticMIDI.Representation.Durations.wn:
be.Duration = Model.Duration.Whole;
break;
default:
break;
}
be.Dots = dots;
Note note = new Note();
if (!n.IsRest())
{
note.Tone = n.NotePitch;
note.Octave = n.Octave + dist4;
be.AddNote(note);
be.IsEmpty = false;
}
if(n.IsRest() && n.Duration < 2)
{
}
else
v.AddBeat(be);
be.RefreshNotes();
}
//.........这里部分代码省略.........