@stringsync/vexml
Version:
MusicXML to Vexflow
29 lines (28 loc) • 714 B
JavaScript
export class Beam {
config;
log;
phase;
constructor(config, log, phase) {
this.config = config;
this.log = log;
this.phase = phase;
}
static create(config, log, musicXML) {
let phase;
switch (musicXML.beam.getBeamValue()) {
case 'begin':
phase = 'start';
break;
default:
phase = 'continue';
break;
}
return new Beam(config, log, phase);
}
parse(voiceEntryCtx) {
if (this.phase === 'start') {
return voiceEntryCtx.beginBeam();
}
return voiceEntryCtx.continueBeam() ?? voiceEntryCtx.beginBeam();
}
}