New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual device #41

Merged
merged 122 commits into from Oct 2, 2017
Commits
Jump to file or symbol
Failed to load files and symbols.
+7 −4
Diff settings

Always

Just for now

Viewing a subset of changes. View all

mikromk2: rework velocity mapping to be flatter

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
  • Loading branch information...
harryhaaren committed Sep 1, 2017
commit b226ce1c4b96998d126b8d8c4c3132273971d751
@@ -222,11 +222,11 @@ static uint32_t ni_maschine_mikro_mk2_poll(struct ctlra_dev_t *base)
if(dev->pad_avg[i] > 200 && dev->pads[i] == 0) {
/* detect velocity over limit */
float velo = (dev->pad_avg[i] - 200) / 200.f;
float v2 = velo * velo;
float fin = (velo - v2);
float v2 = velo * velo * velo * velo;
float fin = (velo - v2) * 3;
fin = fin > 1.0f ? 1.0f : fin;
fin = fin < 0.0f ? 0.0f : fin;
//printf("\nfin: %f\tvelo: %f\tv2: %f\n", fin, velo, v2);
printf("\nfin: %f\tvelo: %f\tv2: %f\n", fin, velo, v2);
e->grid.pressure = fin;
dev->base.event_func(&dev->base, 1, &e,
dev->base.event_func_userdata);
View
@@ -58,12 +58,15 @@ void demo_event_func(struct ctlra_dev_t* dev,
case CTLRA_EVENT_GRID:
msg[0] = e->grid.pressed ? 0x90 : 0x80;
msg[1] = e->grid.pos + 36; /* GM kick drum note */
msg[2] = e->grid.pressed ? 0x70 : 0;
msg[2] = e->grid.pressed ?
e->grid.pressure * 127 : 0;
ret = ctlra_midi_output_write(midi, 3, msg);
break;
default:
break;
};
// TODO: Error check midi writes
(void) ret;
}
}
ProTip! Use n and p to navigate between commits in a pull request.