// JP opened flex table

Click to See Complete Forum and Search --> : Questions about timer


duddy67
July 2nd, 2008, 11:36 AM
Hi all,

I thought to use timeSetEvent as a timer for
my MIDI sequencer application but I've seen on MSDN site
that it's an obsolete function and I should rather use CreateTimerQueueTimer.
That's ok for me but I have few questions about it.

In my app the timer is used for synchro. An asynchronous callback function
is called every 2/3 ms and does it's job.

So my questions are:

1 - Since I need just one timer, should I create a queue for the timer
with CreateTimerQueue or should I use the default timer queue ?


2 - What flag should I use ?
(I would choose WT_EXECUTEINTIMERTHREAD but I'm not sure at all.)

WT_EXECUTEDEFAULT
WT_EXECUTEINTIMERTHREAD
WT_EXECUTEINPERSISTENTTHREAD
WT_EXECUTELONGFUNCTION

3 - Timer is used only when sequencer starts playback or
recording but what do I do when it stops ?
Should I delete timer and create a new one each
time sequencer starts playback/recording ?
Or is there any way to make the timer hold
on without delete it ?


Thanks for advance

duddy67
July 15th, 2008, 01:23 PM
No answer at all ?

Anyway, I found out something new:

I first tried my code with the timeSetEvent multimedia timer and it seems to work fine.
Therefore I tried with the CreateTimerQueueTimer timer and I'm afraid
it's no accurate at all.
For exemple if I set a tempo at 120 bpm with a resolution of 480 tpb
the speed should be the same whatever I set the timer value to 5, 10,
15 or 20ms. But it's not the case. But may be I don't use it properly.
So now I'm not sure if I want to use CreateTimerQueueTimer instead
timeSetEvent.

Is timeSetEvent still available on Windows Vista ?
Can someone tells me more about CreateTimerQueueTimer accuracy ?

Thanks

MrViggy
July 15th, 2008, 06:20 PM
A quick search revealed this thread:

http://www.codeguru.com/forum/showthread.php?t=448181&highlight=timer+accuracy

Viggy

//JP added flex table