Etterna 0.75.1
Loading...
Searching...
No Matches
OldJumpScaler.h
1#pragma once
2#include "../../PatternModHelpers.h"
3
6{
7 const CalcPatternMod _pmod = OldJumpScaler;
8 const std::string name = "OldJumpScalerMod";
9
10#pragma region params
11
12 float min_mod = 0.6F;
13 float max_mod = 1.1F;
14
15 float extra_divisor = 6.F;
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 pmod = neutral;
31 }
32
33#pragma endregion
34
35 void set_pmod(const metaItvInfo& mitvi)
36 {
37 const auto& itvhi = mitvi._itvi;
38
39 if (itvhi.total_taps == 0) {
40 pmod = neutral;
41 } else {
42
43 // goes up by N for how many notes per row
44 const auto taps = static_cast<float>(itvhi.total_taps);
45 // goes up by 2 for amount of jumps
46 const auto jumps = itvhi.taps_by_size.at(jump);
47
48 pmod = fastsqrt(fastsqrt(1 - (jumps / taps / extra_divisor)));
49 }
50 pmod = std::clamp(pmod, min_mod, max_mod);
51 }
52
53 auto operator()(const metaItvInfo& mitvi) -> float
54 {
55 set_pmod(mitvi);
56 return pmod;
57 }
58};
Agnostic downscaler based on how many jumps are in the interval.
Definition OldJumpScaler.h:6
Definition MetaIntervalInfo.h:20