diff options
author | sanine <sanine.not@pm.me> | 2022-09-04 00:47:22 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-09-04 00:47:22 -0500 |
commit | 874dc0a549cf803bba6fd9f7acfd847302d9a77e (patch) | |
tree | 4c48a43ca28ea575d5c2c527a3a0b0e514065da1 | |
parent | 63db9380f84cb3eb35d2de430b0783afa5773e85 (diff) |
update README to reflect callbacks
-rw-r--r-- | README.md | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -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 |