Polling a Clock
Polling a Clock
- Subject: Polling a Clock
- From: Maximilian Marcoll <email@hidden>
- Date: Wed, 12 May 2010 13:07:58 +0200
Hello Everybody!
I'm having some difficulties figuring out the best way to poll a CAClock.
To "trigger" objects in an array at specific points in time, I set up a CAClock, and use CAClockGetCurrentTime()
within a loop to determine if there are objects I have to trigger.
My code looks something like this:
while( [list count] ) {
CAClockGetCurrentTime(clock, kCAClockTimeFormat_Seconds, &T);
// display current time
while( [list count] && T.time.seconds >= [[list objectAtIndex:0] start]){
[[list objectAtIndex:0] trigger];
[list removeObjectAtIndex:0];
}
}
Polling a clock like this seems to be a bit extreme.
(This code actually activates my MacBook's fan ;o)
I thought maybe I could use a CFRunLoop, but it's use of NSTimers would be a problem I think.
I would need to poll the clock every millisecond.
What would you do?
Thank you!
Max _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden