diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/channel.c (renamed from src/mossrose-channel.c) | 4 | ||||
-rw-r--r-- | src/channel.h (renamed from src/mossrose-channel.h) | 2 | ||||
-rw-r--r-- | src/mossrose.c | 15 | ||||
-rw-r--r-- | src/mossrose.h | 12 | ||||
-rw-r--r-- | src/mutex.c (renamed from src/mossrose-mutex.c) | 2 | ||||
-rw-r--r-- | src/mutex.h (renamed from src/mossrose-mutex.h) | 0 |
7 files changed, 20 insertions, 22 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..069d00a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,7 @@ +project(mossrose) + +target_sources(mossrose PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/mossrose.c + ${CMAKE_CURRENT_LIST_DIR}/mutex.c + ${CMAKE_CURRENT_LIST_DIR}/channel.c +) diff --git a/src/mossrose-channel.c b/src/channel.c index 7232417..169b245 100644 --- a/src/mossrose-channel.c +++ b/src/channel.c @@ -1,7 +1,7 @@ #include <stdlib.h> #include <string.h> -#include "mossrose-mutex.h" -#include "mossrose-channel.h" +#include "mutex.h" +#include "channel.h" void mossrose_channel_init(struct mossrose_channel_t *chan) diff --git a/src/mossrose-channel.h b/src/channel.h index e1db89d..23c11d6 100644 --- a/src/mossrose-channel.h +++ b/src/channel.h @@ -2,7 +2,7 @@ #define MOSSROSE_CHANNEL_H #include <stddef.h> -#include "mossrose-mutex.h" +#include "mutex.h" struct mossrose_channel_t { mossrose_mutex_t mutex; 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; } } diff --git a/src/mossrose.h b/src/mossrose.h deleted file mode 100644 index fb7d088..0000000 --- a/src/mossrose.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MOSSROSE_H -#define MOSSROSE_H - -#include <stddef.h> - -int mossrose_init(double sample_rate, int n_channels); - -int mossrose_terminate(); - -int mossrose_play(float *left, float *right, size_t n_samples, int channel); - -#endif diff --git a/src/mossrose-mutex.c b/src/mutex.c index b6865f8..4a51fa8 100644 --- a/src/mossrose-mutex.c +++ b/src/mutex.c @@ -1,4 +1,4 @@ -#include "mossrose-mutex.h" +#include "mutex.h" #ifdef WIN32 #include <windows.h> diff --git a/src/mossrose-mutex.h b/src/mutex.h index 84d1f63..84d1f63 100644 --- a/src/mossrose-mutex.h +++ b/src/mutex.h |