Sfoglia il codice sorgente

fix(beams): ignore beams between notes => quarter (tremolo) causing error

fixes causing Vexflow error
part of #472

next step is showing these tremolo beams instead of ignoring them
Vexflow can't create beams for notes => quarter
needs note transformations
sschmid 6 anni fa
parent
commit
2eb2a92f09
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  1. 12 0
      src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

+ 12 - 0
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -561,6 +561,18 @@ export class VexFlowMeasure extends GraphicalMeasure {
                     vfbeams = this.vfbeams[voiceID] = [];
                 }
                 for (const beam of this.beams[voiceID]) {
+                    let beamHasQuarterNoteOrLonger: boolean = false;
+                    for (const note of beam[0].Notes) {
+                        if (note.Length.RealValue >= new Fraction(1, 4).RealValue) {
+                            beamHasQuarterNoteOrLonger = true;
+                            break;
+                        }
+                    }
+                    if (beamHasQuarterNoteOrLonger) {
+                        log.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");
+                        continue;
+                    }
+
                     const notes: Vex.Flow.StaveNote[] = [];
                     const psBeam: Beam = beam[0];
                     const voiceEntries: VexFlowVoiceEntry[] = beam[1];