/// <summary>
        /// Converts this RhythmicDuration to fraction and returns it as Proportion structure. Dots are taken into account.
        /// </summary>
        /// <returns></returns>
        public Proportion ToProportion()
        {
            var factor = GetFactor();
            var prop   = new Proportion(factor, (int)(Denominator * factor));

            for (int i = 0; i < Dots; i++)
            {
                prop += new Proportion(factor, (int)(Denominator * factor) * (int)Math.Pow(2, i + 1));
            }
            return(prop);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns a common denominator of two proportions.
 /// </summary>
 /// <param name="d1"></param>
 /// <param name="d2"></param>
 /// <returns></returns>
 private static int GetCommonDenominator(Proportion d1, Proportion d2)
 {
     return(d1.Denominator * d2.Denominator);
 }