Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Timer Class Reference

Versatile timer for the entropy tuner. More...

#include <timer.h>

Public Member Functions

 Timer ()
 Constructor, resets the timer. More...
 
 ~Timer ()
 
void reset ()
 Reset the timer and remember the current time locally. More...
 
int64_t getMilliseconds ()
 
void wait (int milliseconds)
 Wait in idle mode without consuming CPU time. More...
 
bool timeout (int64_t milliseconds)
 Check for timeout. More...
 
void waitUntil (int64_t milliseconds, int interval_ms=5)
 Wait in idle mode for a certain minimum time span since last reset. More...
 

Private Attributes

std::chrono::time_point
< std::chrono::system_clock > 
mStart
 

Detailed Description

Versatile timer for the entropy tuner.

This timer works like a simple clock which is set to zero at the moment of creation and whenever the function reset() is called. The class provides a function waitUntil which waits for a certain minimum time span since the last reset. It is used in the SignalAnalyzer in order to compute FFTs with a certain mininum time interval in between.

Definition at line 39 of file timer.h.

Constructor & Destructor Documentation

Timer::Timer ( )

Constructor, resets the timer.

Definition at line 36 of file timer.cpp.

+ Here is the call graph for this function:

Timer::~Timer ( )
inline

Definition at line 43 of file timer.h.

Member Function Documentation

int64_t Timer::getMilliseconds ( )

Definition at line 77 of file timer.cpp.

void Timer::reset ( )

Reset the timer and remember the current time locally.

Definition at line 50 of file timer.cpp.

bool Timer::timeout ( int64_t  milliseconds)

Check for timeout.

Parameters
milliseconds: Timeout time in milliseconds.

Definition at line 94 of file timer.cpp.

+ Here is the call graph for this function:

void Timer::wait ( int  milliseconds)

Wait in idle mode without consuming CPU time.

Call this function if you want to stay in an idle state without consuming CPU time.

Parameters
milliseconds: Waiting time in milliseconds

Definition at line 67 of file timer.cpp.

void Timer::waitUntil ( int64_t  milliseconds,
int  interval_ms = 5 
)

Wait in idle mode for a certain minimum time span since last reset.

Parameters
milliseconds: Mimimum waiting time in milliseconds.
interval_ms: Checking interval in milliseconds, default = 5ms

Definition at line 112 of file timer.cpp.

+ Here is the call graph for this function:

Member Data Documentation

std::chrono::time_point<std::chrono::system_clock> Timer::mStart
private

Definition at line 52 of file timer.h.


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