|
@@ -11,6 +11,7 @@ import {OrnamentEnum} from "./OrnamentContainer";
|
|
|
import {AccidentalEnum} from "../../Common/DataObjects/Pitch";
|
|
|
import { Dictionary } from "typescript-collections";
|
|
|
import {Arpeggio} from "./Arpeggio";
|
|
|
+import { SourceMeasure } from "./SourceMeasure";
|
|
|
|
|
|
/**
|
|
|
* A [[VoiceEntry]] contains the notes in a voice at a timestamp.
|
|
@@ -247,7 +248,7 @@ export class VoiceEntry {
|
|
|
if ((i % 2) === 0) {
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
} else {
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, higherPitch, alteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, higherPitch, alteration, voiceEntries);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -259,13 +260,13 @@ export class VoiceEntry {
|
|
|
const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
|
|
|
const higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
|
|
|
this.createAlteratedVoiceEntry(
|
|
|
- currentTimestamp, length, baseVoice, higherPitch, higherAlteration, voiceEntries
|
|
|
+ currentTimestamp, length, baseVoice, baseNote.SourceMeasure, higherPitch, higherAlteration, voiceEntries
|
|
|
);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createAlteratedVoiceEntry(
|
|
|
- currentTimestamp, length, baseVoice, lowerPitch, lowerAlteration, voiceEntries
|
|
|
+ currentTimestamp, length, baseVoice, baseNote.SourceMeasure, lowerPitch, lowerAlteration, voiceEntries
|
|
|
);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
@@ -278,13 +279,13 @@ export class VoiceEntry {
|
|
|
const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
|
|
|
const higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
|
|
|
this.createAlteratedVoiceEntry(
|
|
|
- currentTimestamp, length, baseVoice, lowerPitch, lowerAlteration, voiceEntries
|
|
|
+ currentTimestamp, length, baseVoice, baseNote.SourceMeasure, lowerPitch, lowerAlteration, voiceEntries
|
|
|
);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createAlteratedVoiceEntry(
|
|
|
- currentTimestamp, length, baseVoice, higherPitch, higherAlteration, voiceEntries
|
|
|
+ currentTimestamp, length, baseVoice, baseNote.SourceMeasure, higherPitch, higherAlteration, voiceEntries
|
|
|
);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
@@ -299,11 +300,11 @@ export class VoiceEntry {
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp = Fraction.plus(baseTimestamp, length);
|
|
|
length.Denominator = baselength.Denominator * 8;
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, higherPitch, higherAlteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, higherPitch, higherAlteration, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, lowerPitch, lowerAlteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, lowerPitch, lowerAlteration, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
break;
|
|
@@ -317,11 +318,11 @@ export class VoiceEntry {
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp = Fraction.plus(baseTimestamp, length);
|
|
|
length.Denominator = baselength.Denominator * 8;
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, lowerPitch, lowerAlteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, lowerPitch, lowerAlteration, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, higherPitch, higherAlteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, higherPitch, higherAlteration, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
break;
|
|
@@ -332,7 +333,7 @@ export class VoiceEntry {
|
|
|
const alteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, higherPitch, alteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, higherPitch, alteration, voiceEntries);
|
|
|
length.Denominator = baselength.Denominator * 2;
|
|
|
currentTimestamp = Fraction.plus(baseTimestamp, length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
@@ -344,7 +345,7 @@ export class VoiceEntry {
|
|
|
const alteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
|
currentTimestamp.Add(length);
|
|
|
- this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, lowerPitch, alteration, voiceEntries);
|
|
|
+ this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, baseNote.SourceMeasure, lowerPitch, alteration, voiceEntries);
|
|
|
length.Denominator = baselength.Denominator * 2;
|
|
|
currentTimestamp = Fraction.plus(baseTimestamp, length);
|
|
|
this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
|
|
@@ -360,17 +361,17 @@ export class VoiceEntry {
|
|
|
): void {
|
|
|
const voiceEntry: VoiceEntry = new VoiceEntry(currentTimestamp, baseVoice, baseNote.ParentStaffEntry);
|
|
|
const pitch: Pitch = new Pitch(baseNote.Pitch.FundamentalNote, baseNote.Pitch.Octave, baseNote.Pitch.Accidental);
|
|
|
- const note: Note = new Note(voiceEntry, undefined, length, pitch);
|
|
|
+ const note: Note = new Note(voiceEntry, undefined, length, pitch, baseNote.SourceMeasure);
|
|
|
voiceEntry.Notes.push(note);
|
|
|
voiceEntries.push(voiceEntry);
|
|
|
}
|
|
|
private createAlteratedVoiceEntry(
|
|
|
- currentTimestamp: Fraction, length: Fraction, baseVoice: Voice, higherPitch: Pitch,
|
|
|
+ currentTimestamp: Fraction, length: Fraction, baseVoice: Voice, sourceMeasure: SourceMeasure, higherPitch: Pitch,
|
|
|
alteration: AccidentalEnum, voiceEntries: VoiceEntry[]
|
|
|
): void {
|
|
|
const voiceEntry: VoiceEntry = new VoiceEntry(currentTimestamp, baseVoice, undefined);
|
|
|
const pitch: Pitch = new Pitch(higherPitch.FundamentalNote, higherPitch.Octave, alteration);
|
|
|
- const note: Note = new Note(voiceEntry, undefined, length, pitch);
|
|
|
+ const note: Note = new Note(voiceEntry, undefined, length, pitch, sourceMeasure);
|
|
|
voiceEntry.Notes.push(note);
|
|
|
voiceEntries.push(voiceEntry);
|
|
|
}
|