/// <summary>
        /// Beats the snap value.
        /// </summary>
        /// <param name="time">The time which should be snapped.</param>
        /// <param name="snapDivisor">The snap divisor (the bottom number of a fraction).</param>
        /// <param name="original">Assuming we want to move *away* from an old timing (ie. jump left 1 notch) set this to the original.</param>
        /// <returns></returns>
        internal int BeatSnapValue(double time, int snapDivisor, double original)
        {
            if (AudioEngine.ControlPoints.Count == 0)
            {
                return((int)time);
            }

            double offset    = AudioEngine.BeatOffsetCloseToZeroAt(original);
            double increment = AudioEngine.BeatLengthAt(original, false) / snapDivisor;

            int flooredCount;

            if (time - offset < 0)
            {
                flooredCount = (int)((time - offset) / increment) - 1;
            }
            else
            {
                flooredCount = (int)((time - offset) / increment);
            }

            int leftVal  = (int)(flooredCount * increment + offset);
            int rightVal = (int)((flooredCount + 1) * increment + offset);

            if (original != time)
            {
                if (leftVal == original)
                {
                    return(rightVal);
                }
                if (rightVal == original)
                {
                    return(leftVal);
                }
            }

            return(time - leftVal < rightVal - time ? leftVal : rightVal);
        }