High precision timers in C#

  • Thread starter Thread starter Hobz
  • Start date Start date
H

Hobz

Guest
I am currently in need of a high precision timer.

The implemented timers found in .NET are not sufficient.

I have done some research and found that using HPET timers are possible with newer hardware (which I am targetting my application at).
Previously the way to go was with the multimedia timer (found in winmm.dll), but now, it seems, the mm-timer has been superseded by the TimerQueueTimer (found in kernel32.dll).

However, while wrapping the TimerQueueTimer in C#, I found that it was not as precise as I had hoped. When setting it to fire every 1 ms, the actual result (i.e. the time between the timer's callback function is invoked) is more like 2 ms.

In order for a video, audio or MIDI file to be played back, there must exist a timer that will give a high degree of accuracy.
So I was thinking, it the TimerQueueTimer the most precise timer available i Windows? Is there a DirectX timer that is more precise? Is there another way of generating high precision periodical events? Also I read that ASIO (audio stream I/O) is very low latency (~1 ms). What timer does ASIO use?

Continue reading...
 
Back
Top