aboutsummaryrefslogtreecommitdiff
path: root/dfx-library/TempoRateTable.h
blob: 00f8cc723c1be465d7d6ca130fb9b0acc2c326fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __TempoRateTable
#define __TempoRateTable


//--------------------------------------------------------------------------
// the number of tempo beat division options
#ifdef USE_SLOW_TEMPO_RATES
	#define NUM_TEMPO_RATES 25
#else
	#ifdef USE_BUFFER_OVERRIDE_TEMPO_RATES
		#define NUM_TEMPO_RATES 21
	#else
		#define NUM_TEMPO_RATES 24
	#endif
#endif



//-------------------------------------------------------------------------- 
// this holds the beat scalar values & textual displays for the tempo rates
class TempoRateTable
{
public:
	TempoRateTable();
	~TempoRateTable();

	float getScalar(float paramValue)
		{	return scalars[float2index(paramValue)];	}
	char * getDisplay(float paramValue)
		{	return displays[float2index(paramValue)];	}

protected:
	int float2index(float f)
	{
		if (f < 0.0f)
			f = 0.0f;
		else if (f > 1.0f)
			f = 1.0f;
		return (int) (f * ((float)NUM_TEMPO_RATES-0.9f));
	}
		
	float *scalars;
	char **displays;
};


#endif