@stringsync/vexml
Version:
MusicXML to Vexflow
34 lines (33 loc) • 902 B
JavaScript
export class Vibrato {
config;
log;
number;
phase;
constructor(config, log, number, phase) {
this.config = config;
this.log = log;
this.number = number;
this.phase = phase;
}
static create(config, log, musicXML) {
let phase;
switch (musicXML.wavyLine.getType()) {
case 'start':
phase = 'start';
break;
default:
phase = 'continue';
break;
}
const number = musicXML.wavyLine.getNumber();
return new Vibrato(config, log, number, phase);
}
parse(voiceEntryCtx) {
if (this.phase === 'start') {
return voiceEntryCtx.beginVibrato(this.number);
}
else {
return voiceEntryCtx.continueVibrato(this.number) ?? voiceEntryCtx.beginVibrato(this.number);
}
}
}