friz
An animation control system for JUCE
Loading...
Searching...
No Matches
friz::FrameRateCalculator Class Reference

Calculate the actual current (average) frame rate as measured at runtime. More...

#include <controller.h>

Public Member Functions

void update (juce::int64 timeInMs)
 Called each time we update the animator so we can keep track of the frequency.
 
float get () const
 Calculate the actual frame rate that we're running at.
 
void clear ()
 reset all internal values before starting.
 

Private Attributes

juce::int64 lastUpdate { -1 }
 
std::array< int, frameCount > memory
 
std::atomic< int > sum { 0 }
 keep a running sum of intervals so we can just divide.
 
std::atomic< int > updateCount { 0 }
 
int index { 0 }
 

Static Private Attributes

static constexpr int frameCount { 24 }
 

Detailed Description

Calculate the actual current (average) frame rate as measured at runtime.

Member Function Documentation

◆ get()

float friz::FrameRateCalculator::get ( ) const

Calculate the actual frame rate that we're running at.

Returns
float frames per second (averaged over recent history)

◆ update()

void friz::FrameRateCalculator::update ( juce::int64  timeInMs)

Called each time we update the animator so we can keep track of the frequency.

Parameters
timeInMs

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