14 const CalcPatternMod _pmod = HandSwitch;
15 const std::string name =
"HandSwitchMod";
20 float mod_base = 0.6F;
24 float prop_buffer = 0.0F;
25 float prop_scaler = 0.67F;
27 float influence_center = 0.5F;
28 float influence_external = 0.45F;
29 float influence_length = 0.25F;
31 float length_cap = 1.0F;
33 const std::vector<std::pair<std::string, float*>> _params {
34 {
"min_mod", &min_mod },
35 {
"max_mod", &max_mod },
36 {
"mod_base", &mod_base },
40 {
"prop_buffer", &prop_buffer },
41 {
"prop_scaler", &prop_scaler },
43 {
"influence_center", &influence_center },
44 {
"influence_external", &influence_external },
45 {
"influence_length", &influence_length },
47 {
"length_cap", &length_cap },
50 #pragma endregion params and param map
52 float last_mod = min_mod;
66 void reset_and_decay()
68 pmod = std::clamp(last_mod - decay, min_mod, max_mod);
76 void advance_sequencing(
const float& ms_now,
const unsigned& notes)
84 if ((notes & 0b11) >= 0b11 && (notes & 0b11000) >= 0b11000)
89 if (notes == _last && notes != 0b00100)
97 if ((notes & 0b11) && (notes & 0b11000))
106 if (_length == 0) _length++;
110 if (notes & 0b11011) _nm++;
113 if (_eml > 0 && _length > 0)
139 if (mitvghi.total_taps == 0)
150 float c = _om * influence_center;
151 float x = _nm * influence_external;
152 float m = (1 + std::clamp(influence_length * _length, 0.F, length_cap)) * (c + x) / std::max(_length, 1);
154 _value = prop_scaler * m + prop_buffer;
155 _value = std::max(_value, .0F);
157 pmod = std::clamp(mod_base + _value, min_mod, max_mod);