@stringsync/vexml
Version:
MusicXML to Vexflow
33 lines (32 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Clef = void 0;
const enums_1 = require("./enums");
/**
* A symbol placed at the left-hand end of the stave, indicating the pitch of the notes written.
*
* See https://www.w3.org/2021/06/musicxml40/musicxml-reference/data-types/clef-sign/
*/
class Clef {
element;
constructor(element) {
this.element = element;
}
/** Returns the stave number this clef belongs to. */
getStaveNumber() {
return this.element.attr('number').withDefault(1).int();
}
/** Returns the clef sign. Defaults to null. */
getSign() {
return this.element.first('sign')?.content().enum(enums_1.CLEF_SIGNS) ?? null;
}
/** Returns the line of the clef. Defaults to null. */
getLine() {
return this.element.first('line')?.content().int() ?? null;
}
/** Returns the octave change of the clef. Defaults to null. */
getOctaveChange() {
return this.element.first('clef-octave-change')?.content().int() ?? null;
}
}
exports.Clef = Clef;