summaryrefslogtreecommitdiff
path: root/src/til.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-11-13 23:31:33 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-11-14 01:20:56 -0800
commit461b6bc98ad6a64ffefe8beedf736caef823cc25 (patch)
treefb80255d3e9d3eee592bc72df425609d2ca52d48 /src/til.c
parent4c629d77d9bd67e9861f578d89957b3cf1472aa8 (diff)
til: introduce til_module_t.render_audio entrypoint
Simple audio rendering modules need a way to render their audio without affecting the fragment's state. By providing a til_module_t.render_audio() a module indicates it's only an audio renderer, and its render won't trigger an implicit clear of the frame's fragment. There might be a new flag added to indicate when modules are audio modules, but this is good enough for now.
Diffstat (limited to 'src/til.c')
-rw-r--r--src/til.c11
1 files changed, 10 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)
© All Rights Reserved