浏览代码

fix(cue notes): parse cue element

alternative to <type size="cue>

fix(invisible notes): prevent articulations being added to ghost notes, can cause errors

add Tremolo class to vexflow definitions
sschmidTU 6 年之前
父节点
当前提交
9443163bf8

+ 4 - 0
external/vexflow/vexflow.d.ts

@@ -314,6 +314,10 @@ declare namespace Vex {
             setUpperAccidental(acc: string): void;
             setLowerAccidental(acc: string): void;
         }
+
+        export class Tremolo extends Modifier {
+            constructor(numberOfSlashes: number);
+        }
         
         export class Beam {
             constructor(notes: StaveNote[], auto_stem: boolean);

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

@@ -325,8 +325,8 @@ export class VexFlowConverter {
     }
 
     public static generateArticulations(vfnote: Vex.Flow.StemmableNote, articulations: ArticulationEnum[]): void {
-        if (vfnote === undefined) {
-            return; // needed because grace notes after main note currently not implemented. maybe safer in any case
+        if (vfnote === undefined || vfnote.getAttribute("type") === "GhostNote") {
+            return;
         }
         // Articulations:
         let vfArtPosition: number = Vex.Flow.Modifier.Position.ABOVE;

+ 5 - 0
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -214,6 +214,11 @@ export class InstrumentReader {
 
           // check for cue note
           let isCueNote: boolean = false;
+          const cueNode: IXmlElement = xmlNode.element("cue");
+          if (cueNode !== undefined) {
+            isCueNote = true;
+          }
+          // alternative: check for <type size="cue">
           const typeNode: IXmlElement = xmlNode.element("type");
           if (typeNode !== undefined) {
             const sizeAttr: Attr = typeNode.attribute("size");