Jamba C++ API  5.1.1
SampleRateBasedClock::RateLimiter Class Reference

Keeps track of the time in number of samples processed vs sample rate. More...

#include <SampleRateBasedClock.h>

Public Member Functions

 RateLimiter (uint32 iRateLimitInSamples=0)
 
bool shouldUpdate (uint32 numSamples)
 Calls this method when a new batch of samples is processed and returns true if the limit (in samples) is achieved. More...
 

Private Attributes

uint32 fRateLimitInSamples
 
uint32 fSampleCount
 

Detailed Description

Keeps track of the time in number of samples processed vs sample rate.

Typical usage is:

// in setup rateLimiter = clock.getRateLimiter(250); // 4 times a second

// in process (every frame) if(rateLimiter.shouldUpdate(processData.numSamples)) { // execute rate limited code (ex: update UI) }

Constructor & Destructor Documentation

◆ RateLimiter()

RateLimiter ( uint32  iRateLimitInSamples = 0)
inlineexplicit

Member Function Documentation

◆ shouldUpdate()

bool shouldUpdate ( uint32  numSamples)
inline

Calls this method when a new batch of samples is processed and returns true if the limit (in samples) is achieved.

Member Data Documentation

◆ fRateLimitInSamples

uint32 fRateLimitInSamples
private

◆ fSampleCount

uint32 fSampleCount
private

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