Reputation: 191
I've got a program in Delphi which takes in frames from an external application in 25 hertz (25 times per seconds) and then converts it to 60 hertz (60 frames per second) by creating 1-2 extra frames. I need to output these extra frames by continuously building a frame buffer and outputting the frames from here from a separate thread. The problem is that 1000/60 is 16.66667 which means I can't just send the frames in a "interval" on 16 or 17 milliseconds, I need it to be more precise. How do I do this in Delphi/Windows?
Upvotes: 2
Views: 3114
Reputation: 613013
You probably need to make use of both of the following:
QueryPerformanceCounter
Win32 function, and also wrapped by the Delphi TStopwatch
type.Both of these have higher resolution than the GUI timer, and should suffice for your needs. Read an overview here: http://msdn.microsoft.com/en-gb/library/windows/desktop/ms644900.aspx
Upvotes: 2
Reputation: 596547
Use a multimedia timer via the Win32 API timeSetEvent()
or CreateTimerQueueTimer()
function.
Upvotes: 2