private object ValueDisplacer(object value, object targetValue, double percent)
        {
            VolumeLevel v1, v2, retval;

            if (value == null)
            {
                return(m_MediaFile.VolumeLevel);
            }

            v1 = (VolumeLevel)value;
            v2 = (VolumeLevel)targetValue;

            retval = new VolumeLevel();

            if ((int)v2.Left > (int)v1.Left)
            {
                retval.Left = (int)v1.Left + (int)((int)v1.Left * (percent / 100));
            }
            else
            {
                retval.Left = (int)v1.Left - (int)((int)v1.Left * (percent / 100));
            }

            if ((int)v2.Right > (int)v1.Right)
            {
                retval.Right = (int)v1.Right + (int)((int)v1.Right * (percent / 100));
            }
            else
            {
                retval.Right = (int)v1.Right - (int)((int)v1.Right * (percent / 100));
            }

            return(retval);
        }
        public virtual void FadeToLevel(VolumeLevel targetLevel, TimeSpan time)
        {
            const int steps = 50;

            var startLevel = this.VolumeLevel.Average;
            var sleep      = new TimeSpan(time.Ticks / steps);
            var delta      = (targetLevel.Average - startLevel) / steps;
            var newLevel   = startLevel + delta;

            if (newLevel < 0)
            {
                newLevel = 0;
            }

            try
            {
                for (var i = 0; i < steps; i++)
                {
                    this.VolumeLevel = new VolumeLevel((int)newLevel, (int)newLevel);

                    try
                    {
                        checked
                        {
                            newLevel += delta;
                        }
                    }
                    catch (OverflowException)
                    {
                        newLevel = targetLevel.Average;
                    }

                    Thread.Sleep(sleep);
                }

                this.VolumeLevel = targetLevel;
            }
            catch (Exception)
            {
            }
        }
		public virtual void FadeToLevel(VolumeLevel targetLevel, TimeSpan time)
		{
			const int steps = 50;

			var startLevel = this.VolumeLevel.Average;
			var sleep = new TimeSpan(time.Ticks / steps);
			var delta = (targetLevel.Average - startLevel) / steps;
			var newLevel = startLevel + delta;

			if (newLevel < 0)
			{
				newLevel = 0;
			}

			try
			{
				for (var i = 0; i < steps; i++)
				{
					this.VolumeLevel = new VolumeLevel((int) newLevel, (int) newLevel);

					try
					{
						checked
						{
							newLevel += delta;
						}
					}
					catch (OverflowException)
					{
						newLevel = targetLevel.Average;
					}

					Thread.Sleep(sleep);
				}

				this.VolumeLevel = targetLevel;
			}
			catch (Exception)
			{
			}
		}
		private object ValueDisplacer(object value, object targetValue, double percent)
		{
			VolumeLevel v1, v2, retval;

			if (value == null)
			{
				return m_MediaFile.VolumeLevel;
			}

			v1 = (VolumeLevel)value;
			v2 = (VolumeLevel)targetValue;

			retval = new VolumeLevel();

			if ((int)v2.Left > (int)v1.Left)
			{
				retval.Left = (int)v1.Left + (int)((int)v1.Left * (percent / 100));
			}
			else
			{
				retval.Left = (int)v1.Left - (int)((int)v1.Left * (percent / 100));
			}

			if ((int)v2.Right > (int)v1.Right)
			{
				retval.Right = (int)v1.Right + (int)((int)v1.Right * (percent / 100));
			}
			else
			{
				retval.Right = (int)v1.Right - (int)((int)v1.Right * (percent / 100));
			}

			return retval;
		}