コード例 #1
0
ファイル: Winds.cs プロジェクト: notator/Moritz
        /// <summary>
        /// Returns a VoiceDef containing clones of the UniqueDefs in the originalVoiceDef argument,
        /// rotated so that the original first IUniqueDef is positioned close to rotationMsPosition.
        /// </summary>
        /// <param name="originalVoiceDef"></param>
        /// <returns></returns>
        private Trk GetRotatedWind(int midiChannel, Trk originalVoiceDef, int rotationMsPosition)
        {
            Trk tempWind = originalVoiceDef.Clone();
            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.MsPositionReTrk = msPosition;
                msPosition += iu.MsDuration;
            }
            Trk newRotatedWind = new Trk(midiChannel, newWindLmdds);

            return newRotatedWind;
        }
コード例 #2
0
ファイル: Furies3.cs プロジェクト: notator/Moritz
 private Trk GetNextFlutterSequence(Trk existingFlutter, double factor, int transposition)
 {
     Trk nextFlutter = existingFlutter.Clone();
     nextFlutter.AdjustVelocities(factor);
     nextFlutter.AdjustMsDurations(factor);
     nextFlutter.AdjustRestMsDurations(factor);
     nextFlutter.Transpose(transposition);
     return nextFlutter;
 }