From 59d4694efd295217e15c90ca5636c4bdcfecf222 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 31 Jan 2022 20:47:58 -0500 Subject: This is getting annoyingly close to working... --- include/xas/audio.h | 2 +- include/xas/mixer.h | 7 ++++++- include/xas/synth.h | 23 +++++++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/xas/audio.h b/include/xas/audio.h index 76d1e68..9c40dd8 100644 --- a/include/xas/audio.h +++ b/include/xas/audio.h @@ -74,7 +74,7 @@ ssize_t xas_audio_stream_write(xas_audio_stream *stream, size_t count); ssize_t xas_audio_stream_read(xas_audio_stream *stream, - void *samples, + void **samples, size_t count); int xas_audio_stream_flush(xas_audio_stream *stream); diff --git a/include/xas/mixer.h b/include/xas/mixer.h index ca60976..9fd77cb 100644 --- a/include/xas/mixer.h +++ b/include/xas/mixer.h @@ -25,10 +25,15 @@ typedef struct _xas_mixer { size_t buffer_size; } xas_mixer; -xas_mixer *xas_mixer_new(xas_audio_stream *output); +xas_mixer *xas_mixer_new(size_t sample_size, + size_t sample_rate, + size_t channels, + size_t buffer_size); void xas_mixer_destroy(xas_mixer *mixer); +xas_audio_stream *xas_mixer_output(xas_mixer *mixer); + xas_mixer_input *xas_mixer_input_add(xas_mixer *mixer, xas_audio_stream *stream, float gain, diff --git a/include/xas/synth.h b/include/xas/synth.h index fe3ce9f..1d070aa 100644 --- a/include/xas/synth.h +++ b/include/xas/synth.h @@ -10,23 +10,22 @@ typedef struct _xas_synth xas_synth; typedef int16_t (*xas_synth_callback_sample)(xas_synth *synth, void *ctx); -typedef void (*xas_synth_callback_destroy)(xas_synth *synth, void *ctx); +typedef void (*xas_synth_callback_cleanup)(xas_synth *synth, void *ctx); struct _xas_synth { - size_t sample_rate; + size_t sample_size, + sample_rate; - xas_synth_callback_sample sample; - xas_synth_callback_destroy destroy; + xas_synth_callback_sample sample; + xas_synth_callback_cleanup cleanup; void *ctx; }; -xas_synth *xas_synth_new(size_t sample_rate, - xas_synth_callback_sample sample, - xas_synth_callback_destroy destroy, - void *ctx); - -void xas_synth_destroy(xas_synth *synth); - -int16_t xas_synth_sample(xas_synth *synth); +xas_audio_stream *xas_synth_new(size_t sample_size, + size_t sample_rate, + size_t buffer_size, + xas_synth_callback_sample sample, + xas_synth_callback_cleanup cleanup, + void *ctx); #endif /* _XAS_SYNTH_H */ -- cgit v1.2.3