From 90da3b27d939b3b7af1cf7fed10dfaaa7e271622 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Thu, 30 Oct 2025 14:40:08 -0400 Subject: Fixes from testing sink change, document things Signed-off-by: Andrew Opalach --- src/mixer/mixer.c | 7 ++++--- src/mixer/mixer.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/mixer') diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index 7e62f8d..26471c9 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -105,7 +105,7 @@ void camu_mixer_set_volume(struct camu_mixer *mixer, f32 volume) #endif } -void camu_mixer_offset_volume(struct camu_mixer *mixer, f32 amount) +f32 camu_mixer_offset_volume(struct camu_mixer *mixer, f32 amount) { #ifdef CAMU_MIXER_THREADED nn_mutex_lock(&mixer->mutex); @@ -115,6 +115,7 @@ void camu_mixer_offset_volume(struct camu_mixer *mixer, f32 amount) } else { mixer->volume = MAX(0.f, mixer->volume + amount); } + f32 volume = mixer->volume; struct camu_audio_buffer *buf; al_array_foreach(mixer->buffers, i, buf) { camu_audio_buffer_set_volume(buf, mixer->volume); @@ -122,6 +123,7 @@ void camu_mixer_offset_volume(struct camu_mixer *mixer, f32 amount) #ifdef CAMU_MIXER_THREADED nn_mutex_unlock(&mixer->mutex); #endif + return volume; } f64 camu_mixer_get_latency(struct camu_mixer *mixer) @@ -276,8 +278,7 @@ void camu_mixer_pause(struct camu_mixer *mixer) al_atomic_store(bool)(&mixer->paused, true, AL_ATOMIC_RELEASE); } #ifdef CAMU_MIXER_THREADED - // This assumes stop() blocks until the output actually stops. - // That may not be the behavior we want to require. + // This requires that stop() blocks until the output actually stops. run_queue_internal(mixer); #endif #ifdef CAMU_MIXER_THREADED_START_STOP diff --git a/src/mixer/mixer.h b/src/mixer/mixer.h index 7f443ea..d1a79b3 100644 --- a/src/mixer/mixer.h +++ b/src/mixer/mixer.h @@ -41,7 +41,7 @@ struct camu_mixer { bool camu_mixer_init(struct camu_mixer *mixer, struct camu_audio *audio); void camu_mixer_pick_format(struct camu_mixer *mixer, struct camu_resampler_format *fmt); void camu_mixer_set_volume(struct camu_mixer *mixer, f32 volume); -void camu_mixer_offset_volume(struct camu_mixer *mixer, f32 amount); +f32 camu_mixer_offset_volume(struct camu_mixer *mixer, f32 amount); f64 camu_mixer_get_latency(struct camu_mixer *mixer); void camu_mixer_add_buffer(struct camu_mixer *mixer, struct camu_audio_buffer *buf); void camu_mixer_remove_buffer(struct camu_mixer *mixer, struct camu_audio_buffer *buf); -- cgit v1.2.3-101-g0448