10 const CalcPatternMod _pmod = WideRangeRoll;
11 const std::string name =
"WideRangeRollMod";
15 float window_param = 5.F;
17 float min_mod = 0.25F;
23 float cv_threshold = 0.35F;
24 float other_cv_threshold = 0.3F;
26 const std::vector<std::pair<std::string, float*>> _params{
27 {
"window_param", &window_param },
29 {
"min_mod", &min_mod },
30 {
"max_mod", &max_mod },
32 {
"scaler", &scaler },
34 {
"cv_reset", &cv_reset },
35 {
"cv_threshold", &cv_threshold },
36 {
"other_cv_threshold", &other_cv_threshold },
38#pragma endregion params and param map
48 bool last_passed_check =
false;
49 int nah_this_file_aint_for_real = 0;
51 float hi_im_a_float = 0.F;
54 std::vector<float> idk_ms = { 0.F, 0.F, 0.F, 0.F };
55 std::vector<float> seq_ms = { 0.F, 0.F, 0.F };
57 float moving_cv = cv_reset;
60#pragma region generic functions
67 last_passed_check =
false;
68 nah_this_file_aint_for_real = 0;
72 for (
auto& v : seq_ms) {
75 for (
auto& v : idk_ms) {
86 std::clamp(
static_cast<int>(window_param), 1, max_moving_window_size);
91 void zoop_the_woop(
const int& pos,
93 const float& scaler = 1.F)
96 last_passed_check = do_timing_thing(scaler);
100 void woop_the_zoop(
const int& pos,
102 const float& scaler = 1.F)
105 last_passed_check = do_timing_thing(scaler);
109 auto do_timing_thing(
const float& scaler) ->
bool
111 _mw_adj_ms(seq_ms[1]);
117 hi_im_a_float = cv(seq_ms);
120 if (hi_im_a_float < 0.12F) {
121 moving_cv = (hi_im_a_float + moving_cv + hi_im_a_float) / 3.F;
125 moving_cv = (hi_im_a_float + moving_cv) / 2.F;
128 return moving_cv < cv_threshold / scaler;
131 auto do_other_timing_thing(
const float& scaler) ->
bool
133 _mw_adj_ms(idk_ms[1]);
134 _mw_adj_ms(idk_ms[2]);
140 hi_im_a_float = cv(idk_ms);
143 if (hi_im_a_float < 0.12F) {
144 moving_cv = (hi_im_a_float + moving_cv + hi_im_a_float) / 3.F;
148 moving_cv = (hi_im_a_float + moving_cv) / 2.F;
151 return moving_cv < cv_threshold / scaler;
154 void handle_ccacc_timing_check() { zoop_the_woop(1, 2.5F, 1.25F); }
156 void handle_roll_timing_check()
158 if (any_ms_is_greater(seq_ms[1], seq_ms[0])) {
159 zoop_the_woop(1, 2.5F);
163 last_passed_check = do_timing_thing(1.F);
169 void handle_ccsjjscc_timing_check(
const float& now)
172 idk_ms[2] = seq_ms[0];
173 idk_ms[1] = seq_ms[1];
174 idk_ms[0] = seq_ms[2];
185 do_other_timing_thing(1.25F);
190 if (last_passed_check) {
198 do_other_timing_thing(1.25F);
206 if (nah_this_file_aint_for_real > 0) {
207 max_thingy = nah_this_file_aint_for_real > max_thingy
208 ? nah_this_file_aint_for_real
211 nah_this_file_aint_for_real = 0;
214 void bibblybop(
const meta_type& _last_mt)
217 if (_last_mt == meta_enigma) {
218 moving_cv = (moving_cv + hi_im_a_float) / 2.F;
219 }
else if (_last_mt == meta_meta_enigma) {
220 moving_cv = (moving_cv + hi_im_a_float + hi_im_a_float) / 3.F;
223 if (!last_passed_check) {
228 ++nah_this_file_aint_for_real;
235 if (_last_mt == meta_enigma) {
236 ++nah_this_file_aint_for_real;
240 if (_last_mt == meta_meta_enigma) {
241 nah_this_file_aint_for_real += 2;
245 void advance_sequencing(
const base_type& bt,
247 const meta_type& _last_mt,
253 update_seq_ms(bt, any_ms, tc_ms);
254 if (bt == base_single_jump || bt == base_jump_single) {
258 if (bt == base_jump_jump) {
261 if (nah_this_file_aint_for_real > 0) {
275 handle_roll_timing_check();
279 handle_ccacc_timing_check();
283 case meta_ccsjjscc_inverted:
284 handle_ccsjjscc_timing_check(any_ms);
292 case meta_meta_enigma:
293 case meta_unknowable_enigma:
305 void update_seq_ms(
const base_type& bt,
309 seq_ms[0] = seq_ms[1];
310 seq_ms[1] = seq_ms[2];
314 if (bt == base_single_single) {
331 if (itvhi.
get_taps_nowi() == 0 || itvhi.get_taps_windowi(window) == 0 ||
343 pmod = std::clamp(base + fastsqrt(pmod), min_mod, max_mod);
348 max_thingy = nah_this_file_aint_for_real > max_thingy
349 ? nah_this_file_aint_for_real
360 void interval_end() { max_thingy = 0; }