summaryrefslogtreecommitdiff
path: root/src/mixer
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-10-30 14:40:08 -0400
committerAndrew Opalach <andrew@akon.city> 2025-10-30 14:40:08 -0400
commit90da3b27d939b3b7af1cf7fed10dfaaa7e271622 (patch)
treef0cf96c76d5c83470d2c50dd69d2d3e39a503fab /src/mixer
parent77837d7b63240c069b3351a919a7d2af670f46cd (diff)
downloadcamu-90da3b27d939b3b7af1cf7fed10dfaaa7e271622.tar.gz
camu-90da3b27d939b3b7af1cf7fed10dfaaa7e271622.tar.bz2
camu-90da3b27d939b3b7af1cf7fed10dfaaa7e271622.zip
Fixes from testing sink change, document things
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/mixer')
-rw-r--r--src/mixer/mixer.c7
-rw-r--r--src/mixer/mixer.h2
2 files changed, 5 insertions, 4 deletions
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);