Re: MemoryAccessViolationException and multimedia timer problem
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Wed, 17 Jun 2009 18:31:18 -0700
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
.
- Follow-Ups:
- Re: MemoryAccessViolationException and multimedia timer problem
- From: Jeroen Mostert
- Re: MemoryAccessViolationException and multimedia timer problem
- References:
- Prev by Date: Re: MemoryAccessViolationException and multimedia timer problem
- Next by Date: Re: Help with Streams
- Previous by thread: Re: MemoryAccessViolationException and multimedia timer problem
- Next by thread: Re: MemoryAccessViolationException and multimedia timer problem
- Index(es):
Relevant Pages
|