forked from etternagame/etterna
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbeab31
commit 8e72ef8
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#pragma once | ||
#include <string> | ||
#include <array> | ||
#include <vector> | ||
|
||
#include "Etterna/Models/NoteData/NoteDataStructures.h" | ||
#include "Etterna/Globals/MinaCalc/PatternModHelpers.h" | ||
#include "IntervalHandInfo.h" | ||
#include "RMSequencing.h" | ||
|
||
using std::pair; | ||
using std::vector; | ||
|
||
static const CalcPatternMod _pmod = Balance; | ||
static const std::string name = "BalanceMod"; | ||
|
||
struct BalanceMod | ||
{ | ||
#pragma region params | ||
|
||
float min_mod = 0.95F; | ||
float max_mod = 1.05F; | ||
float mod_base = 0.325F; | ||
float buffer = 1.F; | ||
float scaler = 1.F; | ||
float other_scaler = 4.F; | ||
|
||
const vector<pair<std::string, float*>> _params{ | ||
{ "min_mod", &min_mod }, { "max_mod", &max_mod }, | ||
{ "mod_base", &mod_base }, { "buffer", &buffer }, | ||
{ "scaler", &scaler }, { "other_scaler", &other_scaler }, | ||
}; | ||
#pragma endregion params and param map | ||
|
||
float pmod = neutral; | ||
|
||
inline void full_reset() { pmod = neutral; } | ||
|
||
inline auto operator()(const ItvHandInfo& itvhi, | ||
vector<float> doot[], | ||
const int& i) -> float | ||
{ | ||
// nothing here | ||
if (itvhi.get_taps_nowi() == 0) { | ||
return neutral; | ||
} | ||
|
||
// same number of taps on each column | ||
if (itvhi.cols_equal_now()) { | ||
return min_mod; | ||
} | ||
|
||
// probably should NOT do this but leaving enabled for now so i can | ||
// verify structural changes dont change output diff | ||
// jack, dunno if this is worth bothering about? it would only matter | ||
// for tech and it may matter too much there? idk | ||
if (itvhi.get_col_taps_nowi(col_left) == 0 || | ||
itvhi.get_col_taps_nowi(col_right) == 0) { | ||
return max_mod; | ||
} | ||
|
||
pmod = itvhi.get_col_prop_low_by_high(); | ||
pmod = (mod_base + (buffer + (scaler / pmod)) / other_scaler); | ||
pmod = CalcClamp(pmod, min_mod, max_mod); | ||
|
||
doot[_pmod][i] = pmod; | ||
} | ||
}; |