Jamba  3.2.0
pongasoft::VST::SampleRateBasedClock Class Reference

#include <SampleRateBasedClock.h>

Classes

class  RateLimiter
 

Public Member Functions

TSamples getNextBarSampleCount (TSamples iCurrentSampleCount, double iTempo, int32 iTimeSigNumerator=4, int32 iTimeSigDenominator=4) const
 
RateLimiter getRateLimiter (uint32 iMillis) const
 
uint32 getSampleCountFor (uint32 iMillis) const
 
uint32 getSampleCountFor1Bar (double iTempo, int32 iTimeSigNumerator=4, int32 iTimeSigDenominator=4) const
 
SampleRate getSampleRate () const
 
uint32 getTimeForSampleCount (uint32 iSampleCount) const
 
 SampleRateBasedClock (SampleRate iSampleRate)
 
void setSampleRate (SampleRate iSampleRate)
 

Private Attributes

SampleRate fSampleRate
 

Detailed Description

The purpose of this class is to deal with timing based on the sample rate and do the proper conversions.

Constructor & Destructor Documentation

◆ SampleRateBasedClock()

pongasoft::VST::SampleRateBasedClock::SampleRateBasedClock ( SampleRate  iSampleRate)
inlineexplicit

Member Function Documentation

◆ getNextBarSampleCount()

TSamples pongasoft::VST::SampleRateBasedClock::getNextBarSampleCount ( TSamples  iCurrentSampleCount,
double  iTempo,
int32  iTimeSigNumerator = 4,
int32  iTimeSigDenominator = 4 
) const
inline

Given the current sample count (which can be extracted from ProcessData::processContext->projectTimeSamples) returns the number of samples for the next bar boundary.

Example: with a tempo of 120 (4/4), and a sample rate of 48000, each bar is 96000 samples.

getNextBarSampleCount(52123, 120) == 96000; // 1 bar
getNextBarSampleCount(600000, 120) == 672000; // 7 bars
getNextBarSampleCount(672000, 120) == 672000; // 7 bars
getNextBarSampleCount(672001, 120) == 768000; // 8 bars

◆ getRateLimiter()

RateLimiter pongasoft::VST::SampleRateBasedClock::getRateLimiter ( uint32  iMillis) const
inline

◆ getSampleCountFor()

uint32 pongasoft::VST::SampleRateBasedClock::getSampleCountFor ( uint32  iMillis) const
inline

◆ getSampleCountFor1Bar()

uint32 pongasoft::VST::SampleRateBasedClock::getSampleCountFor1Bar ( double  iTempo,
int32  iTimeSigNumerator = 4,
int32  iTimeSigDenominator = 4 
) const
inline

◆ getSampleRate()

SampleRate pongasoft::VST::SampleRateBasedClock::getSampleRate ( ) const
inline

◆ getTimeForSampleCount()

uint32 pongasoft::VST::SampleRateBasedClock::getTimeForSampleCount ( uint32  iSampleCount) const
inline

◆ setSampleRate()

void pongasoft::VST::SampleRateBasedClock::setSampleRate ( SampleRate  iSampleRate)
inline

Member Data Documentation

◆ fSampleRate

SampleRate pongasoft::VST::SampleRateBasedClock::fSampleRate
private

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