39constexpr std::array<GridPoint, kNumCalibrationPoints> kCalibrationPoints{{{7, 4}, {0, 7}, {15, 7}, {0, 0}, {15, 0}}};
46 static constexpr int32_t
kWidth = 18;
47 static constexpr int32_t kHeight = 8;
48 using PointLevels = std::array<float, kNumCalibrationPoints>;
50 Calibration() =
default;
51 Calibration(PointLevels
const&
softDb, PointLevels
const& hardDb);
54 [[nodiscard]] PointLevels
const&
softDb()
const {
return softDb_; }
55 [[nodiscard]] PointLevels
const& hardDb()
const {
return hardDb_; }
58 [[nodiscard]]
float softAt(int32_t x, int32_t y)
const {
return softAt_[clampY(y)][clampX(x)]; }
59 [[nodiscard]]
float hardAt(int32_t x, int32_t y)
const {
return hardAt_[clampY(y)][clampX(x)]; }
62 static int32_t clampX(int32_t x) {
return x < 0 ? 0 : (x >=
kWidth ?
kWidth - 1 : x); }
63 static int32_t clampY(int32_t y) {
return y < 0 ? 0 : (y >= kHeight ? kHeight - 1 : y); }
65 PointLevels softDb_{};
66 PointLevels hardDb_{};
67 std::array<std::array<float, kWidth>, kHeight> softAt_{};
68 std::array<std::array<float, kWidth>, kHeight> hardAt_{};
73 static constexpr int32_t kMinShape = -50;
74 static constexpr int32_t kMaxShape = 50;
97constexpr float kMinRangeDb = 6.f;
100TapCheck checkPoint(std::array<float, 2>
const& softDb, std::array<float, 2>
const& hardDb,
float* softOut,
Definition velocity_map.h:43
float softAt(int32_t x, int32_t y) const
A pad's soft and hard levels: the points' weighted by closeness (exact on one).
Definition velocity_map.h:58
static constexpr int32_t kWidth
Every pad, the sidebar included (the audition pads are its right-hand column).
Definition velocity_map.h:46
PointLevels const & softDb() const
The calibrated points' levels (what's saved).
Definition velocity_map.h:54
Definition delay_finder.cpp:21
constexpr int32_t kNumCalibrationPoints
The pads calibrated, in the order they're tapped.
Definition velocity_map.h:38
TapCheck checkPoint(std::array< float, 2 > const &softDb, std::array< float, 2 > const &hardDb, float *softOut, float *hardOut)
Checks a point's taps and, if they're fine, gives its soft and hard levels (each the mean of its two,...
Definition velocity_map.cpp:67
constexpr float kMaxTapSpreadDb
Two taps of the same strength have to come within this of each other, and hard has to beat soft by th...
Definition velocity_map.h:96
uint8_t velocityFor(Calibration const &calibration, VelocityCurve const &curve, int32_t x, int32_t y, float levelDb)
The velocity (1-127) a thump of levelDb plays at on pad (x, y).
Definition velocity_map.cpp:54
TapCheck
Checking a calibration point's taps (two soft, two hard).
Definition velocity_map.h:88
@ TOO_CLOSE
Soft and hard came out too alike: the whole point again.
Definition velocity_map.h:92
@ SOFT_UNEVEN
The two soft taps are too far apart: tap soft again.
Definition velocity_map.h:90
@ HARD_UNEVEN
The two hard taps are too far apart: tap hard again.
Definition velocity_map.h:91
Definition velocity_map.h:32
How tap strength maps onto velocity (the settings).
Definition velocity_map.h:72
uint8_t minVelocity
What the softest calibrated tap (and anything softer) plays at.
Definition velocity_map.h:76
uint8_t maxVelocity
Definition velocity_map.h:77
int8_t shape
Definition velocity_map.h:80