17 hands current_hand = left_hand;
20 col_type left_hand_state = col_init;
23 col_type right_hand_state = col_init;
25 trillnario current_scenario = the_lack_thereof;
32 int trills_in_interval = 0;
36 float cv_threshold = 0.5F;
38 unsigned last_notes = 0b0000;
39 unsigned last_last_notes = 0b0000;
42 bool two_hand_jump(
const unsigned& notes) {
43 return ((notes & 0b1100) != 0U) && ((notes & 0b0011) != 0U);
47 void process(
const float& ms_now,
const unsigned& notes) {
50 col_type notes_coltype;
51 const unsigned prev_notes = last_notes;
52 const unsigned prev_prev_notes = last_last_notes;
53 last_last_notes = last_notes;
56 if (two_hand_jump(notes)) {
57 if (two_hand_jump(prev_notes)) {
62 if (two_hand_jump(prev_prev_notes)) {
68 if ((notes & 0b1111) == 0b1111) {
72 }
else if ((notes & 0b1100) == 0b1100) {
75 notes_hand = left_hand;
76 notes_coltype = col_ohjump;
77 }
else if ((notes & 0b0011) == 0b0011) {
80 notes_hand = right_hand;
81 notes_coltype = col_ohjump;
84 if (((notes & prev_prev_notes) != 0U) && ((notes & prev_notes) == 0U)) {
89 const unsigned ppn = notes & prev_prev_notes;
90 if ((ppn & 0b1100) != 0U) {
91 notes_hand = left_hand;
92 notes_coltype = determine_col_type(notes, 0b1100);
93 }
else if ((ppn & 0b0011) != 0U) {
94 notes_hand = right_hand;
95 notes_coltype = determine_col_type(notes, 0b0011);
108 }
else if ((notes & 0b1100) != 0) {
109 notes_hand = left_hand;
110 notes_coltype = determine_col_type(notes, 0b1100);
111 }
else if ((notes & 0b0011) != 0) {
112 notes_hand = right_hand;
113 notes_coltype = determine_col_type(notes, 0b0011);
121 switch (current_scenario) {
122 case the_lack_thereof: {
124 current_hand = notes_hand;
125 set_hand_states(notes_coltype);
126 current_scenario = need_opposite;
129 case need_opposite: {
130 if (current_hand == notes_hand) {
134 if (notes_coltype == col_ohjump) {
137 if (current_hand == left_hand) {
138 if (right_hand_state == col_init ||
139 right_hand_state == notes_coltype) {
140 right_hand_state = notes_coltype;
147 right_hand_state = notes_coltype;
148 current_scenario = need_opposite;
151 if (left_hand_state == col_init ||
152 left_hand_state == notes_coltype) {
153 left_hand_state = notes_coltype;
160 left_hand_state = notes_coltype;
161 current_scenario = need_opposite;
172 void set_hand_states(col_type coltype)
174 if (current_hand == left_hand) {
175 left_hand_state = coltype;
177 right_hand_state = coltype;
181 bool calc_trill(
const float& ms_now)
183 const int window = std::min(
cur_length, max_moving_window_size);
192 trills_in_interval = 0;
196 current_scenario = the_lack_thereof;
197 left_hand_state = col_init;
198 right_hand_state = col_init;
200 last_last_notes = 0b0000;
206 current_scenario = the_lack_thereof;
207 left_hand_state = col_init;
208 right_hand_state = col_init;
210 last_last_notes = 0b0000;