|
@@ -150,23 +150,34 @@ export class VoiceGenerator {
|
|
|
if (this.currentVoiceEntry.Arpeggio !== undefined) { // add note to existing Arpeggio
|
|
|
currentArpeggio = this.currentVoiceEntry.Arpeggio;
|
|
|
} else { // create new Arpeggio
|
|
|
- let arpeggioType: Vex.Flow.Stroke.Type;
|
|
|
- const directionAttr: Attr = arpeggioNode.attribute("direction");
|
|
|
- if (directionAttr !== null) {
|
|
|
- switch (directionAttr.value) {
|
|
|
- case "up":
|
|
|
- arpeggioType = Vex.Flow.Stroke.Type.ROLL_UP;
|
|
|
- break;
|
|
|
- case "down":
|
|
|
- arpeggioType = Vex.Flow.Stroke.Type.ROLL_DOWN;
|
|
|
- break;
|
|
|
- default:
|
|
|
- arpeggioType = Vex.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS;
|
|
|
+ let arpeggioAlreadyExists: boolean = false;
|
|
|
+ for (const voiceEntry of this.currentStaffEntry.VoiceEntries) {
|
|
|
+ if (voiceEntry.Arpeggio !== undefined) {
|
|
|
+ arpeggioAlreadyExists = true;
|
|
|
+ currentArpeggio = voiceEntry.Arpeggio;
|
|
|
+ // we already have an arpeggio in another voice, at the current timestamp. add the notes there.
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+ if (!arpeggioAlreadyExists) {
|
|
|
+ let arpeggioType: Vex.Flow.Stroke.Type = Vex.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS;
|
|
|
+ const directionAttr: Attr = arpeggioNode.attribute("direction");
|
|
|
+ if (directionAttr !== null) {
|
|
|
+ switch (directionAttr.value) {
|
|
|
+ case "up":
|
|
|
+ arpeggioType = Vex.Flow.Stroke.Type.ROLL_UP;
|
|
|
+ break;
|
|
|
+ case "down":
|
|
|
+ arpeggioType = Vex.Flow.Stroke.Type.ROLL_DOWN;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ arpeggioType = Vex.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- currentArpeggio = new Arpeggio(this.currentVoiceEntry, arpeggioType);
|
|
|
- this.currentVoiceEntry.Arpeggio = currentArpeggio;
|
|
|
+ currentArpeggio = new Arpeggio(this.currentVoiceEntry, arpeggioType);
|
|
|
+ this.currentVoiceEntry.Arpeggio = currentArpeggio;
|
|
|
+ }
|
|
|
}
|
|
|
currentArpeggio.addNote(this.currentNote);
|
|
|
}
|