Results 1 to 19 of 19

Thread: Fading smoothness (timers)

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Fading smoothness (timers)

    whoever developed the app I am working on really should be put behind bars.

    anyway
    problem is, when we press a button, it should fade out the volume. this is all working with some timing issues.

    now, it uses a timer (before, they were using Thread.Sleep()! Bad practice) to fade out the volume, thats all good
    The volume interval is set as an application setting, so can be 6 seconds to fade out or 10 seconds or whatever

    however, say if the volume is 50% and we press the button to fade, it doesnt take the full interval defined to fade out, but instead fades out earlier than the defined interval

    what is the best way of tackling this so that the volume is decreased nicely/smoothly regardless of the interval but as long as it completes fully within that interval?


    Now, there are 2 timers.

    1) which is set for the fade interval (6 seconds)
    2) the main one which is given the interval calculated based on the fade length * 1000

    in the 2nd timer, the real fader, it just decreases the volume by 1 - thats all but again, regardess of the volume I want it to decrease the volume to 0 and take the entire length of the time defined to do this

    does this make sense?
    Last edited by Techno; Jul 16th, 2008 at 09:01 AM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width