Skip to content

Commit

Permalink
move balance mod
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jun 7, 2020
1 parent dbeab31 commit 8e72ef8
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions src/Etterna/Globals/MinaCalc/Dependent/BalanceMod.h
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;
}
};

0 comments on commit 8e72ef8

Please sign in to comment.