8 const CalcPatternMod _pmod = { WideRangeJJ };
9 const std::string name =
"WideRangeJJMod";
13 float window_param = 3.F;
16 float jj_required = 30.F;
18 float min_mod = 0.25F;
20 float total_scaler = 2.5F;
21 float cur_interval_tap_scaler = 1.2F;
28 float ms_threshold = 0.065F;
31 float calming_comp = 0.05F;
37 float diff_falloff_power = 6.F;
39 const std::vector<std::pair<std::string, float*>> _params{
40 {
"intervals_to_consider", &window_param },
41 {
"jumpjacks_required_in_combined_window", &jj_required },
42 {
"jumpjack_total_scaler", &total_scaler },
43 {
"cur_interval_tap_scaler", &cur_interval_tap_scaler },
45 {
"min_mod", &min_mod },
46 {
"max_mod", &max_mod },
47 {
"calming_comp", &calming_comp },
49 {
"ms_threshold", &ms_threshold },
50 {
"diff_falloff_power", &diff_falloff_power },
52#pragma endregion params and param map
66 float current_problems = 0.F;
67 float max_interval_problems = 0.F;
72 std::array<float, max_rows_for_single_interval> _left_times{};
73 std::array<float, max_rows_for_single_interval> _right_times{};
75#pragma region generic functions
79 _mw_max_problems.
zero();
80 _left_times.fill(s_init);
81 _right_times.fill(s_init);
82 current_problems = 0.F;
83 max_interval_problems = 0.F;
93 std::clamp(
static_cast<int>(window_param), 1, max_moving_window_size);
105 auto jumpJacking =
false;
107 auto failedRight = 0;
108 while (lindex < lc && rindex < rc) {
109 const auto& l = _left_times.at(lindex);
110 const auto& r = _right_times.at(rindex);
111 const auto diff = fabsf(l - r);
113 if (diff < ms_threshold) {
119 current_problems = 0.F;
128 const auto x = std::pow(diff / std::max(ms_threshold, 0.00001F),
130 const auto v = 1 + (x / (x - 2));
131 current_problems += v;
132 if (current_problems > max_interval_problems) {
133 max_interval_problems = current_problems;
157 if (failedLeft || failedRight) {
167 void advance_sequencing(
const col_type& ct,
170 if (lc >= max_rows_for_single_interval ||
171 rc >= max_rows_for_single_interval) {
179 _left_times.at(lc++) = time_s;
183 _right_times.at(rc++) = time_s;
187 _left_times.at(lc++) = time_s;
188 _right_times.at(rc++) = time_s;
198 const auto taps_in_window =
200 const auto problems_in_window =
204 if (taps_in_window == 0.F || problems_in_window < jj_required) {
207 pmod = fastsqrt(pmod + std::clamp(calming_comp, 0.F, 1.F));
209 pmod = taps_in_window / problems_in_window * 0.75F;
212 pmod = std::clamp(pmod, min_mod, max_mod);
218 _mw_max_problems(max_interval_problems);
229 current_problems = 0.F;
230 max_interval_problems = 0.F;
231 _left_times.fill(s_init);
232 _right_times.fill(s_init);
auto get_taps_windowf(const int &window) const -> float
cast to float for divisioning and clean screen
Definition IntervalHandInfo.h:153