Bugfixes in mod translations.

master
Albert Graef 2018-09-05 04:52:12 +02:00
parent b56cd35b80
commit 8f9d1a4ae8
2 changed files with 7 additions and 7 deletions

View File

@ -225,7 +225,7 @@ send_midi(uint8_t portno, int status, int data,
}
msg[1] = cpvalue[chan];
} else if (mod) {
int v = datavals(swap?val%mod:val/mod, step, steps, n_steps);
int v = datavals(swap?val/mod:val%mod, step, steps, n_steps);
if (v > 127 || v < 0) return;
msg[1] = v;
} else if (!index) {
@ -252,9 +252,9 @@ send_midi(uint8_t portno, int status, int data,
}
pbval = pbvalue[chan];
} else if (mod) {
int v = datavals(swap?val%mod:val/mod, step, steps, n_steps);
if (v > 8191 || v < -8192) return;
pbval = 8192+v;
int v = datavals(swap?val/mod:val%mod, step, steps, n_steps);
if (v > 16383 || v < 0) return;
pbval = v;
} else if (!index) {
pbval = 8192+dataval(step, -8192, 8191);
} else {
@ -270,7 +270,7 @@ send_midi(uint8_t portno, int status, int data,
}
case 0xc0:
if (mod) {
int d = msg[1] + datavals(swap?val/mod:val%mod, mod_step, mod_steps, mod_n_steps);
int d = msg[1] + datavals(swap?val%mod:val/mod, mod_step, mod_steps, mod_n_steps);
if (d > 127 || d < 0) return;
msg[1] = d;
}
@ -1448,7 +1448,7 @@ handle_event(uint8_t *msg, uint8_t portno, int depth, int recursive)
start_debug();
//fprintf(stderr, "pb %d\n", bend);
if (get_pb_mod(tr, portno, chan)) {
send_strokes(tr, portno, status, chan, 0, bend, 0, 0, depth);
send_strokes(tr, portno, status, chan, 0, bend+8192, 0, 0, depth);
end_debug();
break;
}

View File

@ -714,7 +714,7 @@ print_stroke(stroke *s, int mod, int step, int n_steps, int *steps, int val)
case 0xe0:
if (mod) {
int v = datavals(s->swap?val/mod:val%mod, s->step, s->steps, s->n_steps);
printf("PB[%d]-%d%s ", v, channel, suffix);
printf("PB[%d]-%d%s ", v-8192, channel, suffix);
} else if (s->steps) {
printf("PB{");
for (int i = 0; i < s->n_steps; i++)