瀏覽代碼

cherry pick audio-player 554383a

audio player issue 48

full commit hash:
554383ad38986c861b04ea55e29e429cc5e13e9d
sschmid 4 年之前
父節點
當前提交
13ea0920f6
共有 2 個文件被更改,包括 12 次插入9 次删除
  1. 1 1
      src/MusicalScore/ScoreIO/InstrumentReader.ts
  2. 11 8
      src/MusicalScore/ScoreIO/VoiceGenerator.ts

+ 1 - 1
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -603,7 +603,7 @@ export class InstrumentReader {
       if (!this.musicSheet.HasBPMInfo) {
         this.currentMeasure.TempoInBPM = 120;
         this.musicSheet.DefaultStartTempoInBpm = 120;
-      } else if (currentMeasure.TempoInBPM === 0) {
+      } else if (currentMeasure.TempoInBPM === 0 && this.previousMeasure) {
         this.currentMeasure.TempoInBPM = this.previousMeasure.TempoInBPM;
       }
     } catch (e) {

+ 11 - 8
src/MusicalScore/ScoreIO/VoiceGenerator.ts

@@ -198,16 +198,19 @@ export class VoiceGenerator {
         if (slideNodeList.length > 0) {
           this.addTie(slideNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.SLIDE);
         }
-        //check for slides, they are the same as Ties but with a different connection
+        //check for guitar specific symbols:
         const technicalNode: IXmlElement = notationNode.element("technical");
-        const hammerNodeList: IXmlElement[] = technicalNode.elements("hammer-on");
-        if (hammerNodeList.length > 0) {
-          this.addTie(hammerNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.HAMMERON);
-        }
-        const pulloffNodeList: IXmlElement[] = technicalNode.elements("pull-off");
-        if (pulloffNodeList.length > 0) {
-          this.addTie(pulloffNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.PULLOFF);
+        if (technicalNode) {
+          const hammerNodeList: IXmlElement[] = technicalNode.elements("hammer-on");
+          if (hammerNodeList.length > 0) {
+            this.addTie(hammerNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.HAMMERON);
+          }
+          const pulloffNodeList: IXmlElement[] = technicalNode.elements("pull-off");
+          if (pulloffNodeList.length > 0) {
+            this.addTie(pulloffNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.PULLOFF);
+          }
         }
+
         // remove open ties, if there is already a gap between the last tie note and now.
         const openTieDict: { [_: number]: Tie; } = this.openTieDict;
         for (const key in openTieDict) {