Re: MemoryAccessViolationException and multimedia timer problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Wed, 17 Jun 2009 15:00:58 -0700, MM <mm@xxxxxx> wrote:

I have tried those (System.Timers.Timer & System.Threading.Timer) and the
code works without problem. However the problem remains that I've found
these solutions just too unpredictable - even using modest time intervals
like 1000msecs causes chronic drift particularily when machines under heavy
load. I found the multimedia timers to work a treat (barring this annoying
problem - see later post). If the funcs in "winmm.dll" are obsolete - what
do the multimedia apps use for their timing? Thanks for the advice.

Unfortunately, they are _not_ obsolete, as Jeroen says. As you've found,
the multimedia timers are much more precise than any of the
thread/message-based timers. It's easy to compensate the regular timers
so that over time they produce accurate results, but you'll always have
jitter no matter what.

If you want that precision, I think winmm.dll is probably the way to go.
I think there might be similar timing features in DirectX (DirectSound
and/or DirectShow) but off the top of my head I don't have any specifics,
and I think winmm.dll is probably going to be easier to use, if _all_ you
need is the timer.

Sorry to say, I don't actually know enough about p/invoke to know for sure what's causing your exception. But it does seem to me you should be able to get it to work. My usual approach to trying to debug stuff like that is to make absolutely sure I've got it working in unmanaged code first, and then port that over to managed code.

Pete
.



Relevant Pages

  • Re: MemoryAccessViolationException and multimedia timer problem
    ... the multimedia timers are much more precise than any of the thread/message-based timers. ... I think there might be similar timing features in DirectX but off the top of my head I don't have any specifics, and I think winmm.dll is probably going to be easier to use, if _all_ you need is the timer. ...
    (microsoft.public.dotnet.languages.csharp)
  • Timers to threads
    ... We are using Linux in one of our embedded products.This is the first time we are working in this Platform.We have few doubts regarding implementing s/w timers & how to pass the timer interrupts to threads. ... If we use kernel timers to invoke at particular time intervals using add_timer how to pass on to the application that the time has elapsed? ... Embedded Systems & Software ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: randomly draw lines on form as long as it runs?
    ... Multimedia timers have better resolution - see ... Mark Salsbery ... Microsoft MVP - Visual C++ ... this task can only be accomplished with timers or threading. ...
    (microsoft.public.win32.programmer.gdi)