FastLED 3.9.15
Loading...
Searching...
No Matches

◆ MapDecayTime()

float MapDecayTime ( uint8_t key_idx)

Definition at line 34 of file util.cpp.

34 {
35 typedef InterpData<uint8_t, float> Datum;
36 static const float bias = 1.3f;
37 // key then time for decay in milliseconds.
38 // First value is the KEY on the keyboard, second value is the
39 // time. The KEY must be IN ORDER or else the algorithm will fail.
40 static const Datum kInterpData[] = {
41 Datum(0, 21.0f * 1000.0f * bias),
42 Datum(11, 19.4 * 1000.0f * bias),
43 Datum(22, 15.1f * 1000.0f * bias),
44 Datum(35, 12.5f * 1000.0f * bias),
45 Datum(44, 10.f * 1000.0f * bias),
46 Datum(50, 8.1f * 1000.0f * bias),
47 Datum(53, 5.3f * 1000.0f * bias),
48 Datum(61, 4.0f * 1000.0f * bias),
49 Datum(66, 5.0f * 1000.0f * bias),
50 Datum(69, 4.6f * 1000.0f * bias),
51 Datum(70, 4.4f * 1000.0f * bias),
52 Datum(71, 4.3f * 1000.0f * bias),
53 Datum(74, 3.9f * 1000.0f * bias),
54 Datum(80, 1.9f * 1000.0f * bias),
55 Datum(81, 1.8f * 1000.0f * bias),
56 Datum(82, 1.7f * 1000.0f * bias),
57 Datum(83, 1.5f * 1000.0f * bias),
58 Datum(84, 1.3f * 1000.0f * bias),
59 Datum(86, 1.0f * 1000.0f * bias),
60 Datum(87, 0.9f * 1000.0f * bias),
61 };
62
63 static const int n = sizeof(kInterpData) / sizeof(kInterpData[0]);
64 float approx_val = Interp(key_idx, kInterpData, n);
65 return approx_val;
66}
ValT Interp(const KeyT &k, const InterpData< KeyT, ValT > *array, const int n)

References Interp().

Referenced by CalcDecayFactor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: