Etterna 0.74.4
Loading...
Searching...
No Matches
TheThingFinder.h
1#pragma once
2#include "../../PatternModHelpers.h"
3#include "../HA_Sequencers/ThingSequencing.h"
4
12{
13 const CalcPatternMod _pmod = TheThing;
14 const std::string name = "TheThingMod";
15
16#pragma region params
17
18 float min_mod = 0.15F;
19 float max_mod = 1.F;
20 float base = 0.05F;
21
22 // params for tt_sequencing
23 float group_tol = 35.F;
24 float step_tol = 17.5F;
25 float scaler = 0.2F;
26
27 const std::vector<std::pair<std::string, float*>> _params{
28 { "min_mod", &min_mod },
29 { "max_mod", &max_mod },
30 { "base", &base },
31
32 //{ "group_tol", &group_tol },
33 //{ "step_tol", &step_tol },
34 { "scaler", &scaler },
35 };
36#pragma endregion params and param map
37
38 // sequencer
40 float pmod = min_mod;
41
42#pragma region generic functions
43 void setup() { tt.set_params(group_tol, step_tol, scaler); }
44
45#pragma endregion
46
47 void advance_sequencing(const float& ms_now, const unsigned& notes)
48 {
49 tt(ms_now, notes);
50 }
51
52 auto operator()() -> float
53 {
54 pmod =
55 tt.mod_parts[0] + tt.mod_parts[1] + tt.mod_parts[2] + tt.mod_parts[3];
56 pmod /= 4.F;
57 pmod = std::clamp(base + pmod, min_mod, max_mod);
58
59 // reset flags n stuff
60 tt.reset();
61
62 return pmod;
63 }
64};
65
73{
74 const CalcPatternMod _pmod = TheThing2;
75 const std::string name = "TheThing2Mod";
76
77#pragma region params
78
79 float min_mod = 0.15F;
80 float max_mod = 1.F;
81 float base = 0.05F;
82
83 // params for tt_sequencing
84 float group_tol = 35.F;
85 float step_tol = 17.5F;
86 float scaler = 0.2F;
87
88 const std::vector<std::pair<std::string, float*>> _params{
89 { "min_mod", &min_mod },
90 { "max_mod", &max_mod },
91 { "base", &base },
92
93 //{ "group_tol", &group_tol },
94 //{ "step_tol", &step_tol },
95 { "scaler", &scaler },
96 };
97#pragma endregion params and param map
98
99 // sequencer
100 TT_Sequencing2 tt2;
101 float pmod = min_mod;
102
103#pragma region generic functions
104 void setup() { tt2.set_params(group_tol, step_tol, scaler); }
105
106#pragma endregion
107
108 void advance_sequencing(const float& ms_now, const unsigned& notes)
109 {
110 tt2(ms_now, notes);
111 }
112
113 auto operator()() -> float
114 {
115 pmod = tt2.mod_parts[0] + tt2.mod_parts[1] + tt2.mod_parts[2] +
116 tt2.mod_parts[3];
117 pmod /= 4.F;
118 pmod = std::clamp(base + pmod, min_mod, max_mod);
119
120 // reset flags n stuff
121 tt2.reset();
122
123 return pmod;
124 }
125};
Definition ThingSequencing.h:314
Definition ThingSequencing.h:233
Definition TheThingFinder.h:73
Definition TheThingFinder.h:12