diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-10-12 07:25:04 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-10-12 07:25:04 +0200 |
commit | dfcd1d94f82bebd11d09b86c339d98bcda542a73 (patch) | |
tree | c42fc375960787c35923271c9e575678c71ad355 /client/dolmetschctl-client.c | |
parent | improved error checking (diff) |
added support for midi
Diffstat (limited to 'client/dolmetschctl-client.c')
-rw-r--r-- | client/dolmetschctl-client.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/client/dolmetschctl-client.c b/client/dolmetschctl-client.c index e001db9..1f97475 100644 --- a/client/dolmetschctl-client.c +++ b/client/dolmetschctl-client.c @@ -30,7 +30,7 @@ #include <lo/lo.h> #include <alsa/asoundlib.h> -/* #include "midi.h" */ +#include "midi.h" /* #include "osc.h" */ @@ -62,21 +62,21 @@ void print_usage() } /* int main_loop(midi_t* m, osc_t* o) */ -int main_loop() +int main_loop(midi_t* m) { int ret = 0; printf("main_loop just started\n"); - /* int midi_npfds_offset = 0; */ - /* int midi_npfds = midi_get_poll_fd_count(m); */ - /* assert(midi_npfds > 0); */ + int midi_npfds_offset = 0; + int midi_npfds = midi_get_poll_fd_count(m); + assert(midi_npfds > 0); /* int osc_npfds_offset = midi_npfds_offset + midi_npfds; */ /* int osc_npfds = osc_get_poll_fd_count(o); */ /* assert(osc_npfds > 0); */ - int npfds = 0; //midi_npfds + osc_npfds; + int npfds = midi_npfds; // + osc_npfds; struct pollfd *pfds = alloca(npfds * sizeof(struct pollfd)); if(!pfds) { error(0, 0, "error while allocating poll fds - stack corrupted??"); @@ -85,7 +85,7 @@ int main_loop() printf("main_loop running with %d pollfds...\n", npfds); for (;;) { - /* midi_get_poll_fds(m, &(pfds[midi_npfds_offset]), midi_npfds); */ + midi_get_poll_fds(m, &(pfds[midi_npfds_offset]), midi_npfds); /* osc_get_poll_fds(o, &(pfds[osc_npfds_offset]), osc_npfds); */ int err = poll(pfds, npfds, 200); @@ -98,9 +98,10 @@ int main_loop() continue; } - /* ret = midi_handle_revents(m, &(pfds[midi_npfds_offset]), midi_npfds, x); */ - /* if(ret) */ - /* break; */ +// ret = midi_handle_revents(m, &(pfds[midi_npfds_offset]), midi_npfds, o); + 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, x); */ /* if(ret) */ @@ -168,16 +169,16 @@ int main(int argc, char* argv[]) return -1; } - /* midi_t m; */ - /* if(midi_init(&m, midi_dev)) */ - /* return -1; */ + midi_t m; + if(midi_init(&m, midi_dev)) + return -1; /* osc_t o; */ /* if(osc_init(&o, osc_target)) */ /* return -1; */ /* int ret = main_loop(&m, &o); */ - int ret = main_loop(); + int ret = main_loop(&m); return ret; } |