summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/til.c11
-rw-r--r--src/til.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/src/til.c b/src/til.c
index 2936fce..0e856a9 100644
--- a/src/til.c
+++ b/src/til.c
@@ -287,7 +287,16 @@ static void _til_module_render(til_module_context_t *context, til_stream_t *stre
{
unsigned start = til_ticks_now();
- module_render_fragment(context, stream, til_threads, n_cpus, ticks, fragment_ptr);
+ /* When a module provides a render_audio method, it's strictly audio and we don't do any render_fragment.
+ * If a module wants to do interesting things combining visuals and audio together, it should do the
+ * audio queueing from its prepare_frame/render_fragment/finish_frame alongside its visuals rendering,
+ * and leave render_audio NULL.
+ * FIXME TODO: assert() somewhere .render_audio isn't combined with .prepare_frame/.render_fragment/.finish_frame
+ */
+ if (context->module->render_audio)
+ context->module->render_audio(context, stream, ticks);
+ else
+ module_render_fragment(context, stream, til_threads, n_cpus, ticks, fragment_ptr);
context->last_render_duration = til_ticks_now() - start;
if (context->last_render_duration > context->max_render_duration)
diff --git a/src/til.h b/src/til.h
index 3126ced..0724bf3 100644
--- a/src/til.h
+++ b/src/til.h
@@ -30,6 +30,7 @@ typedef struct til_stream_t til_stream_t;
struct til_module_t {
til_module_context_t * (*create_context)(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
void (*destroy_context)(til_module_context_t *context); /* destroy gets stream in context, but the render-related functions should always use the passed-in stream so it can potentially change */
+ void (*render_audio)(til_module_context_t *context, til_stream_t *stream, unsigned ticks);
void (*prepare_frame)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan);
void (*render_fragment)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr);
int (*finish_frame)(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr);
© All Rights Reserved