UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

34 lines (33 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Tuplet = void 0; const enums_1 = require("./enums"); /** * A <tuplet> element is present when a tuplet is to be displayed graphically, in addition to the sound data provided by * the <time-modification> elements. * * See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/tuplet/. */ class Tuplet { element; constructor(element) { this.element = element; } /** Returns the type of tuplet. */ getType() { return this.element.attr('type').enum(enums_1.START_STOP); } /** Returns the placement of the tuplet. Defaults to 'below'. */ getPlacement() { return this.element.attr('placement').enum(enums_1.ABOVE_BELOW) ?? 'below'; } /** Returns the number of the tuplet. Defaults to 1. */ getNumber() { return this.element.attr('number').withDefault(1).int(); } /** Returns how the tuplet number should be displayed. */ getShowNumber() { return this.element.attr('show-number').withDefault('actual').enum(enums_1.SHOW_TUPLET); } } exports.Tuplet = Tuplet;