Rounding Utility Functions

Detailed Description

Rounding utility functions used in the ARA SDK.

Rounding to Sample Position

Rounding from a continuous time or sample position to a discrete sample position. The rounding intervals are closed on the negative and open on the positive end, which keeps them consistent with all other ARA intervals and prevents potential rounding issues when ranges cross 0. For positive values, this matches regular llround(), but for negative values it rounds -x.5 towards +inf not -inf.

template<typename SamplePositionType = ARASamplePosition>
SamplePositionType ARA::roundSamplePosition (double continuousSample)
 
template<typename SamplePositionType = ARASamplePosition>
SamplePositionType ARA::samplePositionAtTime (ARATimePosition timePosition, ARASampleRate sampleRate)
 

Converting Sample Position To Time

Inverse operation of samplePositionAtTime (ARATimePosition t, ARASampleRate sampleRate).

template<typename SamplePositionType = ARASamplePosition>
ARATimePosition ARA::timeAtSamplePosition (SamplePositionType samplePositon, ARASampleRate sampleRate)