Etterna 0.74.4
Loading...
Searching...
No Matches
MetaRowInfo.h
1#pragma once
2#include "HA_Sequencing.h"
3#include "MetaIntervalInfo.h"
4#include "../SequencingHelpers.h"
5
8{
9 static const bool dbg = false;
10 static const bool dbg_lv2 = false;
11
12 float time = s_init;
13 // time from last row (ms)
14 float ms_now = ms_init;
15 int count = 0;
16 int last_count = 0;
17 int last_last_count = 0;
18 unsigned notes = 0;
19 unsigned last_notes = 0;
20 unsigned last_last_notes = 0;
21
22 // per row bool flags, these must be directly set every row
23 bool alternating_chordstream = false;
24 bool alternating_chord_single = false;
25 bool gluts_maybe = false; // not really used/tested yet
26 bool twas_jack = false;
27
28 Calc& _calc;
29
30 explicit metaRowInfo(Calc& calc)
31 : _calc(calc)
32 {
33
34 }
35
36 void reset()
37 {
38 time = s_init;
39 ms_now = ms_init;
40 count = 0;
41 last_count = 0;
42 last_last_count = 0;
43 notes = 0;
44 last_notes = 0;
45 last_last_notes = 0;
46
47 alternating_chordstream = false;
48 alternating_chord_single = false;
49 gluts_maybe = false;
50 twas_jack = false;
51 }
52
53 void set_row_variations(metaItvInfo& mitvi) const
54 {
55 // already determined there's enough variation in this interval
56 if (!mitvi.basically_vibro) {
57 return;
58 }
59
60 // trying to fill array with up to 3 unique row_note configurations
61 for (auto& t : mitvi.row_variations) {
62 // already a stored value here
63 if (t != 0) {
64 // already have one of these
65 if (t == notes) {
66 return;
67 }
68 } else if (t == 0) {
69 // nothing stored here and isn't a duplicate, store it and
70 // iterate num_var
71 t = notes;
72 ++mitvi.num_var;
73
74 // check if we filled the array with unique values. since we
75 // start by assuming anything is basically vibro, set the flag
76 // to false if it is
77 if (mitvi.row_variations[2] != 0) {
78 mitvi.basically_vibro = false;
79 }
80 return;
81 }
82 }
83 }
84
85 // scan for jacks and jack counts between this row and the last
86 void jack_scan(metaItvInfo& mitvi)
87 {
88 twas_jack = false;
89
90 for (const auto& id : _calc.col_masks) {
91 if (is_jack_at_col(id, notes, last_notes)) {
92 // not scaled to the number of jacks anymore
93 ++mitvi.actual_jacks;
94 twas_jack = true;
95 // try to pick up gluts maybe?
96 if (count > 1 && column_count(last_notes) > 1) {
97 ++mitvi.shared_chord_jacks;
98 }
99 }
100 }
101
102 // if we used the normal actual_jack for CJ too we're saying something
103 // like "chordjacks" are harder if they share more columns from chord to
104 // chord" which is not true, it is in fact either irrelevant or the
105 // inverse depending on the scenario, this is merely to catch stuff like
106 // splithand jumptrills registering as chordjacks when they shouldn't be
107 if (twas_jack) {
108 ++mitvi.actual_jacks_cj;
109 }
110 }
111
112 void basic_row_sequencing(const metaRowInfo& last, metaItvInfo& mitvi)
113 {
114 jack_scan(mitvi);
115 set_row_variations(mitvi);
116
117 // check if we have a bunch of stuff like [123]4[123] [12]3[124] which
118 // isn't actually chordjack, its just broken hs/js, and in fact with the
119 // level of leniency that is currently being applied to generic
120 // proportions, lots of heavy js/hs is being counted as cj for their 2nd
121 // rating, and by a close margin too, we can't just look for [123]4, we
122 // need to finish the sequence to be sure i _think_ we only want to do
123 // this for single notes, we could abstract it to a more generic pattern
124 // template, but let's be restrictive for now
125 alternating_chordstream =
126 is_alternating_chord_stream(notes, last_notes, last.last_notes);
127 if (alternating_chordstream) {
128 ++mitvi.definitely_not_jacks;
129 }
130
131 if (alternating_chordstream) {
132 // put mixed density stuff here later
133 }
134
135 // only cares about single vs chord, not jacks
136 alternating_chord_single =
137 is_alternating_chord_single(count, last.count);
138 if (alternating_chord_single) {
139 if (!twas_jack) {
140 mitvi.seriously_not_js -= 3;
141 }
142 }
143
144 if (last.count == 1 && count == 1) {
145 mitvi.seriously_not_js =
146 0 > mitvi.seriously_not_js ? 0 : mitvi.seriously_not_js;
147 ++mitvi.seriously_not_js;
148
149 // light js really stops at [12]321[23] kind of
150 // density, anything below that should be picked up
151 // by speed, and this stop rolls between jumps
152 // getting floated up too high
153 if (mitvi.seriously_not_js > 3) {
154
155 mitvi.not_js += mitvi.seriously_not_js;
156 // give light hs the light js treatment
157 mitvi.not_hs += mitvi.seriously_not_js;
158 }
159 } else if (last.count > 1 && count > 1) {
160 // suppress jumptrilly garbage a little bit
161 mitvi.not_hs += count;
162 mitvi.not_js += count;
163
164 // might be overkill
165 if ((notes & last_notes) == 0) {
166 ++mitvi.not_hs;
167 ++mitvi.not_js;
168 } else {
169 gluts_maybe = true;
170 }
171 }
172
173 // if the previous 3 rows do not form any jacks
174 // and the current and previous rows are chords
175 if ((notes & last_notes) == 0 && count > 1 && last_count > 1) {
176 if ((last_notes & last.last_notes) == 0 && last_count > 1) {
177 mitvi.dunk_it = true;
178 }
179 }
180 }
181
182 void operator()(const metaRowInfo& last,
183 metaItvInfo& mitvi,
184 const float& row_time,
185 const int& row_count,
186 const unsigned& row_notes)
187 {
188 time = row_time;
189 last_last_count = last.last_count;
190 last_count = last.count;
191 count = row_count;
192
193 last_last_notes = last.last_notes;
194 last_notes = last.notes;
195 notes = row_notes;
196
197 ms_now = ms_from(time, last.time);
198
199 mitvi._itvi.update_tap_counts(count);
200 basic_row_sequencing(last, mitvi);
201 }
202};
Main driver class for the difficulty calculator as a whole.
Definition MinaCalc.h:82
Definition MetaIntervalInfo.h:20
counterpart to metahandinfo
Definition MetaRowInfo.h:8