summaryrefslogtreecommitdiff
path: root/src/mossrose.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-26 12:42:30 -0500
committersanine <sanine.not@pm.me>2022-08-26 12:42:30 -0500
commitbde3e4f1bb7b8f8abca0884a7d994ee1c17a66b1 (patch)
tree825ff3669a38ec247bcc9b575a4a4ceb81534d35 /src/mossrose.c
parent8ec3f8e82acd70410515550fd1790ee5827aafdb (diff)
refactor: move mossrose.h to include/ dir
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;
}
}