MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / _parseRhythm

Method _parseRhythm

packages/alphatab/src/importer/GpifParser.ts:2624–2677  ·  view source on GitHub ↗
(node: XmlNode)

Source from the content-addressed store, hash-verified

2622 }
2623
2624 private _parseRhythm(node: XmlNode): void {
2625 const rhythm: GpifRhythm = new GpifRhythm();
2626 const rhythmId: string = node.getAttribute('id');
2627 rhythm.id = rhythmId;
2628 for (const c of node.childElements()) {
2629 switch (c.localName) {
2630 case 'NoteValue':
2631 switch (c.innerText) {
2632 case 'Long':
2633 rhythm.value = Duration.QuadrupleWhole;
2634 break;
2635 case 'DoubleWhole':
2636 rhythm.value = Duration.DoubleWhole;
2637 break;
2638 case 'Whole':
2639 rhythm.value = Duration.Whole;
2640 break;
2641 case 'Half':
2642 rhythm.value = Duration.Half;
2643 break;
2644 case 'Quarter':
2645 rhythm.value = Duration.Quarter;
2646 break;
2647 case 'Eighth':
2648 rhythm.value = Duration.Eighth;
2649 break;
2650 case '16th':
2651 rhythm.value = Duration.Sixteenth;
2652 break;
2653 case '32nd':
2654 rhythm.value = Duration.ThirtySecond;
2655 break;
2656 case '64th':
2657 rhythm.value = Duration.SixtyFourth;
2658 break;
2659 case '128th':
2660 rhythm.value = Duration.OneHundredTwentyEighth;
2661 break;
2662 case '256th':
2663 rhythm.value = Duration.TwoHundredFiftySixth;
2664 break;
2665 }
2666 break;
2667 case 'PrimaryTuplet':
2668 rhythm.tupletNumerator = GpifParser._parseIntSafe(c.getAttribute('num'), -1);
2669 rhythm.tupletDenominator = GpifParser._parseIntSafe(c.getAttribute('den'), -1);
2670 break;
2671 case 'AugmentationDot':
2672 rhythm.dots = GpifParser._parseIntSafe(c.getAttribute('count'), 0);
2673 break;
2674 }
2675 }
2676 this._rhythmById.set(rhythmId, rhythm);
2677 }
2678
2679 private _buildModel(): void {
2680 // build score

Callers 1

_parseRhythmsMethod · 0.95

Calls 4

getAttributeMethod · 0.80
childElementsMethod · 0.80
_parseIntSafeMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected