summaryrefslogtreecommitdiff
path: root/src/til_audio_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/til_audio_context.c')
-rw-r--r--src/til_audio_context.c35
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;
+}
© All Rights Reserved