summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-14 00:05:27 -0400
committerXANTRONIX Development2022-03-14 00:05:27 -0400
commit815ee7a10f4af1242bc0cd2d288132274615375a (patch)
tree9ad299f924c9d5d78c7cb17e8e61ff51c174b8ad /src
parent3d470011ef84a2b0e85234f66e61ff01fb1939c8 (diff)
downloadxas-815ee7a10f4af1242bc0cd2d288132274615375a.tar.gz
xas-815ee7a10f4af1242bc0cd2d288132274615375a.tar.bz2
xas-815ee7a10f4af1242bc0cd2d288132274615375a.zip
Remove unnecessary argument from callbacks
Diffstat (limited to 'src')
-rw-r--r--src/audio.c14
-rw-r--r--src/bank.c5
-rw-r--r--src/mixer.c6
-rw-r--r--src/riff.c16
-rw-r--r--src/spatial.c3
-rw-r--r--src/synth.c3
-rw-r--r--src/vox.c5
7 files changed, 21 insertions, 31 deletions
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);
}
diff --git a/src/bank.c b/src/bank.c
index 6e4ebac..957cb3e 100644
--- a/src/bank.c
+++ b/src/bank.c
@@ -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);
diff --git a/src/riff.c b/src/riff.c
index 5f63ff4..fb895b6 100644
--- a/src/riff.c
+++ b/src/riff.c
@@ -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) {
diff --git a/src/vox.c b/src/vox.c
index d98a81d..141f555 100644
--- a/src/vox.c
+++ b/src/vox.c
@@ -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;