summaryrefslogtreecommitdiff
path: root/src/mossrose.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mossrose.c')
-rw-r--r--src/mossrose.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mossrose.c b/src/mossrose.c
index cd1b98d..2e27c45 100644
--- a/src/mossrose.c
+++ b/src/mossrose.c
@@ -4,6 +4,7 @@
#include <portaudio.h>
#include <mossrose.h>
#include "channel.h"
+#include "sound.h"
struct mossrose_global_t {
@@ -131,8 +132,29 @@ void mossrose_channel_resume(int channel) {
}
+void mossrose_channel_set_callback(int channel, channel_callback_t callback, void *userdata)
+{
+ struct channel_t *chan = mossrose_global.channels + channel;
+ channel_set_callback(chan, callback, userdata);
+}
+
+
+void mossrose_poll_callbacks()
+{
+ for (int i=0; i<mossrose_global.n_channels; i++) {
+ struct channel_t *chan = mossrose_global.channels + i;
+ channel_poll_callbacks(chan, i);
+ }
+}
+
+
int mossrose_terminate()
{
+ for (int i=0; i<mossrose_global.n_channels; i++) {
+ sound_free_audio(&(mossrose_global.channels[i].sound));
+ }
+ free(mossrose_global.channels);
+
Pa_AbortStream(mossrose_global.stream);
Pa_CloseStream(mossrose_global.stream);
Pa_Terminate();