From 874dc0a549cf803bba6fd9f7acfd847302d9a77e Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 4 Sep 2022 00:47:22 -0500 Subject: update README to reflect callbacks --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index de38d9e..3424af7 100644 --- a/README.md +++ b/README.md @@ -107,8 +107,31 @@ Resume a channel. This function has no effect if the channel is already playing. +### `void mossrose_channel_set_callback(int channel, mossrose_channel_callback_t callback, void *userdata)` ### + +Set a callback to run each time playback of audio on a channel completes. + + * `channel` - the channel to attach to + * `callback` - pointer to the callback function. + * `userdata` - pointer to data to pass to the callback function. + +The callback function should return `void` and have signature `(int channel, +void *userdata)`, where + + * `channel` is the index of the channel triggering the callback + * `userdata` is the user data bound to the callback via the `userdata` + argument to the setter function. + +Callbacks will not be triggered on their own! You must periodically call +`mossrose_poll_callbacks` to trigger them. + + +### `void mossrose_poll_callbacks()` ### + +Check all channels for playback-finished callbacks and run them if necessary. + + todo ---- - * playback finished callback * audio loading -- cgit v1.2.1