summaryrefslogtreecommitdiff
path: root/src/channel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel.h')
-rw-r--r--src/channel.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/channel.h b/src/channel.h
index 5be42a2..61a1c7d 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -7,6 +7,9 @@
#include <mossrose.h>
+typedef void (*channel_callback_t)(int channel, void *userdata);
+
+
struct channel_shared_t {
volatile pint active; /* boolean */
volatile pint paused; /* boolean */
@@ -14,6 +17,7 @@ struct channel_shared_t {
volatile pint pan_left; /* -255-255 */
volatile pint pan_right; /* -255-255 */
volatile pint loops;
+ volatile pint trigger_callback;
};
@@ -26,6 +30,9 @@ struct channel_t {
PMutex *sound_mutex;
struct mossrose_sound_t sound;
size_t pos;
+
+ channel_callback_t callback;
+ void *userdata;
};
@@ -35,7 +42,10 @@ void channel_pause(struct channel_t *chan);
void channel_resume(struct channel_t *chan);
void channel_set_volume(struct channel_t *chan, float volume);
void channel_set_pan(struct channel_t *chan, float pan_left, float pan_right);
+void channel_set_callback(struct channel_t *chan, channel_callback_t callback, void *userdata);
+void channel_poll_callbacks(struct channel_t *chan, int index);
int channel_sound_load(struct channel_t *chan, struct mossrose_sound_t *sound, bool force, int loops);
+void channel_update_shared(struct channel_t *chan);
void channel_get_next_sample(float *left, float *right, struct channel_t *chan);