diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-08-28 18:57:55 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-11-14 01:20:48 -0800 |
commit | b22df31feeb7e695faabecfd7cc6fdd24609b0e1 (patch) | |
tree | b1c33983aec45ba17de58276d2c3696695e573dd /src/til_audio_context.c | |
parent | 8245857f9f07043039affd7b92a740e002b1b81b (diff) |
til: add preliminary audio backend
This is an early implementation of something resembling an audio
backend for rototiller/libtil.
The assumption for now is that everything will use signed 16-bit
native-endian stereo output @ 44.1khz.
Diffstat (limited to 'src/til_audio_context.c')
-rw-r--r-- | src/til_audio_context.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/til_audio_context.c b/src/til_audio_context.c new file mode 100644 index 0000000..63cc6f5 --- /dev/null +++ b/src/til_audio_context.c @@ -0,0 +1,35 @@ +#include <stdlib.h> + +#include "til_audio.h" +#include "til_audio_context.h" +#include "til_setup.h" + +/* XXX: this isn't intended to be used by anything other than til_audio.[ch], + * use til_audio_{init,shutdown}(). This is purely in service of that. + */ + +void * til_audio_context_new(const til_audio_ops_t *ops, size_t size, til_setup_t *setup) +{ + til_audio_context_t *c; + + c = calloc(1, size); + if (!c) + return NULL; + + c->setup = til_setup_ref(setup); + c->ops = ops; + + return c; +} + + +til_audio_context_t * til_audio_context_free(til_audio_context_t *audio_context) +{ + if (!audio_context) + return NULL; + + til_setup_free(audio_context->setup); + free(audio_context); + + return NULL; +} |