diff options
-rw-r--r-- | include/xas/audio.h | 9 | ||||
-rw-r--r-- | src/audio.c | 14 | ||||
-rw-r--r-- | src/bank.c | 5 | ||||
-rw-r--r-- | src/mixer.c | 6 | ||||
-rw-r--r-- | src/riff.c | 16 | ||||
-rw-r--r-- | src/spatial.c | 3 | ||||
-rw-r--r-- | src/synth.c | 3 | ||||
-rw-r--r-- | src/vox.c | 5 |
8 files changed, 24 insertions, 37 deletions
diff --git a/include/xas/audio.h b/include/xas/audio.h index 5e36f19..07a2ef0 100644 --- a/include/xas/audio.h +++ b/include/xas/audio.h @@ -22,16 +22,13 @@ typedef struct _xas_audio_stream xas_audio_stream; typedef ssize_t (*xas_audio_drain)(void *ctx, void *samples, - size_t count, - xas_audio_stream *sink); + size_t count); typedef ssize_t (*xas_audio_fill)(void *ctx, void *samples, - size_t count, - xas_audio_stream *source); + size_t count); -typedef void (*xas_audio_cleanup)(void *ctx, - xas_audio_stream *stream); +typedef void (*xas_audio_cleanup)(void *ctx); typedef struct _xas_audio_format { size_t channels, diff --git a/src/audio.c b/src/audio.c index 9caf199..aedc4c0 100644 --- a/src/audio.c +++ b/src/audio.c @@ -129,7 +129,7 @@ xas_audio_stream *xas_audio_stream_new_source(xas_audio_fill fill, void xas_audio_stream_destroy(xas_audio_stream *stream) { if (stream->cleanup) { - stream->cleanup(stream->ctx, stream); + stream->cleanup(stream->ctx); } free(stream); @@ -146,8 +146,7 @@ static inline int stream_flush(xas_audio_stream *sink) { if (sink->drain(sink->ctx, sink + 1, - sink->buffer_count, - sink) < 0) { + sink->buffer_count) < 0) { goto error_sink_drain; } @@ -186,8 +185,7 @@ ssize_t xas_audio_stream_write(xas_audio_stream *sink, if (sink->drain(sink->ctx, sink + 1, - sink->buffer_size, - sink) < 0) { + sink->buffer_size) < 0) { goto error_sink_drain; } @@ -210,8 +208,7 @@ ssize_t xas_audio_stream_write(xas_audio_stream *sink, */ if (sink->drain(sink->ctx, ptr(sink, samples, index_i), - sink->buffer_size, - sink) < 0) { + sink->buffer_size) < 0) { goto error_sink_drain; } @@ -261,6 +258,5 @@ ssize_t xas_audio_stream_read(xas_audio_stream *source, return source->fill(source->ctx, *samples, - count, - source); + count); } @@ -225,8 +225,7 @@ int xas_bank_player_playing(xas_bank_player *player) { static ssize_t stream_fill(xas_bank_player *player, int16_t *dest, - size_t count, - xas_audio_stream *stream) { + size_t count) { xas_bank *bank = player->bank; size_t index_o = 0, @@ -269,7 +268,7 @@ static ssize_t stream_fill(xas_bank_player *player, return count; } -void stream_cleanup(xas_bank_player *player, xas_audio_stream *stream) { +void stream_cleanup(xas_bank_player *player) { return; } diff --git a/src/mixer.c b/src/mixer.c index b4e3bf1..8fe53cb 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -63,11 +63,11 @@ static void mixer_apply_stereo_to_mono(int16_t *dest, static ssize_t mixer_fill(xas_mixer *mixer, void *samples, - size_t count, - xas_audio_stream *output) { + size_t count) { ssize_t total = 0; - xas_mixer_input *input = mixer->inputs; + xas_audio_stream *output = mixer->output; + xas_mixer_input *input = mixer->inputs; xas_audio_zero(output->format, mixer->buf, 0, mixer->buffer_size); @@ -284,7 +284,7 @@ error_malloc_riff: return NULL; } -static void close_file(xas_riff *riff, xas_audio_stream *stream) { +static void close_file(xas_riff *riff) { if (lseek(riff->fd, 0, SEEK_SET) == 0) { (void)header_write(riff); } @@ -298,9 +298,8 @@ static void close_file(xas_riff *riff, xas_audio_stream *stream) { static ssize_t audio_drain(xas_riff *riff, void *samples, - size_t count, - xas_audio_stream *stream) { - size_t stride = stream->format.channels * stream->format.sample_size, + size_t count) { + size_t stride = riff->format.channels * riff->format.sample_size, len = stride * count; ssize_t wrlen; @@ -319,9 +318,8 @@ error_write: static ssize_t audio_fill(xas_riff *riff, void *samples, - size_t count, - xas_audio_stream *stream) { - size_t stride = stream->format.channels * stream->format.sample_size, + size_t count) { + size_t stride = riff->format.channels * riff->format.sample_size, len = count * stride; ssize_t rdlen; @@ -367,7 +365,7 @@ xas_audio_stream *xas_riff_new_file(const char *path, return stream; error_audio_stream_new_sink: - close_file(riff, NULL); + close_file(riff); error_new_file: return NULL; @@ -402,7 +400,7 @@ xas_audio_stream *xas_riff_open_file(const char *path, int flags) { return stream; error_audio_stream_new_sink: - close_file(riff, NULL); + close_file(riff); error_open_file: return NULL; diff --git a/src/spatial.c b/src/spatial.c index e730ee0..ec1c711 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -212,8 +212,7 @@ static void object_update_delays(xas_spatial_scene *scene) { ssize_t scene_fill(xas_spatial_scene *scene, int16_t *output, - size_t count, - xas_audio_stream *source) { + size_t count) { xas_spatial_buffer *buffer = scene->buffer; xas_spatial_object *obj = scene->first; diff --git a/src/synth.c b/src/synth.c index 41522a6..596539f 100644 --- a/src/synth.c +++ b/src/synth.c @@ -90,8 +90,7 @@ static int16_t sample_sawtooth(xas_synth *synth) { static ssize_t synth_fill(xas_synth *synth, int16_t *samples, - size_t count, - xas_audio_stream *stream) { + size_t count) { size_t i; if (synth->frequency > 0) { @@ -188,14 +188,13 @@ error_fflush: return -1; } -static void vox_cleanup(xas_vox *vox, xas_audio_stream *stream) { +static void vox_cleanup(xas_vox *vox) { (void)vox_stop(vox); } static ssize_t vox_fill(xas_vox *vox, int16_t *samples, - size_t count, - xas_audio_stream *stream) { + size_t count) { ssize_t readlen, readcount; |