diff options
author | sanine <sanine.not@pm.me> | 2022-09-04 00:39:24 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-09-04 00:39:24 -0500 |
commit | 63db9380f84cb3eb35d2de430b0783afa5773e85 (patch) | |
tree | ffc8360c7bc7e670768cbadcf79597c03b9434a2 /src/channel.h | |
parent | ac48f807cb85423a8063795e3320fedde1ddf5c1 (diff) |
implement callbacks
Diffstat (limited to 'src/channel.h')
-rw-r--r-- | src/channel.h | 10 |
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); |