Quellcode durchsuchen

Added missing classes Slur and ChordSymbolContainer

Removed unused properties from Tie
Oliver vor 9 Jahren
Ursprung
Commit
cf9a14e2b3

+ 79 - 0
src/MusicalScore/VoiceData/ChordSymbolContainer.ts

@@ -0,0 +1,79 @@
+import {Pitch, AccidentalEnum} from "../../Common/DataObjects/pitch";
+import {KeyInstruction} from "./Instructions/KeyInstruction";
+export class ChordSymbolContainer {
+    constructor(rootPitch: Pitch, chordKind: ChordSymbolEnum, bassPitch: Pitch, chordDegree: Degree, keyInstruction: KeyInstruction) {
+        this.rootPitch = rootPitch;
+        this.chordKind = chordKind;
+        this.keyInstruction = keyInstruction;
+        this.bassPitch = bassPitch;
+        this.degree = chordDegree;
+    }
+    private rootPitch: Pitch;
+    private chordKind: ChordSymbolEnum;
+    private bassPitch: Pitch;
+    private degree: Degree;
+    private keyInstruction: KeyInstruction;
+    public get RootPitch(): Pitch {
+        return this.rootPitch;
+    }
+    public get ChordKind(): ChordSymbolEnum {
+        return this.chordKind;
+    }
+    public get BassPitch(): Pitch {
+        return this.bassPitch;
+    }
+    public get ChordDegree(): Degree {
+        return this.degree;
+    }
+    public get KeyInstruction(): KeyInstruction {
+        return this.keyInstruction;
+    }
+}
+export class Degree {
+    constructor(value: number, alteration: AccidentalEnum, text: ChordDegreeText) {
+        this.Value = value;
+        this.Alteration = alteration;
+        this.Text = text;
+    }
+    public Value: number;
+    public Alteration: AccidentalEnum;
+    public Text: ChordDegreeText;
+}
+export enum ChordDegreeText {
+    add,
+    alter,
+    subtract
+}
+export enum ChordSymbolEnum {
+    major,
+    minor,
+    augmented,
+    diminished,
+    dominant,
+    majorseventh,
+    minorseventh,
+    diminishedseventh,
+    augmentedseventh,
+    halfdiminished,
+    majorminor,
+    majorsixth,
+    minorsixth,
+    dominantninth,
+    majorninth,
+    minorninth,
+    dominant11th,
+    major11th,
+    minor11th,
+    dominant13th,
+    major13th,
+    minor13th,
+    suspendedsecond,
+    suspendedfourth,
+    Neapolitan,
+    Italian,
+    French,
+    German,
+    pedal,
+    power,
+    Tristan
+}

+ 62 - 0
src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/Slur.ts

@@ -0,0 +1,62 @@
+import {Note} from "../../Note";
+import {Fraction} from "../../../../Common/DataObjects/fraction";
+export class Slur {
+    constructor() {
+
+    }
+    private startNote: Note;
+    private endNote: Note;
+    public get StartNote(): Note {
+        return this.startNote;
+    }
+    public set StartNote(value: Note) {
+        this.startNote = value;
+    }
+    public get EndNote(): Note {
+        return this.endNote;
+    }
+    public set EndNote(value: Note) {
+        this.endNote = value;
+    }
+    public startNoteHasMoreStartingSlurs(): boolean {
+        if (this.startNote == null)
+            return false;
+        for (var idx: number = 0, len = this.startNote.NoteSlurs.length; idx < len; ++idx) {
+            var slur: Slur = this.startNote.NoteSlurs[idx];
+            if (slur != this && slur.StartNote == this.startNote)
+                return true;
+        }
+        return false;
+    }
+    public endNoteHasMoreEndingSlurs(): boolean {
+        if (this.endNote == null)
+            return false;
+        for (var idx: number = 0, len = this.endNote.NoteSlurs.length; idx < len; ++idx) {
+            var slur: Slur = this.endNote.NoteSlurs[idx];
+            if (slur != this && slur.EndNote == this.endNote)
+                return true;
+        }
+        return false;
+    }
+    public isCrossed(): boolean {
+        if (this.startNote.ParentStaffEntry.ParentStaff != this.endNote.ParentStaffEntry.ParentStaff)
+            return true;
+        return false;
+    }
+    public isSlurLonger(): boolean {
+        if (this.endNote == null || this.startNote == null)
+            return false;
+        var length: Fraction = this.endNote.getAbsoluteTimestamp() - this.startNote.getAbsoluteTimestamp();
+        for (var idx: number = 0, len = this.startNote.NoteSlurs.length; idx < len; ++idx) {
+            var slur: Slur = this.startNote.NoteSlurs[idx];
+            if (slur != this && slur.EndNote != null && slur.StartNote != null && (slur.EndNote.getAbsoluteTimestamp() - slur.StartNote.getAbsoluteTimestamp() < length))
+                return true;
+        }
+        for (var idx: number = 0, len = this.endNote.NoteSlurs.length; idx < len; ++idx) {
+            var slur: Slur = this.endNote.NoteSlurs[idx];
+            if (slur != this && slur.EndNote != null && slur.StartNote != null && (slur.EndNote.getAbsoluteTimestamp() - slur.StartNote.getAbsoluteTimestamp() < length))
+                return true;
+        }
+        return false;
+    }
+}

+ 1 - 4
src/MusicalScore/VoiceData/Note.ts

@@ -6,9 +6,7 @@ import {Beam} from "./Beam";
 import {Tuplet} from "./Tuplet";
 import {Tie} from "./Tie";
 import {Staff} from "./Staff";
-
-type NoteState = any;
-type Slur = any;
+import {Slur} from "./Expressions/ContinuousExpressions/Slur";
 
 export class Note {
     constructor(voiceEntry: VoiceEntry, parentStaffEntry: SourceStaffEntry, length: Fraction, pitch: Pitch) {
@@ -23,7 +21,6 @@ export class Note {
         }
     }
     public HalfTone: number;
-    public State: NoteState;
 
     private voiceEntry: VoiceEntry;
     private parentStaffEntry: SourceStaffEntry;

+ 1 - 4
src/MusicalScore/VoiceData/SourceStaffEntry.ts

@@ -5,10 +5,7 @@ import {AbstractNotationInstruction} from "./Instructions/AbstractNotationInstru
 import {VoiceEntry} from "./VoiceEntry";
 import {Note} from "./Note";
 import {StaffEntryLink} from "./StaffEntryLink";
-
-// FIXME
-type ChordSymbolContainer = any;
-
+import {ChordSymbolContainer} from "./ChordSymbolContainer";
 
 export class SourceStaffEntry {
   constructor(verticalContainerParent: VerticalSourceStaffEntryContainer, parentStaff: Staff) {

+ 0 - 17
src/MusicalScore/VoiceData/Tie.ts

@@ -3,9 +3,6 @@ import {Beam} from "./Beam";
 import {Fraction} from "../../Common/DataObjects/fraction";
 import {Tuplet} from "./Tuplet";
 
-// FIXME: Missing Slur class
-type Slur = any;
-
 export class Tie {
     constructor(note: Note) {
         this.start = note;
@@ -14,8 +11,6 @@ export class Tie {
     private tieBeam: Beam;
     private beamStartTimestamp: Fraction;
     private tieTuplet: Tuplet;
-    private tieEndingSlur: Slur;
-    private tieStartingSlur: Slur;
     private fractions: Fraction[] = [];
     private noteHasBeenCreated: boolean[] = [];
     private baseNoteYPosition: number;
@@ -43,18 +38,6 @@ export class Tie {
     public set TieTuplet(value: Tuplet) {
         this.tieTuplet = value;
     }
-    public get TieEndingSlur(): Slur {
-        return this.tieEndingSlur;
-    }
-    public set TieEndingSlur(value: Slur) {
-        this.tieEndingSlur = value;
-    }
-    public get TieStartingSlur(): Slur {
-        return this.tieStartingSlur;
-    }
-    public set TieStartingSlur(value: Slur) {
-        this.tieStartingSlur = value;
-    }
     public get Fractions(): Fraction[] {
         return this.fractions;
     }