drift correction

Making & changing hardware drivers in Acquisition Server
Post Reply
alpidor
Posts: 7
Joined: Thu Oct 14, 2010 4:36 am

drift correction

Post by alpidor »

Hello,

I'm working with an OpenViBE version downloaded around Octomber 15, 2010 and, in my driver code I try to use the code suggested by you on

http://openvibe.inria.fr/documentation/ ... ction.html

Code: Select all

boolean CDriverFooBarDevice::loop(void)
{
  if(!m_rDriverContext.isConnected())
    return false;

  if(m_rDriverContext.isStarted())
  {
    //... read data from device and fill the buffer

    m_pCallback->setSamples(m_pSample);

    // The jitter can be negative or positive !
    if(m_rDriverContext.getDriftSampleCount()
          > m_rDriverContext.getDriftToleranceSampleCount()
     || m_rDriverContext.getDriftSampleCount()
          < - m_rDriverContext.getDriftToleranceSampleCount())
    {
      m_rDriverContext.getLogManager()
               << LogLevel_Trace
               << "Drift detected: "
               << m_rDriverContext.getDriftSampleCount()
               <<" samples.\n";
      m_rDriverContext.getLogManager()
               << LogLevel_Trace
               << "Suggested correction: "
               << m_rDriverContext
                     .getSuggestedDriftCorrectionSampleCount()
               <<" samples.\n";

      if(! m_rDriverContext
               .correctDriftSampleCount(
                     m_rDriverContext
                          .getSuggestedDriftCorrectionSampleCount()))
      {
        m_rDriverContext.getLogManager()
               << LogLevel_Error
               << "ERROR while correcting drift.\n";
      }
    }
  }
  return true;
}

It worked in a previous version but presently some errors occurred.

EX. on m_rDriverContext.getJitterSampleCount() etc.

Can you help me to solve this situation?

Gelu

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

Re: drift correction

Post by yrenard »

Dear Gelu,

I'm not sure what problem you are experiencing but I guess you are using the old API (<i>getJitterSampleCount</i> has been replaced by <i>getDriftSampleCount</i>). The tutorial you copied / pasted uses the correct API.

This has been done because the naming of those functions were not correct as we do not want any modification of the jitter but actually want a modification on the drift. This has unfortunately not been announced on the developers mailing list, sorry for the inconvenience.

Regards,
Yann

Post Reply