@stringsync/vexml
Version:
MusicXML to Vexflow
26 lines (25 loc) • 834 B
JavaScript
import { STAVE_TYPES } from './enums';
/**
* Indicates different stave types. A stave is the set of five horizontal lines where notes and other musical
* symbols are placed.
*
* https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/staff-details/
*/
export class StaveDetails {
element;
constructor(element) {
this.element = element;
}
/** Returns the stave type. */
getStaveType() {
return this.element.first('staff-type')?.content().enum(STAVE_TYPES) ?? 'regular';
}
/** Returns the number of the stave. */
getStaveNumber() {
return this.element.attr('number').withDefault(1).int();
}
/** Returns the number of lines of the stave. */
getStaveLines() {
return this.element.first('staff-lines')?.content().withDefault(5).int() ?? 5;
}
}