本文整理汇总了C#中AlphaTab.Model.Track.AddBarToStaff方法的典型用法代码示例。如果您正苦于以下问题:C# Track.AddBarToStaff方法的具体用法?C# Track.AddBarToStaff怎么用?C# Track.AddBarToStaff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlphaTab.Model.Track
的用法示例。
在下文中一共展示了Track.AddBarToStaff方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadBar
public void ReadBar(Track track)
{
var newBar = new Bar();
if (track.IsPercussion)
{
newBar.Clef = Clef.Neutral;
}
track.AddBarToStaff(0, newBar);
var voiceCount = 1;
if (_versionNumber >= 500)
{
Data.ReadByte();
voiceCount = 2;
}
for (int v = 0; v < voiceCount; v++)
{
ReadVoice(track, newBar);
}
}
示例2: 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;
}
}
});
}
示例3: JsObjectToScore
public Score JsObjectToScore(Score score)
{
var score2 = new Score();
Score.CopyTo(score, score2);
#region MasterBars
for (var i = 0; i < score.MasterBars.Count; i++)
{
var masterBar = score.MasterBars[i];
var masterBar2 = new MasterBar();
MasterBar.CopyTo(masterBar, masterBar2);
if (masterBar.TempoAutomation != null)
{
masterBar2.TempoAutomation = new Automation();
Automation.CopyTo(masterBar.TempoAutomation, masterBar2.TempoAutomation);
}
if (masterBar.VolumeAutomation != null)
{
masterBar2.VolumeAutomation = new Automation();
Automation.CopyTo(masterBar.VolumeAutomation, masterBar2.VolumeAutomation);
}
if (masterBar.Section != null)
{
masterBar2.Section = new Section();
Section.CopyTo(masterBar.Section, masterBar2.Section);
}
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.Staves.Count);
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 Staves
for (var s = 0; s < track.Staves.Count; s++)
{
var staff = track.Staves[s];
#region Bars
for (int b = 0; b < staff.Bars.Count; b++)
{
var bar = staff.Bars[b];
var bar2 = new Bar();
Bar.CopyTo(bar, bar2);
track2.AddBarToStaff(s, 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++)
//.........这里部分代码省略.........