UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

50 lines (49 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Attributes = void 0; const clef_1 = require("./clef"); const key_1 = require("./key"); const time_1 = require("./time"); const stavedetails_1 = require("./stavedetails"); const measurestyle_1 = require("./measurestyle"); /** * Attributes contains musical information that typically changes each measure, such as key and time signatures, clefs, * transpositions and staving. * * See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/attributes/ */ class Attributes { element; constructor(element) { this.element = element; } /** Returns the number of staves. */ getStaveCount() { return this.element.first('staves')?.content().int() ?? null; } /** Returns the stave details. */ getStaveDetails() { return this.element.all('staff-details').map((element) => new stavedetails_1.StaveDetails(element)); } /** Returns the times. */ getTimes() { return this.element.all('time').map((element) => new time_1.Time(element)); } /** Returns the keys. */ getKeys() { return this.element.all('key').map((element) => new key_1.Key(element)); } /** Returns the clefs. */ getClefs() { return this.element.all('clef').map((element) => new clef_1.Clef(element)); } /** Returns the measure styles. */ getMeasureStyles() { return this.element.all('measure-style').map((element) => new measurestyle_1.MeasureStyle(element)); } /** Returns the how many divisions per quarter note are used to indicate a note's duration. */ getQuarterNoteDivisions() { return this.element.first('divisions')?.content().int() ?? null; } } exports.Attributes = Attributes;