|
@@ -7,7 +7,7 @@ import {SystemLinesEnum} from "../SystemLinesEnum";
|
|
import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
|
|
import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
|
|
import {KeyInstruction} from "../../VoiceData/Instructions/KeyInstruction";
|
|
import {KeyInstruction} from "../../VoiceData/Instructions/KeyInstruction";
|
|
import {RhythmInstruction} from "../../VoiceData/Instructions/RhythmInstruction";
|
|
import {RhythmInstruction} from "../../VoiceData/Instructions/RhythmInstruction";
|
|
-import {VexFlowConverter, VexFlowRepetitionType, VexFlowBarlineType} from "./VexFlowConverter";
|
|
|
|
|
|
+import {VexFlowConverter} from "./VexFlowConverter";
|
|
import {VexFlowStaffEntry} from "./VexFlowStaffEntry";
|
|
import {VexFlowStaffEntry} from "./VexFlowStaffEntry";
|
|
import {Beam} from "../../VoiceData/Beam";
|
|
import {Beam} from "../../VoiceData/Beam";
|
|
import {GraphicalNote} from "../GraphicalNote";
|
|
import {GraphicalNote} from "../GraphicalNote";
|
|
@@ -31,7 +31,6 @@ import {EngravingRules} from "../EngravingRules";
|
|
import {OrnamentContainer} from "../../VoiceData/OrnamentContainer";
|
|
import {OrnamentContainer} from "../../VoiceData/OrnamentContainer";
|
|
import {TechnicalInstruction} from "../../VoiceData/Instructions/TechnicalInstruction";
|
|
import {TechnicalInstruction} from "../../VoiceData/Instructions/TechnicalInstruction";
|
|
import {PlacementEnum} from "../../VoiceData/Expressions/AbstractExpression";
|
|
import {PlacementEnum} from "../../VoiceData/Expressions/AbstractExpression";
|
|
-import {ArpeggioType} from "../../VoiceData/Arpeggio";
|
|
|
|
import {VexFlowGraphicalNote} from "./VexFlowGraphicalNote";
|
|
import {VexFlowGraphicalNote} from "./VexFlowGraphicalNote";
|
|
import {AutoBeamOptions} from "../../../OpenSheetMusicDisplay/OSMDOptions";
|
|
import {AutoBeamOptions} from "../../../OpenSheetMusicDisplay/OSMDOptions";
|
|
|
|
|
|
@@ -130,7 +129,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
public addClefAtBegin(clef: ClefInstruction): void {
|
|
public addClefAtBegin(clef: ClefInstruction): void {
|
|
this.octaveOffset = clef.OctaveOffset;
|
|
this.octaveOffset = clef.OctaveOffset;
|
|
const vfclef: { type: string, size: string, annotation: string } = VexFlowConverter.Clef(clef, "default");
|
|
const vfclef: { type: string, size: string, annotation: string } = VexFlowConverter.Clef(clef, "default");
|
|
- this.stave.addClef(vfclef.type, vfclef.size, vfclef.annotation, Vex.Flow.Modifier.Position.BEGIN);
|
|
|
|
|
|
+ this.stave.addClef(vfclef.type, vfclef.size, vfclef.annotation, Vex.Flow.StaveModifier.Position.BEGIN);
|
|
this.updateInstructionWidth();
|
|
this.updateInstructionWidth();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -159,7 +158,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
const timeSig: Vex.Flow.TimeSignature = VexFlowConverter.TimeSignature(rhythm);
|
|
const timeSig: Vex.Flow.TimeSignature = VexFlowConverter.TimeSignature(rhythm);
|
|
this.stave.addModifier(
|
|
this.stave.addModifier(
|
|
timeSig,
|
|
timeSig,
|
|
- Vex.Flow.Modifier.Position.BEGIN
|
|
|
|
|
|
+ Vex.Flow.StaveModifier.Position.BEGIN
|
|
);
|
|
);
|
|
this.updateInstructionWidth();
|
|
this.updateInstructionWidth();
|
|
}
|
|
}
|
|
@@ -180,7 +179,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
case SystemLinePosition.MeasureBegin:
|
|
case SystemLinePosition.MeasureBegin:
|
|
switch (lineType) {
|
|
switch (lineType) {
|
|
case SystemLinesEnum.BoldThinDots:
|
|
case SystemLinesEnum.BoldThinDots:
|
|
- this.stave.setBegBarType(VexFlowBarlineType.REPEAT_BEGIN);
|
|
|
|
|
|
+ this.stave.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -189,16 +188,16 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
case SystemLinePosition.MeasureEnd:
|
|
case SystemLinePosition.MeasureEnd:
|
|
switch (lineType) {
|
|
switch (lineType) {
|
|
case SystemLinesEnum.DotsBoldBoldDots:
|
|
case SystemLinesEnum.DotsBoldBoldDots:
|
|
- this.stave.setEndBarType(VexFlowBarlineType.REPEAT_BOTH);
|
|
|
|
|
|
+ this.stave.setEndBarType(Vex.Flow.Barline.type.REPEAT_BOTH);
|
|
break;
|
|
break;
|
|
case SystemLinesEnum.DotsThinBold:
|
|
case SystemLinesEnum.DotsThinBold:
|
|
- this.stave.setEndBarType(VexFlowBarlineType.REPEAT_END);
|
|
|
|
|
|
+ this.stave.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);
|
|
break;
|
|
break;
|
|
case SystemLinesEnum.DoubleThin:
|
|
case SystemLinesEnum.DoubleThin:
|
|
- this.stave.setEndBarType(VexFlowBarlineType.DOUBLE);
|
|
|
|
|
|
+ this.stave.setEndBarType(Vex.Flow.Barline.type.DOUBLE);
|
|
break;
|
|
break;
|
|
case SystemLinesEnum.ThinBold:
|
|
case SystemLinesEnum.ThinBold:
|
|
- this.stave.setEndBarType(VexFlowBarlineType.END);
|
|
|
|
|
|
+ this.stave.setEndBarType(Vex.Flow.Barline.type.END);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -227,42 +226,42 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
}
|
|
}
|
|
|
|
|
|
public addWordRepetition(repetitionInstruction: RepetitionInstruction): void {
|
|
public addWordRepetition(repetitionInstruction: RepetitionInstruction): void {
|
|
- let instruction: VexFlowRepetitionType = undefined;
|
|
|
|
- let position: any = Vex.Flow.Modifier.Position.END;
|
|
|
|
|
|
+ let instruction: Vex.Flow.Repetition.type = undefined;
|
|
|
|
+ let position: any = Vex.Flow.StaveModifier.Position.END;
|
|
switch (repetitionInstruction.type) {
|
|
switch (repetitionInstruction.type) {
|
|
case RepetitionInstructionEnum.Segno:
|
|
case RepetitionInstructionEnum.Segno:
|
|
// create Segno Symbol:
|
|
// create Segno Symbol:
|
|
- instruction = VexFlowRepetitionType.SEGNO_LEFT;
|
|
|
|
- position = Vex.Flow.Modifier.Position.BEGIN;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.SEGNO_LEFT;
|
|
|
|
+ position = Vex.Flow.StaveModifier.Position.BEGIN;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.Coda:
|
|
case RepetitionInstructionEnum.Coda:
|
|
// create Coda Symbol:
|
|
// create Coda Symbol:
|
|
- instruction = VexFlowRepetitionType.CODA_LEFT;
|
|
|
|
- position = Vex.Flow.Modifier.Position.BEGIN;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.CODA_LEFT;
|
|
|
|
+ position = Vex.Flow.StaveModifier.Position.BEGIN;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.DaCapo:
|
|
case RepetitionInstructionEnum.DaCapo:
|
|
- instruction = VexFlowRepetitionType.DC;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.DC;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.DalSegno:
|
|
case RepetitionInstructionEnum.DalSegno:
|
|
- instruction = VexFlowRepetitionType.DS;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.DS;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.Fine:
|
|
case RepetitionInstructionEnum.Fine:
|
|
- instruction = VexFlowRepetitionType.FINE;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.FINE;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.ToCoda:
|
|
case RepetitionInstructionEnum.ToCoda:
|
|
//instruction = "To Coda";
|
|
//instruction = "To Coda";
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.DaCapoAlFine:
|
|
case RepetitionInstructionEnum.DaCapoAlFine:
|
|
- instruction = VexFlowRepetitionType.DC_AL_FINE;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.DC_AL_FINE;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.DaCapoAlCoda:
|
|
case RepetitionInstructionEnum.DaCapoAlCoda:
|
|
- instruction = VexFlowRepetitionType.DC_AL_CODA;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.DC_AL_CODA;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.DalSegnoAlFine:
|
|
case RepetitionInstructionEnum.DalSegnoAlFine:
|
|
- instruction = VexFlowRepetitionType.DS_AL_FINE;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.DS_AL_FINE;
|
|
break;
|
|
break;
|
|
case RepetitionInstructionEnum.DalSegnoAlCoda:
|
|
case RepetitionInstructionEnum.DalSegnoAlCoda:
|
|
- instruction = VexFlowRepetitionType.DS_AL_CODA;
|
|
|
|
|
|
+ instruction = Vex.Flow.Repetition.type.DS_AL_CODA;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -327,7 +326,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
* Draw this measure on a VexFlow CanvasContext
|
|
* Draw this measure on a VexFlow CanvasContext
|
|
* @param ctx
|
|
* @param ctx
|
|
*/
|
|
*/
|
|
- public draw(ctx: Vex.Flow.RenderContext): void {
|
|
|
|
|
|
+ public draw(ctx: Vex.IRenderContext): void {
|
|
|
|
|
|
// Draw stave lines
|
|
// Draw stave lines
|
|
this.stave.setContext(ctx).draw();
|
|
this.stave.setContext(ctx).draw();
|
|
@@ -785,7 +784,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const graceNoteGroup: Vex.Flow.GraceNoteGroup = new Vex.Flow.GraceNoteGroup(graceNotes, graceSlur);
|
|
const graceNoteGroup: Vex.Flow.GraceNoteGroup = new Vex.Flow.GraceNoteGroup(graceNotes, graceSlur);
|
|
- (gve as VexFlowVoiceEntry).vfStaveNote.addModifier(0, graceNoteGroup);
|
|
|
|
|
|
+ ((gve as VexFlowVoiceEntry).vfStaveNote as StaveNote).addModifier(0, graceNoteGroup);
|
|
graceGVoiceEntriesBefore = [];
|
|
graceGVoiceEntriesBefore = [];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -839,7 +838,8 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
if (vfse && vfse.vfClefBefore !== undefined) {
|
|
if (vfse && vfse.vfClefBefore !== undefined) {
|
|
// add clef as NoteSubGroup so that we get modifier layouting
|
|
// add clef as NoteSubGroup so that we get modifier layouting
|
|
const clefModifier: NoteSubGroup = new NoteSubGroup( [vfse.vfClefBefore] );
|
|
const clefModifier: NoteSubGroup = new NoteSubGroup( [vfse.vfClefBefore] );
|
|
- vexFlowVoiceEntry.vfStaveNote.addModifier(0, clefModifier);
|
|
|
|
|
|
+ // The cast is necesary because...vexflow -> see types
|
|
|
|
+ (vexFlowVoiceEntry.vfStaveNote as Vex.Flow.StaveNote).addModifier(0, clefModifier);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -850,7 +850,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
|
|
|
|
// add Arpeggio
|
|
// add Arpeggio
|
|
if (voiceEntry.parentVoiceEntry && voiceEntry.parentVoiceEntry.Arpeggio !== undefined) {
|
|
if (voiceEntry.parentVoiceEntry && voiceEntry.parentVoiceEntry.Arpeggio !== undefined) {
|
|
- const type: ArpeggioType = voiceEntry.parentVoiceEntry.Arpeggio.type;
|
|
|
|
|
|
+ const type: Vex.Flow.Stroke.Type = voiceEntry.parentVoiceEntry.Arpeggio.type;
|
|
vexFlowVoiceEntry.vfStaveNote.addStroke(0, new Vex.Flow.Stroke(type));
|
|
vexFlowVoiceEntry.vfStaveNote.addStroke(0, new Vex.Flow.Stroke(type));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -936,30 +936,30 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
if (technicalInstruction.placement !== PlacementEnum.NotYetDefined) {
|
|
if (technicalInstruction.placement !== PlacementEnum.NotYetDefined) {
|
|
fingeringPosition = technicalInstruction.placement;
|
|
fingeringPosition = technicalInstruction.placement;
|
|
}
|
|
}
|
|
- let modifierPosition: any; // Vex.Flow.Modifier.Position
|
|
|
|
|
|
+ let modifierPosition: any; // Vex.Flow.Stavemodifier.Position
|
|
switch (fingeringPosition) {
|
|
switch (fingeringPosition) {
|
|
default:
|
|
default:
|
|
case PlacementEnum.Left:
|
|
case PlacementEnum.Left:
|
|
- modifierPosition = Vex.Flow.Modifier.Position.LEFT;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.LEFT;
|
|
break;
|
|
break;
|
|
case PlacementEnum.Right:
|
|
case PlacementEnum.Right:
|
|
- modifierPosition = Vex.Flow.Modifier.Position.RIGHT;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.RIGHT;
|
|
break;
|
|
break;
|
|
case PlacementEnum.Above:
|
|
case PlacementEnum.Above:
|
|
- modifierPosition = Vex.Flow.Modifier.Position.ABOVE;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.ABOVE;
|
|
break;
|
|
break;
|
|
case PlacementEnum.Below:
|
|
case PlacementEnum.Below:
|
|
- modifierPosition = Vex.Flow.Modifier.Position.BELOW;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.BELOW;
|
|
break;
|
|
break;
|
|
case PlacementEnum.NotYetDefined: // automatic fingering placement, could be more complex/customizable
|
|
case PlacementEnum.NotYetDefined: // automatic fingering placement, could be more complex/customizable
|
|
const sourceStaff: Staff = voiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff;
|
|
const sourceStaff: Staff = voiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff;
|
|
if (voiceEntry.notes.length > 1 || voiceEntry.parentStaffEntry.graphicalVoiceEntries.length > 1) {
|
|
if (voiceEntry.notes.length > 1 || voiceEntry.parentStaffEntry.graphicalVoiceEntries.length > 1) {
|
|
- modifierPosition = Vex.Flow.Modifier.Position.LEFT;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.LEFT;
|
|
} else if (sourceStaff.idInMusicSheet === 0) {
|
|
} else if (sourceStaff.idInMusicSheet === 0) {
|
|
- modifierPosition = Vex.Flow.Modifier.Position.ABOVE;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.ABOVE;
|
|
fingeringPosition = PlacementEnum.Above;
|
|
fingeringPosition = PlacementEnum.Above;
|
|
} else {
|
|
} else {
|
|
- modifierPosition = Vex.Flow.Modifier.Position.BELOW;
|
|
|
|
|
|
+ modifierPosition = Vex.Flow.StaveModifier.Position.BELOW;
|
|
fingeringPosition = PlacementEnum.Below;
|
|
fingeringPosition = PlacementEnum.Below;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -981,11 +981,13 @@ export class VexFlowMeasure extends GraphicalMeasure {
|
|
(<any>stringNumber).radius = 0; // hack to remove the circle around the number
|
|
(<any>stringNumber).radius = 0; // hack to remove the circle around the number
|
|
stringNumber.setPosition(modifierPosition);
|
|
stringNumber.setPosition(modifierPosition);
|
|
stringNumber.setOffsetY(offsetYSign * ordering * stringNumber.getWidth() * 2 / 3);
|
|
stringNumber.setOffsetY(offsetYSign * ordering * stringNumber.getWidth() * 2 / 3);
|
|
- vexFlowVoiceEntry.vfStaveNote.addModifier(i, stringNumber);
|
|
|
|
|
|
+ // Vexflow made a mess with the addModifier signature that changes through each class so we just cast to any :(
|
|
|
|
+ vexFlowVoiceEntry.vfStaveNote.addModifier((i as any), (stringNumber as any));
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- vexFlowVoiceEntry.vfStaveNote.addModifier(i, fretFinger);
|
|
|
|
|
|
+ // Vexflow made a mess with the addModifier signature that changes through each class so we just cast to any :(
|
|
|
|
+ vexFlowVoiceEntry.vfStaveNote.addModifier((i as any), (fretFinger as any));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|