OpenWareLaboratory
AdjustableTapTempo Class Reference
Inheritance diagram for AdjustableTapTempo:
Collaboration diagram for AdjustableTapTempo:

Public Member Functions

void adjust (uint16_t s)
 
 AdjustableTapTempo (float sr, size_t min, size_t max)
 
void adjustSpeed (float s)
 Adjust the tap tempo period. More...
 
void clock ()
 
void clock (size_t steps)
 
float getBeatsPerMinute ()
 Get tap tempo in BPM. More...
 
float getFrequency ()
 Get tap tempo frequency. More...
 
size_t getPeriodInSamples ()
 Get tap tempo period in samples. More...
 
bool isOn ()
 
void resetAdjustment (uint16_t s)
 
void resetSpeed (float s)
 
void setBeatsPerMinute (float bpm)
 Set tap tempo in BPM. More...
 
void setFrequency (float freq)
 Set tap tempo frequency. More...
 
void setPeriodInSamples (size_t value)
 Set tap tempo period in samples. More...
 
void setRange (float value)
 
void trigger (bool on)
 
void trigger (bool on, int delay)
 

Static Public Member Functions

static float bpmToFrequency (float bpm)
 
static float bpmToSamplePeriod (float bpm, float sr)
 
static AdjustableTapTempocreate (float sr, size_t limit)
 
static AdjustableTapTempocreate (float sr, size_t min, size_t max)
 
static void destroy (AdjustableTapTempo *obj)
 
static void destroy (TapTempo *obj)
 
static float frequencyToBpm (float freq)
 
static float frequencyToSamplePeriod (float hz, float sr)
 
static float samplePeriodToBpm (float samples, float sr)
 

Protected Member Functions

float scale (float s)
 

Protected Attributes

bool ison
 
const size_t max_limit
 
const size_t min_limit
 
float range = 4
 
size_t samples
 
float speed
 
const float sr
 
size_t trig
 

Detailed Description

Definition at line 105 of file TapTempo.h.

Constructor & Destructor Documentation

◆ AdjustableTapTempo()

AdjustableTapTempo::AdjustableTapTempo ( float  sr,
size_t  min,
size_t  max 
)
inline

Definition at line 116 of file TapTempo.h.

Referenced by create().

Member Function Documentation

◆ adjust()

void AdjustableTapTempo::adjust ( uint16_t  s)
inline

Definition at line 129 of file TapTempo.h.

References adjustSpeed().

◆ adjustSpeed()

void AdjustableTapTempo::adjustSpeed ( float  s)
inline

Adjust the tap tempo period.

Parameters
speedshould be in the range [0, 1] which corresponds to the configured adjustable range: from bpm/(range/2) to bpm*(range/2) A value of 0.5 corresponds to unity.

Definition at line 139 of file TapTempo.h.

References abs, clamp, TapTempo::max_limit, TapTempo::min_limit, range, TapTempo::samples, scale(), and speed.

Referenced by adjust().

◆ bpmToFrequency()

static float TapTempo::bpmToFrequency ( float  bpm)
inlinestaticinherited

Definition at line 79 of file TapTempo.h.

Referenced by TapTempo::bpmToSamplePeriod().

◆ bpmToSamplePeriod()

static float TapTempo::bpmToSamplePeriod ( float  bpm,
float  sr 
)
inlinestaticinherited

Definition at line 88 of file TapTempo.h.

References TapTempo::bpmToFrequency(), and TapTempo::sr.

Referenced by TapTempo::setBeatsPerMinute().

◆ clock() [1/2]

void TapTempo::clock ( )
inlineinherited

Definition at line 34 of file TapTempo.h.

References TapTempo::min_limit, and TapTempo::trig.

◆ clock() [2/2]

void TapTempo::clock ( size_t  steps)
inlineinherited

Definition at line 38 of file TapTempo.h.

References TapTempo::max_limit, and TapTempo::trig.

◆ create() [1/2]

static AdjustableTapTempo* AdjustableTapTempo::create ( float  sr,
size_t  limit 
)
inlinestatic

Definition at line 148 of file TapTempo.h.

References AdjustableTapTempo(), and TapTempo::sr.

◆ create() [2/2]

static AdjustableTapTempo* AdjustableTapTempo::create ( float  sr,
size_t  min,
size_t  max 
)
inlinestatic

Definition at line 151 of file TapTempo.h.

References AdjustableTapTempo(), max, min, and TapTempo::sr.

◆ destroy() [1/2]

static void AdjustableTapTempo::destroy ( AdjustableTapTempo obj)
inlinestatic

Definition at line 154 of file TapTempo.h.

◆ destroy() [2/2]

static void TapTempo::destroy ( TapTempo obj)
inlinestaticinherited

Definition at line 100 of file TapTempo.h.

◆ frequencyToBpm()

static float TapTempo::frequencyToBpm ( float  freq)
inlinestaticinherited

Definition at line 82 of file TapTempo.h.

Referenced by TapTempo::samplePeriodToBpm().

◆ frequencyToSamplePeriod()

static float TapTempo::frequencyToSamplePeriod ( float  hz,
float  sr 
)
inlinestaticinherited

Definition at line 85 of file TapTempo.h.

References TapTempo::sr.

◆ getBeatsPerMinute()

float TapTempo::getBeatsPerMinute ( )
inlineinherited

Get tap tempo in BPM.

Definition at line 46 of file TapTempo.h.

References TapTempo::samplePeriodToBpm(), TapTempo::samples, and TapTempo::sr.

◆ getFrequency()

float TapTempo::getFrequency ( )
inlineinherited

Get tap tempo frequency.

Definition at line 58 of file TapTempo.h.

References TapTempo::samples, and TapTempo::sr.

◆ getPeriodInSamples()

size_t TapTempo::getPeriodInSamples ( )
inlineinherited

Get tap tempo period in samples.

Definition at line 70 of file TapTempo.h.

References TapTempo::samples.

◆ isOn()

bool TapTempo::isOn ( )
inlineinherited

Definition at line 19 of file TapTempo.h.

References TapTempo::ison.

◆ resetAdjustment()

void AdjustableTapTempo::resetAdjustment ( uint16_t  s)
inline

Definition at line 119 of file TapTempo.h.

References resetSpeed().

◆ resetSpeed()

void AdjustableTapTempo::resetSpeed ( float  s)
inline

Definition at line 122 of file TapTempo.h.

References scale(), and speed.

Referenced by resetAdjustment().

◆ samplePeriodToBpm()

static float TapTempo::samplePeriodToBpm ( float  samples,
float  sr 
)
inlinestaticinherited

Definition at line 91 of file TapTempo.h.

References TapTempo::frequencyToBpm(), TapTempo::samples, and TapTempo::sr.

Referenced by TapTempo::getBeatsPerMinute().

◆ scale()

float AdjustableTapTempo::scale ( float  s)
inlineprotected

Definition at line 109 of file TapTempo.h.

Referenced by adjustSpeed(), and resetSpeed().

◆ setBeatsPerMinute()

void TapTempo::setBeatsPerMinute ( float  bpm)
inlineinherited

Set tap tempo in BPM.

Definition at line 52 of file TapTempo.h.

References TapTempo::bpmToSamplePeriod(), TapTempo::samples, and TapTempo::sr.

◆ setFrequency()

void TapTempo::setFrequency ( float  freq)
inlineinherited

Set tap tempo frequency.

Definition at line 64 of file TapTempo.h.

References TapTempo::samples, and TapTempo::sr.

◆ setPeriodInSamples()

void TapTempo::setPeriodInSamples ( size_t  value)
inlineinherited

Set tap tempo period in samples.

Definition at line 76 of file TapTempo.h.

References TapTempo::samples.

◆ setRange()

void AdjustableTapTempo::setRange ( float  value)
inline

Definition at line 125 of file TapTempo.h.

References range.

◆ trigger() [1/2]

void TapTempo::trigger ( bool  on)
inlineinherited

Definition at line 22 of file TapTempo.h.

◆ trigger() [2/2]

void TapTempo::trigger ( bool  on,
int  delay 
)
inlineinherited

Field Documentation

◆ ison

bool TapTempo::ison
protectedinherited

Definition at line 11 of file TapTempo.h.

Referenced by TapTempo::isOn(), and TapTempo::trigger().

◆ max_limit

const size_t TapTempo::max_limit
protectedinherited

Definition at line 8 of file TapTempo.h.

Referenced by adjustSpeed(), TapTempo::clock(), TapTempo::create(), and TapTempo::trigger().

◆ min_limit

const size_t TapTempo::min_limit
protectedinherited

Definition at line 7 of file TapTempo.h.

Referenced by adjustSpeed(), TapTempo::clock(), and TapTempo::trigger().

◆ range

float AdjustableTapTempo::range = 4
protected

Definition at line 108 of file TapTempo.h.

Referenced by adjustSpeed(), and setRange().

◆ samples

◆ speed

float AdjustableTapTempo::speed
protected

Definition at line 107 of file TapTempo.h.

Referenced by adjustSpeed(), and resetSpeed().

◆ sr

◆ trig

size_t TapTempo::trig
protectedinherited

Definition at line 10 of file TapTempo.h.

Referenced by TapTempo::clock(), and TapTempo::trigger().


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