Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
feature(kria): apply temporary adjustment to single scale steps
- Loading branch information
Showing
with
19 additions
and
5 deletions.
-
+19
−5
src/ansible_grid.c
|
|
@@ -58,6 +58,7 @@ uint8_t meta; |
|
|
uint8_t scale_data[16][8]; |
|
|
|
|
|
u8 cur_scale[8]; |
|
|
int8_t scale_adj[8]; |
|
|
void calc_scale(uint8_t s); |
|
|
|
|
|
void (*grid_refresh)(void); |
|
|
@@ -813,7 +814,7 @@ void clock_kria_note(kria_track* track, uint8_t trackNum) { |
|
|
static void kria_set_note(uint8_t trackNum) { |
|
|
u8 noteInScale = (note[trackNum] + alt_note[trackNum]) % 7; // combine both note params |
|
|
u8 octaveBump = (note[trackNum] + alt_note[trackNum]) / 7; // if it wrapped around the octave, bump it |
|
|
dac_set_value(trackNum, ET[cur_scale[noteInScale] + ((oct[trackNum]+octaveBump) * 12)] << 2); |
|
|
dac_set_value(trackNum, ET[(int)cur_scale[noteInScale] + scale_adj[noteInScale] + (int)((oct[trackNum]+octaveBump) * 12)] << 2); |
|
|
} |
|
|
|
|
|
void clock_kria_track( uint8_t trackNum ) { |
|
|
@@ -2170,7 +2171,17 @@ void handler_KriaGridKey(s32 data) { |
|
|
k.p[k.pattern].scale = (y - 5) * 8 + x; |
|
|
} |
|
|
else { |
|
|
scale_data[k.p[k.pattern].scale][6-y] = x-8; |
|
|
uint8_t i; |
|
|
for (i = 0; i < key_count; i++) { |
|
|
if (held_keys[i] == 16*y + scale_data[k.p[k.pattern].scale][6 - y] + 8) { |
|
|
scale_adj[6 - y] = x - 8 - scale_data[k.p[k.pattern].scale][6 - y]; |
|
|
break; |
|
|
} |
|
|
} |
|
|
if (i == key_count) { |
|
|
scale_data[k.p[k.pattern].scale][6-y] = x-8; |
|
|
scale_adj[6 - y] = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
calc_scale(k.p[k.pattern].scale); |
|
|
@@ -2858,13 +2869,16 @@ void refresh_kria_scale(void) { |
|
|
monomeLedBuffer[R5 + (k.p[k.pattern].scale >> 3) * 16 + (k.p[k.pattern].scale & 0x7)] = L1; |
|
|
|
|
|
// the intervals of the selected scale |
|
|
for(uint8_t i=0;i<7;i++) |
|
|
monomeLedBuffer[scale_data[k.p[k.pattern].scale][i] + 8 + (6-i)*16] = L1; |
|
|
for(uint8_t i=0;i<7;i++) { |
|
|
uint8_t scale_pos = scale_data[k.p[k.pattern].scale][i] + 8 + (6-i)*16; |
|
|
monomeLedBuffer[(int)scale_pos + scale_adj[i]] = L0; |
|
|
monomeLedBuffer[scale_pos] = L1; |
|
|
} |
|
|
|
|
|
// if an active step of a track is playing a note, it brightness is incremented by one |
|
|
for(uint8_t i=0;i<4;i++) { |
|
|
if(k.p[k.pattern].t[i].tr[pos[i][mTr]]) |
|
|
monomeLedBuffer[scale_data[k.p[k.pattern].scale][note[i]] + 8 + (6-note[i])*16]++; |
|
|
monomeLedBuffer[scale_data[k.p[k.pattern].scale][note[i]] + 8 + scale_adj[note[i]] + (6-note[i])*16]++; |
|
|
} |
|
|
} |
|
|
|
|
|
|