private TrkDef GetNextFlutterSequence(TrkDef existingFlutter, double factor, int transposition) { TrkDef nextFlutter = existingFlutter.DeepClone(); nextFlutter.AdjustVelocities(factor); nextFlutter.AdjustMsDurations(factor); nextFlutter.AdjustRestMsDurations(factor); nextFlutter.Transpose(transposition); return(nextFlutter); }
/// <summary> /// Returns a VoiceDef containing clones of the UniqueMidiDurationDefs in the originalVoiceDef argument, /// rotated so that the original first IUniqueMidiDurationDef is positioned close to rotationMsPosition. /// </summary> /// <param name="originalVoiceDef"></param> /// <returns></returns> private TrkDef GetRotatedWind(byte midiChannel, TrkDef originalVoiceDef, int rotationMsPosition) { TrkDef tempWind = originalVoiceDef.DeepClone(); tempWind.MidiChannel = midiChannel; int finalBarlineMsPosition = originalVoiceDef.EndMsPosition; int msDurationAfterSynch = finalBarlineMsPosition - rotationMsPosition; List<IUniqueDef> originalLmdds = tempWind.UniqueDefs; List<IUniqueDef> originalStartLmdds = new List<IUniqueDef>(); List<IUniqueDef> newWindLmdds = new List<IUniqueDef>(); int accumulatingMsDuration = 0; for(int i = 0; i < tempWind.Count; ++i) { if(accumulatingMsDuration < msDurationAfterSynch) { originalStartLmdds.Add(originalLmdds[i]); accumulatingMsDuration += originalLmdds[i].MsDuration; } else { newWindLmdds.Add(originalLmdds[i]); } } newWindLmdds.AddRange(originalStartLmdds); int msPosition = 0; foreach(IUniqueDef iu in newWindLmdds) { iu.MsPosition = msPosition; msPosition += iu.MsDuration; } TrkDef newRotatedWind = new TrkDef(midiChannel, newWindLmdds); return newRotatedWind; }
private TrkDef GetNextFlutterSequence(TrkDef existingFlutter, double factor, int transposition) { TrkDef nextFlutter = existingFlutter.DeepClone(); nextFlutter.AdjustVelocities(factor); nextFlutter.AdjustMsDurations(factor); nextFlutter.AdjustRestMsDurations(factor); nextFlutter.Transpose(transposition); return nextFlutter; }