private void Transform(Trk section, Dictionary<string, int> msPositions, List<int> strandIndices) { List<int> strandDurations = GetStrandDurations(section, strandIndices); int extraTime = 750; int diff = extraTime / section.Count; for(int i = section.Count - 1; i > 0; --i) { if(strandIndices.Contains(i)) { RestDef umrd = new RestDef(section[i].MsPositionReTrk, strandDurations[strandIndices.IndexOf(i)] + extraTime); extraTime -= diff; section.Insert(i, umrd); } } section.MsPositionReSeq = msPositions["furies2FinaleStart"]; //double factor = 10; //section.AdjustMsDurations(factor); section.CreateAccel(0, section.Count, 0.25); //section.RemoveBetweenMsPositions(msPositions["interlude4End"], int.MaxValue); section.RemoveBetweenMsPositions(msPositions["finalWindChord"], int.MaxValue); if(section[section.Count - 1] is RestDef) { //section[section.Count - 1].MsDuration = msPositions["interlude4End"] - section[section.Count - 1].MsPosition; section[section.Count - 1].MsDuration = msPositions["endOfPiece"] - section[section.Count - 1].MsPositionReTrk; } }
/// <summary> /// Makes both tracks the same length by adding rests at the beginnings and ends. /// The Alignment is found using this.MsPositionReContainer and trk2.MsPositionReContainer /// </summary> private void AlignAndJustifyWith(Trk trk2) { this.Trim(); if(this.MsPositionReContainer > 0) { this.Insert(0, new RestDef(0, this.MsPositionReContainer)); this.MsPositionReContainer = 0; } trk2.Trim(); if(trk2.MsPositionReContainer > 0) { trk2.Insert(0, new RestDef(0, trk2.MsPositionReContainer)); trk2.MsPositionReContainer = 0; } int lengthDiff = trk2.MsDuration - this.MsDuration; if(lengthDiff > 0) { this.Add(new RestDef(0, lengthDiff)); } else if(lengthDiff < 0) { trk2.Add(new RestDef(0, -lengthDiff)); } }