UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

33 lines (32 loc) 1.17 kB
import { ABOVE_BELOW, LINE_TYPES, OVER_UNDER, START_STOP_CONTINUE, } from './enums'; /** * Most slurs are represented with two <slur> elements: one with a start type, and one with a stop type. * * See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/slur/ */ export class Slur { element; constructor(element) { this.element = element; } /** Returns the type of slur. Defaults to null. */ getType() { return this.element.attr('type').enum(START_STOP_CONTINUE); } /** Returns the placement of the slur. Defaults to null. */ getPlacement() { return this.element.attr('placement').enum(ABOVE_BELOW); } /** Returns the orientation of the slur. Defaults to null. */ getOrientation() { return this.element.attr('orientation').enum(OVER_UNDER); } /** Returns the number of the slur. Defaults to 1. */ getNumber() { return this.element.attr('number').withDefault(1).int(); } /** Returns the line type of the slur. Defaults to solid. */ getLineType() { return this.element.attr('line-type').withDefault('solid').enum(LINE_TYPES); } }