'Twas suggested that I ask this question here. Would love any feedback. I
know the Palm's 'not meant' to do hard lock timing things, but... any
ideas?
---------- Forwarded message ----------
Date: Mon, 7 Jun 1999 18:25:23 -0400 (EDT)
From: Brian Whitman <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [handheld-music] pilot tips
I've asked this on pilot.programmer and got stuck still even with some
great help. I'm having trouble working out a good, stable timing loop for
the Palm OS for MIDI events.
Not sure how many palm coders we have on here, but here goes:
My old timing loop was just a:
EvtGetEvent(&event, 5);
/* do stuff that should happen every 5 ms */
since I wanted to do something every 5ms. So if there were no user events,
it would 'time out' after 5ms and execute my time-based code (send out
controllers, etc...)
But this doesn't really work. As in: it sends out controller data every so
often, but surely not every 5ms. More like every 100ms. Someone brought up
the fact that other system events will slow it down, since it won't always
'time out' at 5-- so he suggested and I implemented:
ticks_per_5ms = (SysTicksPerSecond() / 1000) * 5;
next_tick = TimGetTicks() + ticks_per_5ms;
do
{
EvtGetEvent(&event, max (0, next_tick - TimGetTicks()) );
next_tick = next_tick + ticks_per_5ms;
/* do stuff that should happen every 5 ms */
...
But -- this doesn't do it either. What happens here is that the stuff that
should happen every 5ms only happens *if I'm sending it user events as
well*, i.e. drawing the pen around, whatever...
I can't find source anywhere of timing specific palm code, so I'd like to
see if anyone else uses something different. The first thing works-- but
the resolution isn't as good as I know the Palm can do.
-brian
------------------------------------------------------------------------
ONElist: the best source for group communications.
http://www.onelist.com
Join a new list today!
------------------------------------------------------------------------
handheld-music web: http://www.crudites.org/soundventures/handheld-music