private void ParseRhythm(IXmlNode node)
{
var rhythm = new GpxRhythm();
var rhythmId = node.GetAttribute("id");
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "NoteValue":
switch (GetValue(c))
{
case "Long":
rhythm.Value = Duration.QuadrupleWhole;
break;
case "DoubleWhole":
rhythm.Value = Duration.DoubleWhole;
break;
case "Whole":
rhythm.Value = Duration.Whole;
break;
case "Half":
rhythm.Value = Duration.Half;
break;
case "Quarter":
rhythm.Value = Duration.Quarter;
break;
case "Eighth":
rhythm.Value = Duration.Eighth;
break;
case "16th":
rhythm.Value = Duration.Sixteenth;
break;
case "32nd":
rhythm.Value = Duration.ThirtySecond;
break;
case "64th":
rhythm.Value = Duration.SixtyFourth;
break;
case "128th":
rhythm.Value = Duration.OneHundredTwentyEighth;
break;
case "256th":
rhythm.Value = Duration.TwoHundredFiftySixth;
break;
}
break;
case "PrimaryTuplet":
rhythm.TupletNumerator = Std.ParseInt(c.GetAttribute("num"));
rhythm.TupletDenominator = Std.ParseInt(c.GetAttribute("den"));
break;
case "AugmentationDot":
rhythm.Dots = Std.ParseInt(c.GetAttribute("count"));
break;
}
}
});
_rhythmById[rhythmId] = rhythm;
}