Etterna 0.75.1
Loading...
Searching...
No Matches
OldAnchorScaler.h
1#pragma once
2#include "../MetaIntervalHandInfo.h"
3
6{
7 const CalcPatternMod _pmod = OldAnchorScaler;
8 const std::string name = "OldAnchorScalerMod";
9
10#pragma region params
11
12 float min_mod = 0.8F;
13 float max_mod = 1.05F;
14
15 float extra_divisor = 4.45F;
16
17 const std::vector<std::pair<std::string, float*>> _params{
18 { "min_mod", &min_mod },
19 { "max_mod", &max_mod },
20
21 { "extra_divisor", &extra_divisor },
22 };
23#pragma endregion params and param map
24
25 float pmod = neutral;
26
27#pragma region generic functions
28
29 void full_reset()
30 {
31 pmod = neutral;
32 }
33
34#pragma endregion
35
36 void set_pmod(const ItvHandInfo& itvhi)
37 {
38
39 if (itvhi.get_col_taps_nowi(col_left) == 0 ||
40 itvhi.get_col_taps_nowi(col_right) == 0) {
41 pmod = neutral;
42 } else {
43 const auto minval = std::min(itvhi.get_col_taps_nowf(col_left),
44 itvhi.get_col_taps_nowf(col_right));
45 const auto maxval = std::max(itvhi.get_col_taps_nowf(col_left),
46 itvhi.get_col_taps_nowf(col_right));
47 pmod = fastsqrt(1 - (minval / maxval / extra_divisor));
48 }
49
50 pmod = std::clamp(pmod, min_mod, max_mod);
51 }
52
53 auto operator()(const ItvHandInfo& itvhi) -> float
54 {
55 set_pmod(itvhi);
56 return pmod;
57 }
58
59};
accumulates hand specific info across an interval as it's processed by row
Definition IntervalHandInfo.h:6
auto get_col_taps_nowi(const col_type &ct) const -> int
access functions for col tap counts
Definition IntervalHandInfo.h:54
auto get_col_taps_nowf(const col_type &ct) const -> float
cast to float for divisioning and clean screen
Definition IntervalHandInfo.h:61
Hand downscaler based on how many notes are on either finger.
Definition OldAnchorScaler.h:6