summaryrefslogtreecommitdiff
path: root/apps/dolmetschctl.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-10-10 20:24:30 +0200
committerChristian Pointner <equinox@spreadspace.org>2015-10-10 20:24:42 +0200
commit9950027ef8634045588e461a2e274c50dc893c0d (patch)
treed6d54a9998e64b3bb4c068cc202799c5be34fc94 /apps/dolmetschctl.c
parentimproved poll() handling (diff)
added mixer
Diffstat (limited to 'apps/dolmetschctl.c')
-rw-r--r--apps/dolmetschctl.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/apps/dolmetschctl.c b/apps/dolmetschctl.c
index 9e3b3d5..5365c22 100644
--- a/apps/dolmetschctl.c
+++ b/apps/dolmetschctl.c
@@ -25,8 +25,9 @@
#include <stdio.h>
#include <error.h>
-#include "osc.h"
+#include "mixer.h"
#include "midi.h"
+#include "osc.h"
void print_version()
@@ -41,13 +42,17 @@ void print_version()
#endif
}
-int main_loop(osc_t* o, midi_t* m)
+int main_loop(mixer_t* x, midi_t* m, osc_t* o)
{
int ret = 0;
printf("main_loop just started\n");
- int midi_npfds_offset = 0;
+ int mixer_npfds_offset = 0;
+ int mixer_npfds = mixer_get_poll_fd_count(x);
+ assert(mixer_npfds > 0);
+
+ int midi_npfds_offset = mixer_npfds_offset + mixer_npfds;
int midi_npfds = midi_get_poll_fd_count(m);
assert(midi_npfds > 0);
@@ -55,17 +60,18 @@ int main_loop(osc_t* o, midi_t* m)
int osc_npfds = osc_get_poll_fd_count(o);
assert(osc_npfds > 0);
- int npfds = midi_npfds + osc_npfds;
+ int npfds = midi_npfds + osc_npfds + mixer_npfds;
struct pollfd *pfds = alloca(npfds * sizeof(struct pollfd));
+ mixer_get_poll_fds(x, &(pfds[mixer_npfds_offset]), mixer_npfds);
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 (;;) {
int err = poll(pfds, npfds, 200);
- if(err < 0 || errno != EINTR) {
+ if(err < 0 && errno != EINTR) {
error(0, errno, "poll failed");
break;
}
@@ -74,6 +80,10 @@ int main_loop(osc_t* o, midi_t* m)
continue;
}
+ ret = mixer_handle_revents(x, &(pfds[mixer_npfds_offset]), mixer_npfds);
+ if(ret)
+ break;
+
ret = midi_handle_revents(m, &(pfds[midi_npfds_offset]), midi_npfds);
if(ret)
break;
@@ -88,15 +98,19 @@ int main_loop(osc_t* o, midi_t* m)
int main(int argc, char* argv[])
{
- osc_t o;
- if(osc_init(&o, "1200"))
+ mixer_t x;
+ if(mixer_init(&x, "qu24", "hw:1,0,0"))
return -1;
midi_t m;
- if(midi_init(&m, "hw:2,0,0"))
+ if(midi_init(&m, "hw:1,0,0"))
+ return -1;
+
+ osc_t o;
+ if(osc_init(&o, "1200"))
return -1;
- int ret = main_loop(&o, &m);
+ int ret = main_loop(&x, &m, &o);
return ret;
}