CerebusOSS/CereLink

cbsdk timestamp issue

Closed this issue · 2 comments

Hi Ehsan,
I have created a Gist from the code that I shared here:
https://gist.github.com/sam-hagh/8a10ed2cd331f21845ce017dbd64d479

Here is a very simple code that can reproduce this issue.
The code does the following:

  • open the first instance (instance 0)
  • configure the first channel so that it records continuous data at 30kHz without any filter.
  • configure the first instance in order to get continuous data
  • then, each time we get data, we compare the timestamp of the data with a computed theoritical timestamp. This theoritical timestamp is computed using the timestamp of the previous data packet and the number of samples it contained.
    If there is any difference between the actual timestamp and the theoritical one, we output the difference to the console.

When I run this sample code, I occasionally get about 30 samples errors in the timestamp.
Can you confirm that you observe timestamp errors as well, and if so, look for a solution ?

In cbSdkGetTrialData you set active to 1, which resets the buffer time if the computer is not fast enough to process everything before new packets arrive. There is a buffer, so if on average the speed is enough you do not have to set active to 1 and not lose data.

I have updated the code to the latest. Now init also accepts reset parameter, and the timestamp should be fixed. Please re-open if needed.