Etterna 0.74.4
Loading...
Searching...
No Matches
Balance.h
1#pragma once
2#include "../IntervalHandInfo.h"
3
8{
9 const CalcPatternMod _pmod = Balance;
10 const std::string name = "BalanceMod";
11
12#pragma region params
13
14 float min_mod = 0.95F;
15 float max_mod = 1.05F;
16 float mod_base = 0.325F;
17 float buffer = 1.F;
18 float scaler = 1.F;
19 float other_scaler = 4.F;
20
21 const std::vector<std::pair<std::string, float*>> _params{
22 { "min_mod", &min_mod }, { "max_mod", &max_mod },
23 { "mod_base", &mod_base }, { "buffer", &buffer },
24 { "scaler", &scaler }, { "other_scaler", &other_scaler },
25 };
26#pragma endregion params and param map
27
28 float pmod = neutral;
29
30 void full_reset() { pmod = neutral; }
31
32 auto operator()(const ItvHandInfo& itvhi) -> float
33 {
34 // nothing here
35 if (itvhi.get_taps_nowi() == 0) {
36 return neutral;
37 }
38
39 // same number of taps on each column
40 if (itvhi.cols_equal_now()) {
41 return min_mod;
42 }
43
44 // probably should NOT do this but leaving enabled for now so i can
45 // verify structural changes dont change output diff
46 // jack, dunno if this is worth bothering about? it would only matter
47 // for tech and it may matter too much there? idk
48 if (itvhi.get_col_taps_nowi(col_left) == 0 ||
49 itvhi.get_col_taps_nowi(col_right) == 0) {
50 return max_mod;
51 }
52
53 pmod = itvhi.get_col_prop_low_by_high();
54 pmod = (mod_base + (buffer + (scaler / pmod)) / other_scaler);
55 pmod = std::clamp(pmod, min_mod, max_mod);
56
57 return pmod;
58 }
59};
Definition Balance.h:8
accumulates hand specific info across an interval as it's processed by row
Definition IntervalHandInfo.h:6
auto get_taps_nowi() const -> int
access functions for hand tap counts
Definition IntervalHandInfo.h:135
auto get_col_taps_nowi(const col_type &ct) const -> int
access functions for col tap counts
Definition IntervalHandInfo.h:54
auto cols_equal_now() const -> bool
col operations
Definition IntervalHandInfo.h:84