Bläddra i källkod

fix cursor error with precount and starting at the first note in Beethoven Geliebte

osmd.PlaybackManager.DoPreCount = true
osmd.PlaybackManager.metronome.PreCountVolume = 0.5
sschmidTU 3 år sedan
förälder
incheckning
8bafeb51d5
1 ändrade filer med 3 tillägg och 0 borttagningar
  1. 3 0
      src/OpenSheetMusicDisplay/Cursor.ts

+ 3 - 0
src/OpenSheetMusicDisplay/Cursor.ts

@@ -152,6 +152,9 @@ export class Cursor implements IPlaybackListener {
     const currentSystem: MusicSystem = values[1];
     this.updateCurrentPageFromSystem(currentSystem);
     const previousStaffEntry: GraphicalStaffEntry = values[2];
+    if (!previousStaffEntry) {
+      return; // TODO maybe fix calculateXPositionFromTimestamp() instead
+    }
 
     // for samples starting with a precount measure (e.g. Mozart - An Chloe), the measure number can be 0,
     //   so without max(n, 1), [topMeasureNumber - 1] would be [-1], causing an error