This structure represents a duration within a gpx model.
Beispiel #1
0
        private void ParseRhythm(IXmlNode node)
        {
            var rhythm = new GpxRhythm();
            var rhythmId = node.Attributes.Get("id").Value;
            node.IterateChildren(c =>
            {
                if (c.NodeType == XmlNodeType.Element)
                {
                    switch (c.LocalName)
                    {
                        case "NoteValue":
                            switch (GetValue(c))
                            {
                                // case "Long":
                                // case "DoubleWhole":
                                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;
                                    // case "128th":
                                    // case "256th":
                                    break;
                            }
                            break;
                        case "PrimaryTuplet":
                            rhythm.TupletNumerator = Std.ParseInt(c.Attributes.Get("num").Value);
                            rhythm.TupletDenominator = Std.ParseInt(c.Attributes.Get("den").Value);
                            break;
                        case "AugmentationDot":
                            rhythm.Dots = Std.ParseInt(c.Attributes.Get("count").Value);
                            break;
                    }
                }
            });

            _rhythmById[rhythmId] = rhythm;
        }