Allolib  1.0
C++ Components For Interactive Multimedia
al::DelayLockedLoop Class Reference

Self-correcting timer. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/system/al_Time.hpp>

Public Member Functions

 DelayLockedLoop (al_sec step_period, double bandwidth=0.5)
 
void setBandwidth (double bandwidth)
 Set degree of smoothing.
 
void reset ()
 Call this after an xrun: will reset the timing adjustments.
 
void step (al_sec realtime)
 Trigger this from the periodic event. More...
 
void operator() (al_sec realtime)
 
al_sec period_smoothed () const
 Get the current period estimation (smoothed)
 
al_sec rate_smoothed () const
 Get the current rate estimation (smoothed)
 
al_sec period_ideal () const
 Get the ideal period.
 
al_sec rate_ideal () const
 Get the ideal rate.
 
al_sec realtime_interp (double alpha) const
 Returns time estimate between current and next event. More...
 

Protected Attributes

al_sec tperiod
 
al_sec t0
 
al_sec t1
 
al_sec t2
 
double mB
 
double mC
 
bool mReset
 

Detailed Description

Self-correcting timer.

Helper object for events intended to run at a particular rate/period, but which might be subject to drift, latency and jitter. A curve mapping logical to real time can be drawn over an event period by interpolating between t0 and t1

See also
http://kokkinizita.linuxaudio.org/papers/usingdll.pdf

Definition at line 123 of file al_Time.hpp.

Member Function Documentation

◆ realtime_interp()

al_sec al::DelayLockedLoop::realtime_interp ( double  alpha) const
inline

Returns time estimate between current and next event.

This returns an estimate of corresponding real-time between current event & next by linear interpolation of current event timestamp & projected next event timestamp.

Definition at line 161 of file al_Time.hpp.

◆ step()

void al::DelayLockedLoop::step ( al_sec  realtime)

Trigger this from the periodic event.

Parameters
[in]realtimesource time that we are trying to smoothly follow

The documentation for this class was generated from the following file: