|
@@ -1,3 +1,22 @@
|
|
|
+import {MusicPartManager} from "./MusicPartManager";
|
|
|
+import {Fraction} from "../../Common/DataObjects/fraction";
|
|
|
+import {Repetition} from "../MusicSource/Repetition";
|
|
|
+import {DynamicsContainer} from "../VoiceData/HelperObjects/DynamicsContainer";
|
|
|
+import {MappingSourceMusicPart} from "../MusicSource/MappingSourceMusicPart";
|
|
|
+import {SourceMeasure} from "../VoiceData/SourceMeasure";
|
|
|
+import {VoiceEntry} from "../VoiceData/VoiceEntry";
|
|
|
+import {Instrument} from "../Instrument";
|
|
|
+import {SourceStaffEntry} from "../VoiceData/SourceStaffEntry";
|
|
|
+import {VerticalSourceStaffEntryContainer} from "../VoiceData/VerticalSourceStaffEntryContainer";
|
|
|
+import {RhythmInstruction} from "../VoiceData/Instructions/RhythmInstruction";
|
|
|
+import {AbstractNotationInstruction} from "../VoiceData/Instructions/AbstractNotationInstruction";
|
|
|
+
|
|
|
+// FIXME:
|
|
|
+type ContinuousDynamicExpression = AbstractExpression;
|
|
|
+type InstantaniousDynamicExpression = AbstractExpression;
|
|
|
+type MultiTempoExpression = any;
|
|
|
+type AbstractExpression = any;
|
|
|
+
|
|
|
export class MusicPartManagerIterator {
|
|
|
constructor(manager: MusicPartManager, startTimestamp?: Fraction, endTimestamp?: Fraction) {
|
|
|
try {
|
|
@@ -5,27 +24,28 @@ export class MusicPartManagerIterator {
|
|
|
this.manager = manager;
|
|
|
this.currentVoiceEntries = undefined;
|
|
|
this.frontReached = false;
|
|
|
- for (let idx: number = 0, len: number = manager.MusicSheet.Repetitions.Count; idx < len; ++idx) {
|
|
|
- let rep: Repetition = manager.MusicSheet.Repetitions[idx];
|
|
|
- this.repetitionIterationCountDict.Add(rep, 1);
|
|
|
- }
|
|
|
- for (let i: number = 0; i < manager.MusicSheet.getCompleteNumberOfStaves(); i++) {
|
|
|
- this.activeDynamicExpressions.Add(undefined);
|
|
|
+ for (let rep of manager.MusicSheet.Repetitions.length) {
|
|
|
+ this.repetitionIterationCountDict[rep] = 1;
|
|
|
}
|
|
|
+ this.activeDynamicExpressions = new Array(manager.MusicSheet.getCompleteNumberOfStaves());
|
|
|
this.currentMeasure = this.manager.MusicSheet.SourceMeasures[0];
|
|
|
if (startTimestamp === undefined) { return; }
|
|
|
do {
|
|
|
this.moveToNext();
|
|
|
} while ((this.currentVoiceEntries === undefined || this.currentTimeStamp < startTimestamp) && !this.endReached);
|
|
|
- for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.Count; staffIndex++) {
|
|
|
+ for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.length; staffIndex++) {
|
|
|
if (this.activeDynamicExpressions[staffIndex] !== undefined) {
|
|
|
+ /*
|
|
|
if (this.activeDynamicExpressions[staffIndex] instanceof ContinuousDynamicExpression) {
|
|
|
- let continuousDynamic: ContinuousDynamicExpression = <ContinuousDynamicExpression>this.activeDynamicExpressions[staffIndex];
|
|
|
- this.currentDynamicChangingExpressions.Add(new DynamicsContainer(continuousDynamic, staffIndex));
|
|
|
+ let continuousDynamic: ContinuousDynamicExpression =
|
|
|
+ <ContinuousDynamicExpression>this.activeDynamicExpressions[staffIndex];
|
|
|
+ this.currentDynamicChangingExpressions.push(new DynamicsContainer(continuousDynamic, staffIndex));
|
|
|
} else {
|
|
|
- let instantaniousDynamic: InstantaniousDynamicExpression = <InstantaniousDynamicExpression>this.activeDynamicExpressions[staffIndex];
|
|
|
- this.currentDynamicChangingExpressions.Add(new DynamicsContainer(instantaniousDynamic, staffIndex));
|
|
|
+ let instantaniousDynamic: InstantaniousDynamicExpression =
|
|
|
+ <InstantaniousDynamicExpression>this.activeDynamicExpressions[staffIndex];
|
|
|
+ this.currentDynamicChangingExpressions.push(new DynamicsContainer(instantaniousDynamic, staffIndex));
|
|
|
}
|
|
|
+ */ // FIXME TODO DynamicExpression problems!
|
|
|
}
|
|
|
}
|
|
|
this.currentTempoChangingExpression = this.activeTempoExpression;
|
|
@@ -44,18 +64,18 @@ export class MusicPartManagerIterator {
|
|
|
private currentVoiceEntryIndex: number = -1;
|
|
|
private currentDynamicEntryIndex: number = 0;
|
|
|
private currentTempoEntryIndex: number = 0;
|
|
|
- private currentVoiceEntries: List<VoiceEntry>;
|
|
|
- private currentDynamicChangingExpressions: List<DynamicsContainer> = new List<DynamicsContainer>();
|
|
|
+ private currentVoiceEntries: VoiceEntry[];
|
|
|
+ private currentDynamicChangingExpressions: DynamicsContainer[] = new Array();
|
|
|
private currentTempoChangingExpression: MultiTempoExpression;
|
|
|
- private repetitionIterationCountDict: Dictionary<Repetition, number> = new Dictionary<Repetition, number>();
|
|
|
+ private repetitionIterationCountDict: { [rep: Repetition] : number; } = {};
|
|
|
private currentRepetition: Repetition = undefined;
|
|
|
private endReached: boolean = false;
|
|
|
private frontReached: boolean = false;
|
|
|
- private currentTimeStamp: Fraction = new Fraction(new Fraction(0, 1));
|
|
|
- private currentEnrolledMeasureTimestamp: Fraction = new Fraction(new Fraction(0, 1));
|
|
|
- private currentVerticalContainerInMeasureTimestamp: Fraction = new Fraction(new Fraction(0, 1));
|
|
|
+ private currentTimeStamp: Fraction = new Fraction(0, 1);
|
|
|
+ private currentEnrolledMeasureTimestamp: Fraction = new Fraction(0, 1);
|
|
|
+ private currentVerticalContainerInMeasureTimestamp: Fraction = new Fraction(0, 1);
|
|
|
private jumpResponsibleRepetition: Repetition = undefined;
|
|
|
- private activeDynamicExpressions: List<AbstractExpression> = new List<AbstractExpression>();
|
|
|
+ private activeDynamicExpressions: AbstractExpression[] = new Array();
|
|
|
private activeTempoExpression: MultiTempoExpression;
|
|
|
public get EndReached(): boolean {
|
|
|
return this.endReached;
|
|
@@ -81,7 +101,7 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
- public get CurrentVoiceEntries(): List<VoiceEntry> {
|
|
|
+ public get CurrentVoiceEntries(): VoiceEntry[] {
|
|
|
return this.currentVoiceEntries;
|
|
|
}
|
|
|
public get CurrentMeasureIndex(): number {
|
|
@@ -99,7 +119,7 @@ export class MusicPartManagerIterator {
|
|
|
public get ActiveTempoExpression(): MultiTempoExpression {
|
|
|
return this.activeTempoExpression;
|
|
|
}
|
|
|
- public get ActiveDynamicExpressions(): List<AbstractExpression> {
|
|
|
+ public get ActiveDynamicExpressions(): AbstractExpression[] {
|
|
|
return this.activeDynamicExpressions;
|
|
|
}
|
|
|
public get CurrentTempoChangingExpression(): MultiTempoExpression {
|
|
@@ -118,12 +138,12 @@ export class MusicPartManagerIterator {
|
|
|
ret.frontReached = this.frontReached;
|
|
|
return ret;
|
|
|
}
|
|
|
- public CurrentVisibleVoiceEntries(instrument: Instrument): List<VoiceEntry> {
|
|
|
- let ret: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
+ public CurrentVisibleVoiceEntries(instrument: Instrument): VoiceEntry[] {
|
|
|
+ let ret: VoiceEntry[] = new Array();
|
|
|
if (this.currentVoiceEntries === undefined) {
|
|
|
return ret;
|
|
|
}
|
|
|
- for (let idx: number = 0, len: number = this.currentVoiceEntries.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentVoiceEntries.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = this.currentVoiceEntries[idx];
|
|
|
if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
|
|
|
this.getVisibleEntries(entry, ret);
|
|
@@ -132,22 +152,22 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
- public CurrentVisibleVoiceEntries(): List<VoiceEntry> {
|
|
|
- let voiceEntries: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
+ public CurrentVisibleVoiceEntries(): VoiceEntry[] {
|
|
|
+ let voiceEntries: VoiceEntry[] = new Array();
|
|
|
if (this.currentVoiceEntries !== undefined) {
|
|
|
- for (let idx: number = 0, len: number = this.currentVoiceEntries.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentVoiceEntries.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = this.currentVoiceEntries[idx];
|
|
|
this.getVisibleEntries(entry, voiceEntries);
|
|
|
}
|
|
|
}
|
|
|
return voiceEntries;
|
|
|
}
|
|
|
- public CurrentAudibleVoiceEntries(instrument: Instrument): List<VoiceEntry> {
|
|
|
- let ret: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
+ public CurrentAudibleVoiceEntries(instrument: Instrument): VoiceEntry[] {
|
|
|
+ let ret: VoiceEntry[] = new Array();
|
|
|
if (this.currentVoiceEntries === undefined) {
|
|
|
return ret;
|
|
|
}
|
|
|
- for (let idx: number = 0, len: number = this.currentVoiceEntries.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentVoiceEntries.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = this.currentVoiceEntries[idx];
|
|
|
if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
|
|
|
this.getAudibleEntries(entry, ret);
|
|
@@ -156,25 +176,25 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
- public CurrentAudibleVoiceEntries(): List<VoiceEntry> {
|
|
|
- let voiceEntries: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
+ public CurrentAudibleVoiceEntries(): VoiceEntry[] {
|
|
|
+ let voiceEntries: VoiceEntry[] = new Array();
|
|
|
if (this.currentVoiceEntries !== undefined) {
|
|
|
- for (let idx: number = 0, len: number = this.currentVoiceEntries.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentVoiceEntries.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = this.currentVoiceEntries[idx];
|
|
|
this.getAudibleEntries(entry, voiceEntries);
|
|
|
}
|
|
|
}
|
|
|
return voiceEntries;
|
|
|
}
|
|
|
- public getCurrentDynamicChangingExpressions(): List<DynamicsContainer> {
|
|
|
+ public getCurrentDynamicChangingExpressions(): DynamicsContainer[] {
|
|
|
return this.currentDynamicChangingExpressions;
|
|
|
}
|
|
|
- public CurrentScoreFollowingVoiceEntries(instrument: Instrument): List<VoiceEntry> {
|
|
|
- let ret: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
+ public CurrentScoreFollowingVoiceEntries(instrument: Instrument): VoiceEntry[] {
|
|
|
+ let ret: VoiceEntry[] = new Array();
|
|
|
if (this.currentVoiceEntries === undefined) {
|
|
|
return ret;
|
|
|
}
|
|
|
- for (let idx: number = 0, len: number = this.currentVoiceEntries.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentVoiceEntries.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = this.currentVoiceEntries[idx];
|
|
|
if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
|
|
|
this.getScoreFollowingEntries(entry, ret);
|
|
@@ -183,24 +203,24 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
- public CurrentScoreFollowingVoiceEntries(): List<VoiceEntry> {
|
|
|
- let voiceEntries: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
+ public CurrentScoreFollowingVoiceEntries(): VoiceEntry[] {
|
|
|
+ let voiceEntries: VoiceEntry[] = new Array();
|
|
|
if (this.currentVoiceEntries !== undefined) {
|
|
|
- for (let idx: number = 0, len: number = this.currentVoiceEntries.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentVoiceEntries.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = this.currentVoiceEntries[idx];
|
|
|
this.getScoreFollowingEntries(entry, voiceEntries);
|
|
|
}
|
|
|
}
|
|
|
return voiceEntries;
|
|
|
}
|
|
|
- public currentPlaybackSettings(): PlaybackSettings {
|
|
|
- return this.manager.MusicSheet.SheetPlaybackSetting;
|
|
|
- }
|
|
|
+ //public currentPlaybackSettings(): PlaybackSettings {
|
|
|
+ // return this.manager.MusicSheet.SheetPlaybackSetting;
|
|
|
+ //}
|
|
|
public moveToNext(): void {
|
|
|
this.ForwardJumpOccurred = this.BackJumpOccurred = false;
|
|
|
if (this.endReached) { return; }
|
|
|
if (this.currentVoiceEntries !== undefined) {
|
|
|
- this.currentVoiceEntries.Clear();
|
|
|
+ this.currentVoiceEntries = [];
|
|
|
}
|
|
|
this.recursiveMove();
|
|
|
if (this.currentMeasure === undefined) {
|
|
@@ -218,24 +238,20 @@ export class MusicPartManagerIterator {
|
|
|
return 1;
|
|
|
}
|
|
|
private incrementRepetitionIterationCount(repetition: Repetition): number {
|
|
|
- if (this.repetitionIterationCountDict.ContainsKey(repetition)) {
|
|
|
+ if (this.repetitionIterationCountDict[repetition] !== undefined) {
|
|
|
let newIteration: number = this.repetitionIterationCountDict[repetition] + 1;
|
|
|
this.repetitionIterationCountDict[repetition] = newIteration;
|
|
|
return newIteration;
|
|
|
} else {
|
|
|
- this.repetitionIterationCountDict.Add(repetition, 1);
|
|
|
+ this.repetitionIterationCountDict[repetition] = 1;
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
private setRepetitionIterationCount(repetition: Repetition, iterationCount: number): void {
|
|
|
- if (this.repetitionIterationCountDict.ContainsKey(repetition)) {
|
|
|
- this.repetitionIterationCountDict[repetition] = iterationCount;
|
|
|
- } else {
|
|
|
- this.repetitionIterationCountDict.Add(repetition, iterationCount);
|
|
|
- }
|
|
|
+ this.repetitionIterationCountDict[repetition] = iterationCount;
|
|
|
}
|
|
|
/* private moveTempoIndexToTimestamp(measureNumber: number): void {
|
|
|
- for (let index: number = 0; index < this.manager.MusicSheet.TimestampSortedTempoExpressionsList.Count; index++) {
|
|
|
+ for (let index: number = 0; index < this.manager.MusicSheet.TimestampSortedTempoExpressionsList.length; index++) {
|
|
|
if (this.manager.MusicSheet.TimestampSortedTempoExpressionsList[index].SourceMeasureParent.MeasureNumber >= measureNumber) {
|
|
|
this.currentTempoEntryIndex = Math.Max(-1, index - 1);
|
|
|
return
|
|
@@ -243,7 +259,7 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
}
|
|
|
private getNextTempoEntryTimestamp(): Fraction {
|
|
|
- if (this.currentTempoEntryIndex >= this.manager.MusicSheet.TimestampSortedTempoExpressionsList.Count - 1) {
|
|
|
+ if (this.currentTempoEntryIndex >= this.manager.MusicSheet.TimestampSortedTempoExpressionsList.length - 1) {
|
|
|
return new Fraction(99999, 1);
|
|
|
}
|
|
|
return this.manager.MusicSheet.TimestampSortedTempoExpressionsList[this.currentTempoEntryIndex + 1].SourceMeasureParent.AbsoluteTimestamp +
|
|
@@ -253,18 +269,18 @@ export class MusicPartManagerIterator {
|
|
|
this.currentDynamicEntryIndex++;
|
|
|
this.currentDynamicChangingExpressions.Clear();
|
|
|
let curDynamicEntry: DynamicsContainer = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList[this.currentDynamicEntryIndex];
|
|
|
- this.currentDynamicChangingExpressions.Add(curDynamicEntry);
|
|
|
+ this.currentDynamicChangingExpressions.push(curDynamicEntry);
|
|
|
let tsNow: Fraction = curDynamicEntry.parMultiExpression().AbsoluteTimestamp;
|
|
|
- for (let i: number = this.currentDynamicEntryIndex + 1; i < this.manager.MusicSheet.TimestampSortedDynamicExpressionsList.Count; i++) {
|
|
|
+ for (let i: number = this.currentDynamicEntryIndex + 1; i < this.manager.MusicSheet.TimestampSortedDynamicExpressionsList.length; i++) {
|
|
|
curDynamicEntry = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList[i];
|
|
|
if ((curDynamicEntry.parMultiExpression().AbsoluteTimestamp !== tsNow)) { break; }
|
|
|
this.currentDynamicEntryIndex = i;
|
|
|
- this.currentDynamicChangingExpressions.Add(curDynamicEntry);
|
|
|
+ this.currentDynamicChangingExpressions.push(curDynamicEntry);
|
|
|
}
|
|
|
}
|
|
|
private moveDynamicIndexToTimestamp(absoluteTimestamp: Fraction): void {
|
|
|
- let dynamics: List<DynamicsContainer> = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList;
|
|
|
- for (let index: number = 0; index < dynamics.Count; index++) {
|
|
|
+ let dynamics: DynamicsContainer[] = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList;
|
|
|
+ for (let index: number = 0; index < dynamics.length; index++) {
|
|
|
if (dynamics[index].parMultiExpression().AbsoluteTimestamp >= absoluteTimestamp) {
|
|
|
this.currentDynamicEntryIndex = Math.Max(0, index - 1);
|
|
|
return
|
|
@@ -272,13 +288,13 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
}
|
|
|
private getNextDynamicsEntryTimestamp(): Fraction {
|
|
|
- if (this.currentDynamicEntryIndex >= this.manager.MusicSheet.TimestampSortedDynamicExpressionsList.Count - 1) {
|
|
|
+ if (this.currentDynamicEntryIndex >= this.manager.MusicSheet.TimestampSortedDynamicExpressionsList.length - 1) {
|
|
|
return new Fraction(99999, 1);
|
|
|
}
|
|
|
return this.manager.MusicSheet.TimestampSortedDynamicExpressionsList[this.currentDynamicEntryIndex + 1].parMultiExpression().AbsoluteTimestamp;
|
|
|
}
|
|
|
private handleRepetitionsAtMeasureBegin(): void {
|
|
|
- for (let idx: number = 0, len: number = this.currentMeasure.FirstRepetitionInstructions.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentMeasure.FirstRepetitionInstructions.length; idx < len; ++idx) {
|
|
|
let repetitionInstruction: RepetitionInstruction = this.currentMeasure.FirstRepetitionInstructions[idx];
|
|
|
if (repetitionInstruction.ParentRepetition === undefined)
|
|
|
continue;
|
|
@@ -298,11 +314,11 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
*/
|
|
|
private handleRepetitionsAtMeasureEnd(): void {
|
|
|
- for (let idx: number = 0, len: number = this.currentMeasure.LastRepetitionInstructions.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = this.currentMeasure.LastRepetitionInstructions.length; idx < len; ++idx) {
|
|
|
let repetitionInstruction: RepetitionInstruction = this.currentMeasure.LastRepetitionInstructions[idx];
|
|
|
let currentRepetition: Repetition = repetitionInstruction.ParentRepetition;
|
|
|
if (currentRepetition === undefined) { continue; }
|
|
|
- if (currentRepetition.BackwardJumpInstructions.Contains(repetitionInstruction)) {
|
|
|
+ if (currentRepetition.BackwardJumpInstructions[repetitionInstruction] !== undefined) {
|
|
|
if (this.repetitionIterationCountDict[currentRepetition] < currentRepetition.UserNumberOfRepetitions) {
|
|
|
this.doBackJump(currentRepetition);
|
|
|
this.BackJumpOccurred = true;
|
|
@@ -350,11 +366,11 @@ export class MusicPartManagerIterator {
|
|
|
private activateCurrentRhythmInstructions(): void {
|
|
|
if (
|
|
|
this.currentMeasure !== undefined &&
|
|
|
- this.currentMeasure.FirstInstructionsStaffEntries.Count > 0 &&
|
|
|
+ this.currentMeasure.FirstInstructionsStaffEntries.length > 0 &&
|
|
|
this.currentMeasure.FirstInstructionsStaffEntries[0] !== undefined
|
|
|
) {
|
|
|
- let instructions: List<AbstractNotationInstruction> = this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;
|
|
|
- for (let idx: number = 0, len: number = instructions.Count; idx < len; ++idx) {
|
|
|
+ let instructions: AbstractNotationInstruction[] = this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;
|
|
|
+ for (let idx: number = 0, len: number = instructions.length; idx < len; ++idx) {
|
|
|
let abstractNotationInstruction: AbstractNotationInstruction = instructions[idx];
|
|
|
if (abstractNotationInstruction instanceof RhythmInstruction) {
|
|
|
this.manager.MusicSheet.SheetPlaybackSetting.Rhythm = (<RhythmInstruction>abstractNotationInstruction).Rhythm;
|
|
@@ -363,23 +379,23 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
}
|
|
|
private activateCurrentDynamicOrTempoInstructions(): void {
|
|
|
- let timeSortedDynamics: List<DynamicsContainer> = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList;
|
|
|
+ let timeSortedDynamics: DynamicsContainer[] = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList;
|
|
|
while (
|
|
|
this.currentDynamicEntryIndex > 0 && (
|
|
|
- this.currentDynamicEntryIndex >= timeSortedDynamics.Count ||
|
|
|
+ this.currentDynamicEntryIndex >= timeSortedDynamics.length ||
|
|
|
timeSortedDynamics[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp >= this.CurrentSourceTimestamp
|
|
|
)
|
|
|
) {
|
|
|
this.currentDynamicEntryIndex--;
|
|
|
}
|
|
|
while (
|
|
|
- this.currentDynamicEntryIndex < timeSortedDynamics.Count &&
|
|
|
+ this.currentDynamicEntryIndex < timeSortedDynamics.length &&
|
|
|
timeSortedDynamics[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp < this.CurrentSourceTimestamp
|
|
|
) {
|
|
|
this.currentDynamicEntryIndex++;
|
|
|
}
|
|
|
while (
|
|
|
- this.currentDynamicEntryIndex < timeSortedDynamics.Count
|
|
|
+ this.currentDynamicEntryIndex < timeSortedDynamics.length
|
|
|
&& timeSortedDynamics[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp === this.CurrentSourceTimestamp
|
|
|
) {
|
|
|
let dynamicsContainer: DynamicsContainer = timeSortedDynamics[this.currentDynamicEntryIndex];
|
|
@@ -394,7 +410,7 @@ export class MusicPartManagerIterator {
|
|
|
this.currentDynamicEntryIndex++;
|
|
|
}
|
|
|
this.currentDynamicChangingExpressions.Clear();
|
|
|
- for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.Count; staffIndex++) {
|
|
|
+ for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.length; staffIndex++) {
|
|
|
if (this.activeDynamicExpressions[staffIndex] !== undefined) {
|
|
|
let startTime: Fraction;
|
|
|
let endTime: Fraction;
|
|
@@ -403,36 +419,35 @@ export class MusicPartManagerIterator {
|
|
|
startTime = continuousDynamic.StartMultiExpression.AbsoluteTimestamp;
|
|
|
endTime = continuousDynamic.EndMultiExpression.AbsoluteTimestamp;
|
|
|
if (this.CurrentSourceTimestamp >= startTime && this.CurrentSourceTimestamp <= endTime) {
|
|
|
- this.currentDynamicChangingExpressions.Add(new DynamicsContainer(continuousDynamic, staffIndex));
|
|
|
+ this.currentDynamicChangingExpressions.push(new DynamicsContainer(continuousDynamic, staffIndex));
|
|
|
}
|
|
|
} else {
|
|
|
let instantaniousDynamic: InstantaniousDynamicExpression = <InstantaniousDynamicExpression>this.activeDynamicExpressions[staffIndex];
|
|
|
if (this.CurrentSourceTimestamp === instantaniousDynamic.ParentMultiExpression.AbsoluteTimestamp) {
|
|
|
- this.currentDynamicChangingExpressions.Add(new DynamicsContainer(instantaniousDynamic, staffIndex));
|
|
|
+ this.currentDynamicChangingExpressions.push(new DynamicsContainer(instantaniousDynamic, staffIndex));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- let timeSortedTempoExpressions: List<MultiTempoExpression> = this.manager.MusicSheet.TimestampSortedTempoExpressionsList;
|
|
|
+ let timeSortedTempoExpressions: MultiTempoExpression[] = this.manager.MusicSheet.TimestampSortedTempoExpressionsList;
|
|
|
|
|
|
while (this.currentTempoEntryIndex > 0 && (
|
|
|
- this.currentTempoEntryIndex >= timeSortedTempoExpressions.Count
|
|
|
+ this.currentTempoEntryIndex >= timeSortedTempoExpressions.length
|
|
|
|| timeSortedTempoExpressions[this.currentTempoEntryIndex].AbsoluteTimestamp >= this.CurrentSourceTimestamp
|
|
|
)) {
|
|
|
this.currentTempoEntryIndex--;
|
|
|
}
|
|
|
|
|
|
while (
|
|
|
- this.currentTempoEntryIndex < timeSortedTempoExpressions.Count &&
|
|
|
+ this.currentTempoEntryIndex < timeSortedTempoExpressions.length &&
|
|
|
timeSortedTempoExpressions[this.currentTempoEntryIndex].AbsoluteTimestamp < this.CurrentSourceTimestamp
|
|
|
) {
|
|
|
this.currentTempoEntryIndex++;
|
|
|
}
|
|
|
|
|
|
while (
|
|
|
- this.currentTempoEntryIndex < timeSortedTempoExpressions.Count
|
|
|
- && timeSortedTempoExpressions[this.currentTempoEntryIndex]
|
|
|
- .AbsoluteTimestamp === this.CurrentSourceTimestamp
|
|
|
+ this.currentTempoEntryIndex < timeSortedTempoExpressions.length
|
|
|
+ && timeSortedTempoExpressions[this.currentTempoEntryIndex].AbsoluteTimestamp === this.CurrentSourceTimestamp
|
|
|
) {
|
|
|
this.activeTempoExpression = timeSortedTempoExpressions[this.currentTempoEntryIndex];
|
|
|
this.currentTempoEntryIndex++;
|
|
@@ -443,7 +458,10 @@ export class MusicPartManagerIterator {
|
|
|
if (this.activeTempoExpression.ContinuousTempo !== undefined) {
|
|
|
endTime = this.activeTempoExpression.ContinuousTempo.AbsoluteEndTimestamp;
|
|
|
}
|
|
|
- if (this.CurrentSourceTimestamp >= this.activeTempoExpression.AbsoluteTimestamp || this.CurrentSourceTimestamp <= endTime) {
|
|
|
+ if (
|
|
|
+ this.CurrentSourceTimestamp >= this.activeTempoExpression.AbsoluteTimestamp
|
|
|
+ || this.CurrentSourceTimestamp <= endTime
|
|
|
+ ) {
|
|
|
this.currentTempoChangingExpression = this.activeTempoExpression;
|
|
|
}
|
|
|
}
|
|
@@ -454,7 +472,7 @@ export class MusicPartManagerIterator {
|
|
|
this.handleRepetitionsAtMeasureBegin();
|
|
|
this.activateCurrentRhythmInstructions();
|
|
|
}
|
|
|
- if (this.currentVoiceEntryIndex >= 0 && this.currentVoiceEntryIndex < this.currentMeasure.VerticalSourceStaffEntryContainers.Count) {
|
|
|
+ if (this.currentVoiceEntryIndex >= 0 && this.currentVoiceEntryIndex < this.currentMeasure.VerticalSourceStaffEntryContainers.length) {
|
|
|
let currentContainer: VerticalSourceStaffEntryContainer = this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];
|
|
|
this.currentVoiceEntries = this.getVoiceEntries(currentContainer);
|
|
|
this.currentVerticalContainerInMeasureTimestamp = currentContainer.Timestamp;
|
|
@@ -467,7 +485,7 @@ export class MusicPartManagerIterator {
|
|
|
}
|
|
|
this.currentEnrolledMeasureTimestamp.Add(this.currentMeasure.Duration);
|
|
|
this.handleRepetitionsAtMeasureEnd();
|
|
|
- if (this.currentMeasureIndex >= 0 && this.currentMeasureIndex < this.manager.MusicSheet.SourceMeasures.Count) {
|
|
|
+ if (this.currentMeasureIndex >= 0 && this.currentMeasureIndex < this.manager.MusicSheet.SourceMeasures.length) {
|
|
|
this.currentMeasure = this.manager.MusicSheet.SourceMeasures[this.currentMeasureIndex];
|
|
|
this.currentTimeStamp = new Fraction(this.currentMeasure.AbsoluteTimestamp + this.currentVerticalContainerInMeasureTimestamp);
|
|
|
this.currentVoiceEntryIndex = -1;
|
|
@@ -480,39 +498,37 @@ export class MusicPartManagerIterator {
|
|
|
this.endReached = true;
|
|
|
}
|
|
|
private checkEntries(notesOnly: boolean): boolean {
|
|
|
- let tlist: List<VoiceEntry> = this.CurrentVisibleVoiceEntries();
|
|
|
- if (tlist.Count > 0) {
|
|
|
+ let tlist: VoiceEntry[] = this.CurrentVisibleVoiceEntries();
|
|
|
+ if (tlist.length > 0) {
|
|
|
if (!notesOnly) { return true; }
|
|
|
- for (let idx: number = 0, len: number = tlist.Count; idx < len; ++idx) {
|
|
|
+ for (let idx: number = 0, len: number = tlist.length; idx < len; ++idx) {
|
|
|
let entry: VoiceEntry = tlist[idx];
|
|
|
if (entry.Notes[0].Pitch !== undefined) { return true; }
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
- private getVisibleEntries(entry: VoiceEntry, visibleEntries: List<VoiceEntry>): void {
|
|
|
+ private getVisibleEntries(entry: VoiceEntry, visibleEntries: VoiceEntry[]): void {
|
|
|
if (entry.ParentVoice.Visible) {
|
|
|
- visibleEntries.Add(entry);
|
|
|
+ visibleEntries.push(entry);
|
|
|
}
|
|
|
}
|
|
|
- private getAudibleEntries(entry: VoiceEntry, audibleEntries: List<VoiceEntry>): void {
|
|
|
+ private getAudibleEntries(entry: VoiceEntry, audibleEntries: VoiceEntry[]): void {
|
|
|
if (entry.ParentVoice.Audible) {
|
|
|
- audibleEntries.Add(entry);
|
|
|
+ audibleEntries.push(entry);
|
|
|
}
|
|
|
}
|
|
|
- private getScoreFollowingEntries(entry: VoiceEntry, followingEntries: List<VoiceEntry>): void {
|
|
|
+ private getScoreFollowingEntries(entry: VoiceEntry, followingEntries: VoiceEntry[]): void {
|
|
|
if (entry.ParentVoice.Following && entry.ParentVoice.Parent.Following) {
|
|
|
- followingEntries.Add(entry);
|
|
|
+ followingEntries.push(entry);
|
|
|
}
|
|
|
}
|
|
|
- private getVoiceEntries(container: VerticalSourceStaffEntryContainer): List<VoiceEntry> {
|
|
|
- let entries: List<VoiceEntry> = new List<VoiceEntry>();
|
|
|
- for (let idx: number = 0, len: number = container.StaffEntries.Count; idx < len; ++idx) {
|
|
|
- let sourceStaffEntry: SourceStaffEntry = container.StaffEntries[idx];
|
|
|
+ private getVoiceEntries(container: VerticalSourceStaffEntryContainer): VoiceEntry[] {
|
|
|
+ let entries: VoiceEntry[] = new Array();
|
|
|
+ for (let sourceStaffEntry: SourceStaffEntry of container.StaffEntries) {
|
|
|
if (sourceStaffEntry === undefined) { continue; }
|
|
|
- for (let idx2: number = 0, len2: number = sourceStaffEntry.VoiceEntries.Count; idx2 < len2; ++idx2) {
|
|
|
- let voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[idx2];
|
|
|
- entries.Add(voiceEntry);
|
|
|
+ for (let voiceEntry: VoiceEntry of sourceStaffEntry.VoiceEntries) {
|
|
|
+ entries.push(voiceEntry);
|
|
|
}
|
|
|
}
|
|
|
return entries;
|