@stringsync/vexml
Version:
MusicXML to Vexflow
74 lines (73 loc) • 3.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Notations = void 0;
const enums_1 = require("./enums");
const tuplet_1 = require("./tuplet");
const slur_1 = require("./slur");
const ornaments_1 = require("./ornaments");
const tied_1 = require("./tied");
const fermata_1 = require("./fermata");
const articulations_1 = require("./articulations");
const accidentalmark_1 = require("./accidentalmark");
const technical_1 = require("./technical");
const slide_1 = require("./slide");
/**
* Musical notations that apply to a specific note or chord.
*
* See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/notations/
*/
class Notations {
element;
constructor(element) {
this.element = element;
}
/** Whether or not the note/chord is arpeggiated. */
isArpeggiated() {
return this.element.all('arpeggiate').length > 0;
}
/** Returns the direction of the arppegio. Defaults to null. */
getArpeggioDirection() {
return this.element.first('arpeggiate')?.attr('direction').enum(enums_1.VERTICAL_DIRECTIONS) ?? null;
}
/** Whether the notations has at least one tuplet. */
hasTuplets() {
return this.element.all('tuplet').length > 0;
}
/** Returns the tuplets of the notations. Defaults to an empty array. */
getTuplets() {
return this.element.all('tuplet').map((element) => new tuplet_1.Tuplet(element));
}
/** Returns the slurs of the notations. Defaults to an empty array. */
getSlurs() {
return this.element.all('slur').map((element) => new slur_1.Slur(element));
}
/** Returns the tieds of the notations. Defaults to an empty array. */
getTieds() {
return this.element.all('tied').map((element) => new tied_1.Tied(element));
}
/** Returns the ornaments of the notations. Defaults to an empty array. */
getOrnaments() {
return this.element.all('ornaments').map((element) => new ornaments_1.Ornaments(element));
}
/** Returns the fermatas of the notations. Defaults to an empty array. */
getFermatas() {
return this.element.all('fermata').map((element) => new fermata_1.Fermata(element));
}
/** Returns the articulations of the notations. Defaults to an empty array. */
getArticulations() {
return this.element.all('articulations').map((element) => new articulations_1.Articulations(element));
}
/** Returns the accidental marks of the notations (not ornaments). */
getAccidentalMarks() {
return this.element.children('accidental-mark').map((element) => new accidentalmark_1.AccidentalMark(element));
}
/** Returns the technicals of the notations. */
getTechnicals() {
return this.element.children('technical').map((element) => new technical_1.Technical(element));
}
/** Returns the slides of the notations. */
getSlides() {
return this.element.children('slide').map((element) => new slide_1.Slide(element));
}
}
exports.Notations = Notations;