Vamp::RealTime Class Reference

RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions. More...

`#include <vamp-sdk/RealTime.h>`

## Public Member Functions

int | usec () const
int | msec () const
| RealTime ()
| RealTime (int s, int n)
| RealTime (const RealTime &r)
RealTime & | operator= (const RealTime &r)
RealTime | operator+ (const RealTime &r) const
RealTime | operator- (const RealTime &r) const
RealTime | operator- () const
bool | operator< (const RealTime &r) const
bool | operator> (const RealTime &r) const
bool | operator== (const RealTime &r) const
bool | operator!= (const RealTime &r) const
bool | operator>= (const RealTime &r) const
bool | operator<= (const RealTime &r) const
RealTime | operator/ (int d) const
double | operator/ (const RealTime &r) const
| Return the ratio of two times.
std::string | toString () const
| Return a human-readable debug-type string to full precision (probably not a format to show to a user directly).
std::string | toText (bool fixedDp=false) const
| Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm.

## Static Public Member Functions

static RealTime | fromSeconds (double sec)
static RealTime | fromMilliseconds (int msec)
static RealTime | fromTimeval (const struct timeval &)
static long | realTime2Frame (const RealTime &r, unsigned int sampleRate)
| Convert a RealTime into a sample frame at the given sample rate.
static RealTime | frame2RealTime (long frame, unsigned int sampleRate)
| Convert a sample frame at the given sample rate into a RealTime.

## Public Attributes

int | sec
int | nsec

## Static Public Attributes

static const RealTime | zeroTime

## Detailed Description

RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions.

Definition at line 66 of file vamp-sdk/RealTime.h.

## Constructor & Destructor Documentation

## RealTime() [1/3]

Vamp::RealTime::RealTime | ( |  | ) |

inline

Definition at line 74 of file vamp-sdk/RealTime.h.

References nsec, and sec.

Referenced by frame2RealTime(), fromMilliseconds(), fromSeconds(), fromTimeval(), operator!=(), operator+(), operator-(), operator-(), operator/(), operator/(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), RealTime(), and realTime2Frame().

## RealTime() [2/3]

Vamp::RealTime::RealTime | ( | int | s,
|  | int | n )

## RealTime() [3/3]

Vamp::RealTime::RealTime | ( | const RealTime & | r | ) |

inline

Definition at line 77 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## Member Function Documentation

## usec()

int Vamp::RealTime::usec | ( |  | ) | const

inline

Definition at line 71 of file vamp-sdk/RealTime.h.

References nsec.

## msec()

int Vamp::RealTime::msec | ( |  | ) | const

inline

Definition at line 72 of file vamp-sdk/RealTime.h.

References nsec.

Referenced by fromMilliseconds().

## fromSeconds()

RealTime Vamp::RealTime::fromSeconds | ( | double | sec | ) |

static

References RealTime(), and sec.

## fromMilliseconds()

RealTime Vamp::RealTime::fromMilliseconds | ( | int | msec | ) |

static

References msec(), and RealTime().

## fromTimeval()

RealTime Vamp::RealTime::fromTimeval | ( | const struct timeval & |  | ) |

static

References RealTime().

## operator=()

RealTime & Vamp::RealTime::operator= | ( | const RealTime & | r | ) |

inline

Definition at line 87 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## operator+()

RealTime Vamp::RealTime::operator+ | ( | const RealTime & | r | ) | const

inline

Definition at line 91 of file vamp-sdk/RealTime.h.

References nsec, RealTime::RealTime(), RealTime(), and sec.

## operator-() [1/2]

RealTime Vamp::RealTime::operator- | ( | const RealTime & | r | ) | const

inline

Definition at line 94 of file vamp-sdk/RealTime.h.

References nsec, RealTime::RealTime(), RealTime(), and sec.

## operator-() [2/2]

RealTime Vamp::RealTime::operator- | ( |  | ) | const

inline

Definition at line 97 of file vamp-sdk/RealTime.h.

References nsec, RealTime::RealTime(), RealTime(), and sec.

## operator<()

bool Vamp::RealTime::operator< | ( | const RealTime & | r | ) | const

inline

Definition at line 101 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## operator>()

bool Vamp::RealTime::operator> | ( | const RealTime & | r | ) | const

inline

Definition at line 106 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## operator==()

bool Vamp::RealTime::operator== | ( | const RealTime & | r | ) | const

inline

Definition at line 111 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## operator!=()

bool Vamp::RealTime::operator!= | ( | const RealTime & | r | ) | const

inline

Definition at line 115 of file vamp-sdk/RealTime.h.

References RealTime().

## operator>=()

bool Vamp::RealTime::operator>= | ( | const RealTime & | r | ) | const

inline

Definition at line 119 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## operator<=()

bool Vamp::RealTime::operator<= | ( | const RealTime & | r | ) | const

inline

Definition at line 124 of file vamp-sdk/RealTime.h.

References nsec, RealTime(), and sec.

## operator/() [1/2]

RealTime Vamp::RealTime::operator/ | ( | int | d | ) | const

References RealTime().

## operator/() [2/2]

double Vamp::RealTime::operator/ | ( | const RealTime & | r | ) | const

Return the ratio of two times.

References RealTime().

## toString()

std::string Vamp::RealTime::toString | ( |  | ) | const

Return a human-readable debug-type string to full precision (probably not a format to show to a user directly).

Referenced by printFeatures().

## toText()

std::string Vamp::RealTime::toText | ( | bool | fixedDp = false | ) | const

Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm.

## realTime2Frame()

long Vamp::RealTime::realTime2Frame | ( | const RealTime & | r,
|  | unsigned int | sampleRate )

static

Convert a RealTime into a sample frame at the given sample rate.

References RealTime().

## frame2RealTime()

RealTime Vamp::RealTime::frame2RealTime | ( | long | frame,
|  | unsigned int | sampleRate )

static

Convert a sample frame at the given sample rate into a RealTime.

References RealTime().

Referenced by FixedTempoEstimator::D::assembleFeatures(), PercussionOnsetDetector::process(), and ZeroCrossing::process().

## Member Data Documentation

## sec

int Vamp::RealTime::sec

Definition at line 68 of file vamp-sdk/RealTime.h.

Referenced by fromSeconds(), operator+(), operator-(), operator-(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), RealTime(), RealTime(), and toSeconds().

## nsec

int Vamp::RealTime::nsec

Definition at line 69 of file vamp-sdk/RealTime.h.

Referenced by msec(), operator+(), operator-(), operator-(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), RealTime(), RealTime(), toSeconds(), and usec().

## zeroTime

const RealTime Vamp::RealTime::zeroTime

static

Definition at line 158 of file vamp-sdk/RealTime.h.

Referenced by FixedTempoEstimator::D::reset().

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

- vamp-sdk/RealTime.h