summaryrefslogtreecommitdiff
path: root/src/mossrose.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mossrose.c')
-rw-r--r--src/mossrose.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mossrose.c b/src/mossrose.c
index 02f063a..4f31711 100644
--- a/src/mossrose.c
+++ b/src/mossrose.c
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <portaudio.h>
-#include "mossrose.h"
-#include "mossrose-mutex.h"
-#include "mossrose-channel.h"
+#include <mossrose.h>
+#include "mutex.h"
+#include "channel.h"
/* ~~~~~~~~~~~~~~~~ type definitions ~~~~~~~~~~~~~~~~ */
@@ -124,15 +124,18 @@ int mossrose_init(double sample_rate, int n_channels)
int mossrose_play(float *left, float *right, size_t len, int channel)
{
if (channel > 0) {
- return mossrose_channel_set(mossrose_global.channels+channel, left, right, len, 1);
+ if (mossrose_channel_set(mossrose_global.channels+channel, left, right, len, 1) == 0)
+ return channel;
+ else
+ return -1;
}
else {
struct mossrose_channel_t *chan;
for (int i=0; i<mossrose_global.n_channels; i++) {
chan = mossrose_global.channels + i;
- if (mossrose_channel_set(chan, left, right, len, 0) == 0) return 0;
+ if (mossrose_channel_set(chan, left, right, len, 0) == 0) return i;
}
- return 1;
+ return -1;
}
}