time management

Making & changing box plugins and external apps
Post Reply
matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

time management

Post by matthieuG »

Hello,

How time is managed in openViBE? How to produce a command at regular interval duration?

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: time management

Post by yrenard »

Dear matthieuG,

the kernel currently runs at 128 Hz, this can be configured in the configuration file.

In a box, you can find the current time using :

Code: Select all

this->getPlayerManager().getCurrentTime()
This value represents the number of seconds elapsed since the user pressed play in fixed point on 64 bits (32 bits for integer part and 32 for fractional part).

Tell me if something is not clear here.
Hope this helps,
Yann

matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

Re: time management

Post by matthieuG »

all is clear : I can know what time it is. But how to assure that a command is executed at a regular time. I can mesure the time in process(), so if I keep it in a buffer, I can have a duration at the next step. So if this time duration is too big, I missed to send the request (execution) ; if the duration is less than the period I need, I can wait the next process() or send the resquest with an advance.
With this logic, I can't really assure a regular command. Can you propose a better solution?

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: time management

Post by yrenard »

Dear matthieuG

please, have a look to the IBoxAlgorithm class documentation. You will find a function named getClockFrequency which tells the player how often your box should be clock notified. As soon as your box should be notified, the player will call your processClock callback so that you can examine current time and eventually mark your algorithm as ready to process.

I hope this helps,
Yann

Post Reply