diff options
Diffstat (limited to 'apps/dolmetschctl.c')
-rw-r--r-- | apps/dolmetschctl.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/apps/dolmetschctl.c b/apps/dolmetschctl.c index 26b8e83..b8f9197 100644 --- a/apps/dolmetschctl.c +++ b/apps/dolmetschctl.c @@ -47,12 +47,20 @@ int main_loop(osc_t* o, midi_t* m) printf("main_loop just started\n"); - int npfds; - struct pollfd *pfds; + int midi_npfds_offset = 0; + int midi_npfds = midi_get_poll_fd_count(m); + assert(midi_npfds > 0); - npfds = midi_get_poll_desc_count(m); - pfds = alloca(npfds * sizeof(struct pollfd)); - midi_get_poll_desc(m, pfds, npfds); + int osc_npfds_offset = midi_npfds_offset + midi_npfds; + int osc_npfds = osc_get_poll_fd_count(o); + assert(osc_npfds > 0); + + int npfds = midi_npfds + osc_npfds; + struct pollfd *pfds = alloca(npfds * sizeof(struct pollfd)); + + + midi_get_poll_fds(m, &(pfds[midi_npfds_offset]), midi_npfds); + osc_get_poll_fds(o, &(pfds[osc_npfds_offset]), osc_npfds); printf("main_loop running...\n"); for (;;) { @@ -69,7 +77,11 @@ int main_loop(osc_t* o, midi_t* m) continue; } - ret = midi_handle_revents(m, pfds, npfds); + ret = midi_handle_revents(m, &(pfds[midi_npfds_offset]), midi_npfds); + if(ret) + break; + + ret = osc_handle_revents(o, &(pfds[osc_npfds_offset]), osc_npfds); if(ret) break; } @@ -87,12 +99,7 @@ int main(int argc, char* argv[]) if(midi_init(&m, "hw:2,0,0")) return -1; - if(osc_start(&o)) - return -1; - int ret = main_loop(&o, &m); - osc_stop(&o); - return ret; } |