Skip to content

Commit

Permalink
redirect AUX callbacks to their rotaries. FIXME: O(n), inefficient an…
Browse files Browse the repository at this point in the history
…d ugly.
  • Loading branch information
nettings committed Mar 8, 2019
1 parent c5189dc commit f99e904
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static void shutdown(int sig)

void update(control_t* c, int delta)
{
DBG("update: delta = %d", delta);
switch (c->type) {
case ROTARY:
case AUX:
Expand Down Expand Up @@ -198,7 +199,18 @@ void update(control_t* c, int delta)
void handle_gpi(int line, int delta)
{
control_t *c = controller[line];
update(c, delta);
if (c->type == AUX) {
// redirect to its rotary:
for (int i=0; i < NCONTROLLERS; i++) {
if (controller[i] == NULL) continue;
if (controller[i]->pin2 == line) {
update(controller[i], delta);
break;
}
}
} else {
update(c, delta);
}
}

void handle_osc(control_t *c, int delta) {
Expand Down

0 comments on commit f99e904

Please sign in to comment.