From aa3142ab208000fe675b1deba46461e7fe8e470f Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 13 Sep 2011 21:15:49 +0100 Subject: [PATCH] volume: Rename 'sync volume' to 'deferred volume'. This just covers Lennart's concern over the terminology used. The majority of this change is simply the following command: grep -rli sync[-_]volume . | xargs sed -i 's/sync_volume/deferred_volume/g;s/PA_SINK_SYNC_VOLUME/PA_SINK_DEFERRED_VOLUME/g;s/PA_SOURCE_SYNC_VOLUME/PA_SOURCE_DEFERRED_VOLUME/g;s/sync-volume/deferred-volume/g' Some minor tweaks were added on top to tidy up formatting and a couple of phrases were clarified too. --- man/pulse-daemon.conf.5.xml.in | 10 ++++---- src/daemon/daemon-conf.c | 20 +++++++++------- src/daemon/daemon-conf.h | 6 ++--- src/daemon/daemon.conf.in | 6 ++--- src/daemon/main.c | 6 ++--- src/modules/alsa/alsa-mixer.c | 10 ++++---- src/modules/alsa/alsa-mixer.h | 2 +- src/modules/alsa/alsa-sink.c | 34 +++++++++++++-------------- src/modules/alsa/alsa-source.c | 34 +++++++++++++-------------- src/modules/alsa/module-alsa-card.c | 4 ++-- src/modules/alsa/module-alsa-sink.c | 12 +++++----- src/modules/alsa/module-alsa-source.c | 12 +++++----- src/modules/module-udev-detect.c | 18 +++++++------- src/pulse/def.h | 8 +++---- src/pulsecore/core.c | 6 ++--- src/pulsecore/core.h | 6 ++--- src/pulsecore/sink.c | 34 +++++++++++++-------------- src/pulsecore/sink.h | 18 +++++++------- src/pulsecore/source.c | 32 ++++++++++++------------- src/pulsecore/source.h | 6 ++--- 20 files changed, 143 insertions(+), 141 deletions(-) diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in index 6fcdd0ec..b5ef09c8 100644 --- a/man/pulse-daemon.conf.5.xml.in +++ b/man/pulse-daemon.conf.5.xml.in @@ -438,7 +438,7 @@ USA. -
+

With the flat volume feature enabled, the sink HW volume is set to the same level as the highest volume input stream. Any other streams @@ -448,20 +448,20 @@ USA. cause the resulting output sound to be momentarily too loud or too soft. So to ensure SW and HW volumes are applied concurrently without any glitches, their application needs to be synchronized. The sink - implementation needs to support synchronized volumes. The following + implementation needs to support deferred volumes. The following parameters can be used to refine the process.

diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index c4ee544a..3619fb59 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -95,11 +95,11 @@ static const pa_daemon_conf default_conf = { .no_cpu_limit = TRUE, .disable_shm = FALSE, .lock_memory = FALSE, - .sync_volume = TRUE, + .deferred_volume = TRUE, .default_n_fragments = 4, .default_fragment_size_msec = 25, - .sync_volume_safety_margin_usec = 8000, - .sync_volume_extra_delay_usec = 0, + .deferred_volume_safety_margin_usec = 8000, + .deferred_volume_extra_delay_usec = 0, .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 }, .default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } }, .shm_size = 0 @@ -536,7 +536,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "enable-shm", pa_config_parse_not_bool, &c->disable_shm, NULL }, { "flat-volumes", pa_config_parse_bool, &c->flat_volumes, NULL }, { "lock-memory", pa_config_parse_bool, &c->lock_memory, NULL }, - { "enable-sync-volume", pa_config_parse_bool, &c->sync_volume, NULL }, + { "enable-deferred-volume", pa_config_parse_bool, &c->deferred_volume, NULL }, { "exit-idle-time", pa_config_parse_int, &c->exit_idle_time, NULL }, { "scache-idle-time", pa_config_parse_int, &c->scache_idle_time, NULL }, { "realtime-priority", parse_rtprio, c, NULL }, @@ -552,8 +552,10 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "default-channel-map", parse_channel_map, &ci, NULL }, { "default-fragments", parse_fragments, c, NULL }, { "default-fragment-size-msec", parse_fragment_size_msec, c, NULL }, - { "sync-volume-safety-margin-usec", pa_config_parse_unsigned, &c->sync_volume_safety_margin_usec, NULL }, - { "sync-volume-extra-delay-usec", pa_config_parse_int, &c->sync_volume_extra_delay_usec, NULL }, + { "deferred-volume-safety-margin-usec", + pa_config_parse_unsigned, &c->deferred_volume_safety_margin_usec, NULL }, + { "deferred-volume-extra-delay-usec", + pa_config_parse_int, &c->deferred_volume_extra_delay_usec, NULL }, { "nice-level", parse_nice_level, c, NULL }, { "disable-remixing", pa_config_parse_bool, &c->disable_remixing, NULL }, { "enable-remixing", pa_config_parse_not_bool, &c->disable_remixing, NULL }, @@ -737,7 +739,6 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { pa_strbuf_printf(s, "enable-shm = %s\n", pa_yes_no(!c->disable_shm)); pa_strbuf_printf(s, "flat-volumes = %s\n", pa_yes_no(c->flat_volumes)); pa_strbuf_printf(s, "lock-memory = %s\n", pa_yes_no(c->lock_memory)); - pa_strbuf_printf(s, "enable-sync-volume = %s\n", pa_yes_no(c->sync_volume)); pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time); pa_strbuf_printf(s, "scache-idle-time = %i\n", c->scache_idle_time); pa_strbuf_printf(s, "dl-search-path = %s\n", pa_strempty(c->dl_search_path)); @@ -754,8 +755,9 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { pa_strbuf_printf(s, "default-channel-map = %s\n", pa_channel_map_snprint(cm, sizeof(cm), &c->default_channel_map)); pa_strbuf_printf(s, "default-fragments = %u\n", c->default_n_fragments); pa_strbuf_printf(s, "default-fragment-size-msec = %u\n", c->default_fragment_size_msec); - pa_strbuf_printf(s, "sync-volume-safety-margin-usec = %u\n", c->sync_volume_safety_margin_usec); - pa_strbuf_printf(s, "sync-volume-extra-delay-usec = %d\n", c->sync_volume_extra_delay_usec); + pa_strbuf_printf(s, "enable-deferred-volume = %s\n", pa_yes_no(c->deferred_volume)); + pa_strbuf_printf(s, "deferred-volume-safety-margin-usec = %u\n", c->deferred_volume_safety_margin_usec); + pa_strbuf_printf(s, "deferred-volume-extra-delay-usec = %d\n", c->deferred_volume_extra_delay_usec); pa_strbuf_printf(s, "shm-size-bytes = %lu\n", (unsigned long) c->shm_size); pa_strbuf_printf(s, "log-meta = %s\n", pa_yes_no(c->log_meta)); pa_strbuf_printf(s, "log-time = %s\n", pa_yes_no(c->log_time)); diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h index 9fd6aba6..600bcec4 100644 --- a/src/daemon/daemon-conf.h +++ b/src/daemon/daemon-conf.h @@ -76,7 +76,7 @@ typedef struct pa_daemon_conf { log_time, flat_volumes, lock_memory, - sync_volume; + deferred_volume; pa_server_type_t local_server_type; int exit_idle_time, scache_idle_time, @@ -128,8 +128,8 @@ typedef struct pa_daemon_conf { #endif unsigned default_n_fragments, default_fragment_size_msec; - unsigned sync_volume_safety_margin_usec; - int sync_volume_extra_delay_usec; + unsigned deferred_volume_safety_margin_usec; + int deferred_volume_extra_delay_usec; pa_sample_spec default_sample_spec; pa_channel_map default_channel_map; size_t shm_size; diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in index 6437f8f1..b13ede77 100644 --- a/src/daemon/daemon.conf.in +++ b/src/daemon/daemon.conf.in @@ -86,6 +86,6 @@ ifelse(@HAVE_SYS_RESOURCE_H@, 1, [dnl ; default-fragments = 4 ; default-fragment-size-msec = 25 -; enable-sync-volume = yes -; sync-volume-safety-margin-usec = 8000 -; sync-volume-extra-delay-usec = 0 +; enable-deferred-volume = yes +; deferred-volume-safety-margin-usec = 8000 +; deferred-volume-extra-delay-usec = 0 diff --git a/src/daemon/main.c b/src/daemon/main.c index e7e5238e..e2e4a810 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -1016,8 +1016,8 @@ int main(int argc, char *argv[]) { c->default_channel_map = conf->default_channel_map; c->default_n_fragments = conf->default_n_fragments; c->default_fragment_size_msec = conf->default_fragment_size_msec; - c->sync_volume_safety_margin_usec = conf->sync_volume_safety_margin_usec; - c->sync_volume_extra_delay_usec = conf->sync_volume_extra_delay_usec; + c->deferred_volume_safety_margin_usec = conf->deferred_volume_safety_margin_usec; + c->deferred_volume_extra_delay_usec = conf->deferred_volume_extra_delay_usec; c->exit_idle_time = conf->exit_idle_time; c->scache_idle_time = conf->scache_idle_time; c->resample_method = conf->resample_method; @@ -1025,7 +1025,7 @@ int main(int argc, char *argv[]) { c->realtime_scheduling = !!conf->realtime_scheduling; c->disable_remixing = !!conf->disable_remixing; c->disable_lfe_remixing = !!conf->disable_lfe_remixing; - c->sync_volume = !!conf->sync_volume; + c->deferred_volume = !!conf->deferred_volume; c->running_as_daemon = !!conf->daemonize; c->disallow_exit = conf->disallow_exit; c->flat_volumes = conf->flat_volumes; diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index a40dbc50..ec69efcb 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -899,7 +899,7 @@ static int element_get_nearest_alsa_dB(snd_mixer_elem_t *me, snd_mixer_selem_cha return r; } -static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t sync_volume, pa_bool_t write_to_hw) { +static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw) { snd_mixer_selem_id_t *sid; pa_cvolume rv; @@ -964,7 +964,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann } else { if (write_to_hw) { - if (sync_volume) { + if (deferred_volume) { if ((r = element_get_nearest_alsa_dB(me, c, PA_ALSA_DIRECTION_OUTPUT, &value)) >= 0) r = snd_mixer_selem_set_playback_dB(me, c, value, 0); } else { @@ -992,7 +992,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann } else { if (write_to_hw) { - if (sync_volume) { + if (deferred_volume) { if ((r = element_get_nearest_alsa_dB(me, c, PA_ALSA_DIRECTION_INPUT, &value)) >= 0) r = snd_mixer_selem_set_capture_dB(me, c, value, 0); } else { @@ -1059,7 +1059,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann return 0; } -int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t sync_volume, pa_bool_t write_to_hw) { +int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw) { pa_alsa_element *e; pa_cvolume rv; @@ -1085,7 +1085,7 @@ int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_ma pa_assert(!p->has_dB || e->has_dB); ev = rv; - if (element_set_volume(e, m, cm, &ev, sync_volume, write_to_hw) < 0) + if (element_set_volume(e, m, cm, &ev, deferred_volume, write_to_hw) < 0) return -1; if (!p->has_dB) { diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index b146a415..c9d968a1 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -214,7 +214,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB); void pa_alsa_path_dump(pa_alsa_path *p); int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v); int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t *muted); -int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t sync_volume, pa_bool_t write_to_hw); +int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw); int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t muted); int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m); void pa_alsa_path_set_callback(pa_alsa_path *p, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata); diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 7d205bfe..d164128b 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -131,7 +131,7 @@ struct userdata { char *device_name; /* name of the PCM device */ char *control_device; /* name of the control device */ - pa_bool_t use_mmap:1, use_tsched:1, sync_volume:1; + pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1; pa_bool_t first, after_rewind; @@ -1278,7 +1278,7 @@ static void sink_set_volume_cb(pa_sink *s) { struct userdata *u = s->userdata; pa_cvolume r; char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX]; - pa_bool_t sync_volume = !!(s->flags & PA_SINK_SYNC_VOLUME); + pa_bool_t deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME); pa_assert(u); pa_assert(u->mixer_path); @@ -1287,7 +1287,7 @@ static void sink_set_volume_cb(pa_sink *s) { /* Shift up by the base volume */ pa_sw_cvolume_divide_scalar(&r, &s->real_volume, s->base_volume); - if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r, sync_volume, !sync_volume) < 0) + if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r, deferred_volume, !deferred_volume) < 0) return; /* Shift down by the base volume, so that 0dB becomes maximum volume */ @@ -1339,7 +1339,7 @@ static void sink_write_volume_cb(pa_sink *s) { pa_assert(u); pa_assert(u->mixer_path); pa_assert(u->mixer_handle); - pa_assert(s->flags & PA_SINK_SYNC_VOLUME); + pa_assert(s->flags & PA_SINK_DEFERRED_VOLUME); /* Shift up by the base volume */ pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume); @@ -1411,7 +1411,7 @@ static void mixer_volume_init(struct userdata *u) { pa_sink_set_get_volume_callback(u->sink, sink_get_volume_cb); pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); - if (u->mixer_path->has_dB && u->sync_volume) { + if (u->mixer_path->has_dB && u->deferred_volume) { pa_sink_set_write_volume_callback(u->sink, sink_write_volume_cb); pa_log_info("Successfully enabled synchronous volume."); } else @@ -1692,7 +1692,7 @@ static void thread_func(void *userdata) { } - if (u->sink->flags & PA_SINK_SYNC_VOLUME) { + if (u->sink->flags & PA_SINK_DEFERRED_VOLUME) { pa_usec_t volume_sleep; pa_sink_volume_change_apply(u->sink, &volume_sleep); if (volume_sleep > 0) @@ -1708,7 +1708,7 @@ static void thread_func(void *userdata) { if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) goto fail; - if (u->sink->flags & PA_SINK_SYNC_VOLUME) + if (u->sink->flags & PA_SINK_DEFERRED_VOLUME) pa_sink_volume_change_apply(u->sink, NULL); if (ret == 0) @@ -1882,7 +1882,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { if (need_mixer_callback) { int (*mixer_callback)(snd_mixer_elem_t *, unsigned int); - if (u->sink->flags & PA_SINK_SYNC_VOLUME) { + if (u->sink->flags & PA_SINK_DEFERRED_VOLUME) { u->mixer_pd = pa_alsa_mixer_pdata_new(); mixer_callback = io_mixer_callback; @@ -1918,7 +1918,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; size_t frame_size; - pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, sync_volume = FALSE, set_formats = FALSE; + pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, set_formats = FALSE; pa_sink_new_data data; pa_alsa_profile_set *profile_set = NULL; @@ -1977,9 +1977,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca goto fail; } - sync_volume = m->core->sync_volume; - if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) { - pa_log("Failed to parse sync_volume argument."); + deferred_volume = m->core->deferred_volume; + if (pa_modargs_get_value_boolean(ma, "deferred_volume", &deferred_volume) < 0) { + pa_log("Failed to parse deferred_volume argument."); goto fail; } @@ -1990,7 +1990,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca u->module = m; u->use_mmap = use_mmap; u->use_tsched = use_tsched; - u->sync_volume = sync_volume; + u->deferred_volume = deferred_volume; u->first = TRUE; u->rewind_safeguard = rewind_safeguard; u->rtpoll = pa_rtpoll_new(); @@ -2151,15 +2151,15 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca goto fail; } - if (pa_modargs_get_value_u32(ma, "sync_volume_safety_margin", + if (pa_modargs_get_value_u32(ma, "deferred_volume_safety_margin", &u->sink->thread_info.volume_change_safety_margin) < 0) { - pa_log("Failed to parse sync_volume_safety_margin parameter"); + pa_log("Failed to parse deferred_volume_safety_margin parameter"); goto fail; } - if (pa_modargs_get_value_s32(ma, "sync_volume_extra_delay", + if (pa_modargs_get_value_s32(ma, "deferred_volume_extra_delay", &u->sink->thread_info.volume_change_extra_delay) < 0) { - pa_log("Failed to parse sync_volume_extra_delay parameter"); + pa_log("Failed to parse deferred_volume_extra_delay parameter"); goto fail; } diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index fa500a15..229edf12 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -116,7 +116,7 @@ struct userdata { char *device_name; /* name of the PCM device */ char *control_device; /* name of the control device */ - pa_bool_t use_mmap:1, use_tsched:1, sync_volume:1; + pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1; pa_bool_t first; @@ -1129,7 +1129,7 @@ static void source_set_volume_cb(pa_source *s) { struct userdata *u = s->userdata; pa_cvolume r; char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX]; - pa_bool_t sync_volume = !!(s->flags & PA_SOURCE_SYNC_VOLUME); + pa_bool_t deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME); pa_assert(u); pa_assert(u->mixer_path); @@ -1138,7 +1138,7 @@ static void source_set_volume_cb(pa_source *s) { /* Shift up by the base volume */ pa_sw_cvolume_divide_scalar(&r, &s->real_volume, s->base_volume); - if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r, sync_volume, !sync_volume) < 0) + if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r, deferred_volume, !deferred_volume) < 0) return; /* Shift down by the base volume, so that 0dB becomes maximum volume */ @@ -1190,7 +1190,7 @@ static void source_write_volume_cb(pa_source *s) { pa_assert(u); pa_assert(u->mixer_path); pa_assert(u->mixer_handle); - pa_assert(s->flags & PA_SOURCE_SYNC_VOLUME); + pa_assert(s->flags & PA_SOURCE_DEFERRED_VOLUME); /* Shift up by the base volume */ pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume); @@ -1262,7 +1262,7 @@ static void mixer_volume_init(struct userdata *u) { pa_source_set_get_volume_callback(u->source, source_get_volume_cb); pa_source_set_set_volume_callback(u->source, source_set_volume_cb); - if (u->mixer_path->has_dB && u->sync_volume) { + if (u->mixer_path->has_dB && u->deferred_volume) { pa_source_set_write_volume_callback(u->source, source_write_volume_cb); pa_log_info("Successfully enabled synchronous volume."); } else @@ -1405,7 +1405,7 @@ static void thread_func(void *userdata) { } } - if (u->source->flags & PA_SOURCE_SYNC_VOLUME) { + if (u->source->flags & PA_SOURCE_DEFERRED_VOLUME) { pa_usec_t volume_sleep; pa_source_volume_change_apply(u->source, &volume_sleep); if (volume_sleep > 0) @@ -1421,7 +1421,7 @@ static void thread_func(void *userdata) { if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) goto fail; - if (u->source->flags & PA_SOURCE_SYNC_VOLUME) + if (u->source->flags & PA_SOURCE_DEFERRED_VOLUME) pa_source_volume_change_apply(u->source, NULL); if (ret == 0) @@ -1593,7 +1593,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { if (need_mixer_callback) { int (*mixer_callback)(snd_mixer_elem_t *, unsigned int); - if (u->source->flags & PA_SOURCE_SYNC_VOLUME) { + if (u->source->flags & PA_SOURCE_DEFERRED_VOLUME) { u->mixer_pd = pa_alsa_mixer_pdata_new(); mixer_callback = io_mixer_callback; @@ -1629,7 +1629,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; size_t frame_size; - pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, sync_volume = FALSE; + pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE; pa_source_new_data data; pa_alsa_profile_set *profile_set = NULL; @@ -1682,9 +1682,9 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p goto fail; } - sync_volume = m->core->sync_volume; - if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) { - pa_log("Failed to parse sync_volume argument."); + deferred_volume = m->core->deferred_volume; + if (pa_modargs_get_value_boolean(ma, "deferred_volume", &deferred_volume) < 0) { + pa_log("Failed to parse deferred_volume argument."); goto fail; } @@ -1695,7 +1695,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p u->module = m; u->use_mmap = use_mmap; u->use_tsched = use_tsched; - u->sync_volume = sync_volume; + u->deferred_volume = deferred_volume; u->first = TRUE; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); @@ -1851,15 +1851,15 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p goto fail; } - if (pa_modargs_get_value_u32(ma, "sync_volume_safety_margin", + if (pa_modargs_get_value_u32(ma, "deferred_volume_safety_margin", &u->source->thread_info.volume_change_safety_margin) < 0) { - pa_log("Failed to parse sync_volume_safety_margin parameter"); + pa_log("Failed to parse deferred_volume_safety_margin parameter"); goto fail; } - if (pa_modargs_get_value_s32(ma, "sync_volume_extra_delay", + if (pa_modargs_get_value_s32(ma, "deferred_volume_extra_delay", &u->source->thread_info.volume_change_extra_delay) < 0) { - pa_log("Failed to parse sync_volume_extra_delay parameter"); + pa_log("Failed to parse deferred_volume_extra_delay parameter"); goto fail; } diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index 7c6b778c..6d1a5e14 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -65,7 +65,7 @@ PA_MODULE_USAGE( "tsched_buffer_watermark= " "profile= " "ignore_dB= " - "sync_volume= " + "deferred_volume= " "profile_set= "); static const char* const valid_modargs[] = { @@ -88,7 +88,7 @@ static const char* const valid_modargs[] = { "tsched_buffer_watermark", "profile", "ignore_dB", - "sync_volume", + "deferred_volume", "profile_set", NULL }; diff --git a/src/modules/alsa/module-alsa-sink.c b/src/modules/alsa/module-alsa-sink.c index 800fd838..2a558a14 100644 --- a/src/modules/alsa/module-alsa-sink.c +++ b/src/modules/alsa/module-alsa-sink.c @@ -56,9 +56,9 @@ PA_MODULE_USAGE( "ignore_dB= " "control= " "rewind_safeguard= " - "sync_volume= " - "sync_volume_safety_margin= " - "sync_volume_extra_delay="); + "deferred_volume= " + "deferred_volume_safety_margin= " + "deferred_volume_extra_delay="); static const char* const valid_modargs[] = { "name", @@ -80,9 +80,9 @@ static const char* const valid_modargs[] = { "ignore_dB", "control", "rewind_safeguard", - "sync_volume", - "sync_volume_safety_margin", - "sync_volume_extra_delay", + "deferred_volume", + "deferred_volume_safety_margin", + "deferred_volume_extra_delay", NULL }; diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c index 46c11766..628e6313 100644 --- a/src/modules/alsa/module-alsa-source.c +++ b/src/modules/alsa/module-alsa-source.c @@ -64,9 +64,9 @@ PA_MODULE_USAGE( "tsched_buffer_watermark= " "ignore_dB= " "control=" - "sync_volume= " - "sync_volume_safety_margin= " - "sync_volume_extra_delay="); + "deferred_volume= " + "deferred_volume_safety_margin= " + "deferred_volume_extra_delay="); static const char* const valid_modargs[] = { "name", @@ -87,9 +87,9 @@ static const char* const valid_modargs[] = { "tsched_buffer_watermark", "ignore_dB", "control", - "sync_volume", - "sync_volume_safety_margin", - "sync_volume_extra_delay", + "deferred_volume", + "deferred_volume_safety_margin", + "deferred_volume_extra_delay", NULL }; diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c index 8b9ec7f0..c5312a81 100644 --- a/src/modules/module-udev-detect.c +++ b/src/modules/module-udev-detect.c @@ -46,7 +46,7 @@ PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_USAGE( "tsched= " "ignore_dB= " - "sync_volume="); + "deferred_volume="); struct device { char *path; @@ -63,7 +63,7 @@ struct userdata { pa_bool_t use_tsched:1; pa_bool_t ignore_dB:1; - pa_bool_t sync_volume:1; + pa_bool_t deferred_volume:1; struct udev* udev; struct udev_monitor *monitor; @@ -76,7 +76,7 @@ struct userdata { static const char* const valid_modargs[] = { "tsched", "ignore_dB", - "sync_volume", + "deferred_volume", NULL }; @@ -389,14 +389,14 @@ static void card_changed(struct userdata *u, struct udev_device *dev) { "namereg_fail=false " "tsched=%s " "ignore_dB=%s " - "sync_volume=%s " + "deferred_volume=%s " "card_properties=\"module-udev-detect.discovered=1\"", path_get_card_id(path), n, d->card_name, pa_yes_no(u->use_tsched), pa_yes_no(u->ignore_dB), - pa_yes_no(u->sync_volume)); + pa_yes_no(u->deferred_volume)); pa_xfree(n); pa_hashmap_put(u->devices, d->path, d); @@ -665,7 +665,7 @@ int pa__init(pa_module *m) { struct udev_enumerate *enumerate = NULL; struct udev_list_entry *item = NULL, *first = NULL; int fd; - pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, sync_volume = m->core->sync_volume; + pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume; pa_assert(m); @@ -692,11 +692,11 @@ int pa__init(pa_module *m) { } u->ignore_dB = ignore_dB; - if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) { - pa_log("Failed to parse sync_volume= argument."); + if (pa_modargs_get_value_boolean(ma, "deferred_volume", &deferred_volume) < 0) { + pa_log("Failed to parse deferred_volume= argument."); goto fail; } - u->sync_volume = sync_volume; + u->deferred_volume = deferred_volume; if (!(u->udev = udev_new())) { pa_log("Failed to initialize udev library."); diff --git a/src/pulse/def.h b/src/pulse/def.h index 386ea2b1..5e2626c9 100644 --- a/src/pulse/def.h +++ b/src/pulse/def.h @@ -753,7 +753,7 @@ typedef enum pa_sink_flags { /**< The latency can be adjusted dynamically depending on the * needs of the connected streams. \since 0.9.15 */ - PA_SINK_SYNC_VOLUME = 0x0100U, + PA_SINK_DEFERRED_VOLUME = 0x0100U, /**< The HW volume changes are syncronized with SW volume. * \since 1.0 */ @@ -782,7 +782,7 @@ typedef enum pa_sink_flags { #define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME #define PA_SINK_FLAT_VOLUME PA_SINK_FLAT_VOLUME #define PA_SINK_DYNAMIC_LATENCY PA_SINK_DYNAMIC_LATENCY -#define PA_SINK_SYNC_VOLUME PA_SINK_SYNC_VOLUME +#define PA_SINK_DEFERRED_VOLUME PA_SINK_DEFERRED_VOLUME #define PA_SINK_SHARE_VOLUME_WITH_MASTER PA_SINK_SHARE_VOLUME_WITH_MASTER #define PA_SINK_SET_FORMATS PA_SINK_SET_FORMATS @@ -869,7 +869,7 @@ typedef enum pa_source_flags { /**< This source is in flat volume mode, i.e. always the maximum of * the volume of all connected outputs. \since 1.0 */ - PA_SOURCE_SYNC_VOLUME = 0x0100U, + PA_SOURCE_DEFERRED_VOLUME = 0x0100U, /**< The HW volume changes are syncronized with SW volume. * \since 1.0 */ @@ -892,7 +892,7 @@ typedef enum pa_source_flags { #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME #define PA_SOURCE_DYNAMIC_LATENCY PA_SOURCE_DYNAMIC_LATENCY #define PA_SOURCE_FLAT_VOLUME PA_SOURCE_FLAT_VOLUME -#define PA_SOURCE_SYNC_VOLUME PA_SOURCE_SYNC_VOLUME +#define PA_SOURCE_DEFERRED_VOLUME PA_SOURCE_DEFERRED_VOLUME #define PA_SOURCE_SHARE_VOLUME_WITH_MASTER PA_SOURCE_SHARE_VOLUME_WITH_MASTER /** \endcond */ diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 3822904e..e4f91403 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -113,8 +113,8 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { c->default_n_fragments = 4; c->default_fragment_size_msec = 25; - c->sync_volume_safety_margin_usec = 8000; - c->sync_volume_extra_delay_usec = 0; + c->deferred_volume_safety_margin_usec = 8000; + c->deferred_volume_extra_delay_usec = 0; c->module_defer_unload_event = NULL; c->scache_auto_unload_event = NULL; @@ -140,7 +140,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { c->realtime_priority = 5; c->disable_remixing = FALSE; c->disable_lfe_remixing = FALSE; - c->sync_volume = TRUE; + c->deferred_volume = TRUE; c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3; for (j = 0; j < PA_CORE_HOOK_MAX; j++) diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index d4639e08..ef51b8cb 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -144,8 +144,8 @@ struct pa_core { pa_channel_map default_channel_map; pa_sample_spec default_sample_spec; unsigned default_n_fragments, default_fragment_size_msec; - unsigned sync_volume_safety_margin_usec; - int sync_volume_extra_delay_usec; + unsigned deferred_volume_safety_margin_usec; + int deferred_volume_extra_delay_usec; pa_defer_event *module_defer_unload_event; @@ -169,7 +169,7 @@ struct pa_core { pa_bool_t realtime_scheduling:1; pa_bool_t disable_remixing:1; pa_bool_t disable_lfe_remixing:1; - pa_bool_t sync_volume:1; + pa_bool_t deferred_volume:1; pa_resample_method_t resample_method; int realtime_priority; diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 041295c4..0350284a 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -343,8 +343,8 @@ pa_sink* pa_sink_new( PA_LLIST_HEAD_INIT(pa_sink_volume_change, s->thread_info.volume_changes); s->thread_info.volume_changes_tail = NULL; pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume); - s->thread_info.volume_change_safety_margin = core->sync_volume_safety_margin_usec; - s->thread_info.volume_change_extra_delay = core->sync_volume_extra_delay_usec; + s->thread_info.volume_change_safety_margin = core->deferred_volume_safety_margin_usec; + s->thread_info.volume_change_extra_delay = core->deferred_volume_extra_delay_usec; /* FIXME: This should probably be moved to pa_sink_put() */ pa_assert_se(pa_idxset_put(core->sinks, s, &s->index) >= 0); @@ -495,9 +495,9 @@ void pa_sink_set_write_volume_callback(pa_sink *s, pa_sink_cb_t cb) { flags = s->flags; if (cb) - s->flags |= PA_SINK_SYNC_VOLUME; + s->flags |= PA_SINK_DEFERRED_VOLUME; else - s->flags &= ~PA_SINK_SYNC_VOLUME; + s->flags &= ~PA_SINK_DEFERRED_VOLUME; /* If the flags have changed after init, let any clients know via a change event */ if (s->state != PA_SINK_INIT && flags != s->flags) @@ -595,7 +595,7 @@ void pa_sink_put(pa_sink* s) { * Note: All of these flags set here can change over the life time * of the sink. */ pa_assert(!(s->flags & PA_SINK_HW_VOLUME_CTRL) || s->set_volume); - pa_assert(!(s->flags & PA_SINK_SYNC_VOLUME) || s->write_volume); + pa_assert(!(s->flags & PA_SINK_DEFERRED_VOLUME) || s->write_volume); pa_assert(!(s->flags & PA_SINK_HW_MUTE_CTRL) || s->set_mute); /* XXX: Currently decibel volume is disabled for all sinks that use volume @@ -919,7 +919,7 @@ void pa_sink_process_rewind(pa_sink *s, size_t nbytes) { if (nbytes > 0) { pa_log_debug("Processing rewind..."); - if (s->flags & PA_SINK_SYNC_VOLUME) + if (s->flags & PA_SINK_DEFERRED_VOLUME) pa_sink_volume_change_rewind(s, nbytes); } @@ -1876,7 +1876,7 @@ void pa_sink_set_volume( * apply one to root_sink->soft_volume */ pa_cvolume_reset(&root_sink->soft_volume, root_sink->sample_spec.channels); - if (!(root_sink->flags & PA_SINK_SYNC_VOLUME)) + if (!(root_sink->flags & PA_SINK_DEFERRED_VOLUME)) root_sink->set_volume(root_sink); } else @@ -1896,7 +1896,7 @@ void pa_sink_set_soft_volume(pa_sink *s, const pa_cvolume *volume) { pa_sink_assert_ref(s); pa_assert(!(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)); - if (s->flags & PA_SINK_SYNC_VOLUME) + if (s->flags & PA_SINK_DEFERRED_VOLUME) pa_sink_assert_io_context(s); else pa_assert_ctl_context(); @@ -1906,7 +1906,7 @@ void pa_sink_set_soft_volume(pa_sink *s, const pa_cvolume *volume) { else s->soft_volume = *volume; - if (PA_SINK_IS_LINKED(s->state) && !(s->flags & PA_SINK_SYNC_VOLUME)) + if (PA_SINK_IS_LINKED(s->state) && !(s->flags & PA_SINK_DEFERRED_VOLUME)) pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_VOLUME, NULL, 0, NULL) == 0); else s->thread_info.soft_volume = s->soft_volume; @@ -1999,7 +1999,7 @@ const pa_cvolume *pa_sink_get_volume(pa_sink *s, pa_bool_t force_refresh) { old_real_volume = s->real_volume; - if (!(s->flags & PA_SINK_SYNC_VOLUME) && s->get_volume) + if (!(s->flags & PA_SINK_DEFERRED_VOLUME) && s->get_volume) s->get_volume(s); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_VOLUME, NULL, 0, NULL) == 0); @@ -2040,7 +2040,7 @@ void pa_sink_set_mute(pa_sink *s, pa_bool_t mute, pa_bool_t save) { s->muted = mute; s->save_muted = (old_muted == s->muted && s->save_muted) || save; - if (!(s->flags & PA_SINK_SYNC_VOLUME) && s->set_mute) + if (!(s->flags & PA_SINK_DEFERRED_VOLUME) && s->set_mute) s->set_mute(s); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0); @@ -2059,7 +2059,7 @@ pa_bool_t pa_sink_get_mute(pa_sink *s, pa_bool_t force_refresh) { if (s->refresh_muted || force_refresh) { pa_bool_t old_muted = s->muted; - if (!(s->flags & PA_SINK_SYNC_VOLUME) && s->get_mute) + if (!(s->flags & PA_SINK_DEFERRED_VOLUME) && s->get_mute) s->get_mute(s); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_MUTE, NULL, 0, NULL) == 0); @@ -2455,7 +2455,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse case PA_SINK_MESSAGE_SET_VOLUME_SYNCED: - if (s->flags & PA_SINK_SYNC_VOLUME) { + if (s->flags & PA_SINK_DEFERRED_VOLUME) { s->set_volume(s); pa_sink_volume_change_push(s); } @@ -2476,7 +2476,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse case PA_SINK_MESSAGE_GET_VOLUME: - if ((s->flags & PA_SINK_SYNC_VOLUME) && s->get_volume) { + if ((s->flags & PA_SINK_DEFERRED_VOLUME) && s->get_volume) { s->get_volume(s); pa_sink_volume_change_flush(s); pa_sw_cvolume_divide(&s->thread_info.current_hw_volume, &s->real_volume, &s->soft_volume); @@ -2497,14 +2497,14 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse pa_sink_request_rewind(s, (size_t) -1); } - if (s->flags & PA_SINK_SYNC_VOLUME && s->set_mute) + if (s->flags & PA_SINK_DEFERRED_VOLUME && s->set_mute) s->set_mute(s); return 0; case PA_SINK_MESSAGE_GET_MUTE: - if (s->flags & PA_SINK_SYNC_VOLUME && s->get_mute) + if (s->flags & PA_SINK_DEFERRED_VOLUME && s->get_mute) s->get_mute(s); return 0; @@ -3087,7 +3087,7 @@ int pa_sink_set_port(pa_sink *s, const char *name, pa_bool_t save) { return 0; } - if (s->flags & PA_SINK_SYNC_VOLUME) { + if (s->flags & PA_SINK_DEFERRED_VOLUME) { struct sink_message_set_port msg = { .port = port, .ret = 0 }; pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_PORT, &msg, 0, NULL) == 0); ret = msg.ret; diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h index e5eaab3a..0642ddae 100644 --- a/src/pulsecore/sink.h +++ b/src/pulsecore/sink.h @@ -139,12 +139,12 @@ struct pa_sink { * (using pa_sink_set_soft_volume()) to match the current hardware * volume. * - * If PA_SINK_SYNC_VOLUME is not set, then this is called from the + * If PA_SINK_DEFERRED_VOLUME is not set, then this is called from the * main thread before sending PA_SINK_MESSAGE_GET_VOLUME, so in * this case the driver can choose whether to read the volume from * the hardware in the main thread or in the IO thread. * - * If PA_SINK_SYNC_VOLUME is set, then this is called from the IO + * If PA_SINK_DEFERRED_VOLUME is set, then this is called from the IO * thread within the default handler for * PA_SINK_MESSAGE_GET_VOLUME (the main thread is waiting while * the message is being processed), so there's no choice of where @@ -159,14 +159,14 @@ struct pa_sink { * callback. This is called when the hardware volume needs to be * updated. * - * If PA_SINK_SYNC_VOLUME is not set, then this is called from the + * If PA_SINK_DEFERRED_VOLUME is not set, then this is called from the * main thread. The callback implementation must set the hardware * volume according to s->real_volume. If the driver can't set the * hardware volume to the exact requested value, it has to update * s->real_volume and/or s->soft_volume so that they together * match the actual hardware volume that was set. * - * If PA_SINK_SYNC_VOLUME is set, then this is called from the IO + * If PA_SINK_DEFERRED_VOLUME is set, then this is called from the IO * thread. The callback implementation must not actually set the * hardware volume yet, but it must check how close to the * requested volume the hardware volume can be set, and update @@ -178,9 +178,9 @@ struct pa_sink { * set this callback. */ pa_sink_cb_t set_volume; /* may be NULL */ - /* Sink drivers that set PA_SINK_SYNC_VOLUME must provide this + /* Sink drivers that set PA_SINK_DEFERRED_VOLUME must provide this * callback. This callback is not used with sinks that do not set - * PA_SINK_SYNC_VOLUME. This is called from the IO thread when a + * PA_SINK_DEFERRED_VOLUME. This is called from the IO thread when a * pending hardware volume change has to be written to the * hardware. The requested volume is passed to the callback * implementation in s->thread_info.current_hw_volume. @@ -195,7 +195,7 @@ struct pa_sink { pa_sink_cb_t write_volume; /* may be NULL */ /* Called when the mute setting is queried. A PA_SINK_MESSAGE_GET_MUTE - * message will also be sent. Called from IO thread if PA_SINK_SYNC_VOLUME + * message will also be sent. Called from IO thread if PA_SINK_DEFERRED_VOLUME * flag is set otherwise from main loop context. If refresh_mute is FALSE * neither this function is called nor a message is sent. * @@ -204,7 +204,7 @@ struct pa_sink { pa_sink_cb_t get_mute; /* may be NULL */ /* Called when the mute setting shall be changed. A PA_SINK_MESSAGE_SET_MUTE - * message will also be sent. Called from IO thread if PA_SINK_SYNC_VOLUME + * message will also be sent. Called from IO thread if PA_SINK_DEFERRED_VOLUME * flag is set otherwise from main loop context. * * You must use the function pa_sink_set_set_mute_callback() to @@ -278,7 +278,7 @@ struct pa_sink { PA_LLIST_HEAD(pa_sink_volume_change, volume_changes); pa_sink_volume_change *volume_changes_tail; /* This value is updated in pa_sink_volume_change_apply() and - * used only by sinks with PA_SINK_SYNC_VOLUME. */ + * used only by sinks with PA_SINK_DEFERRED_VOLUME. */ pa_cvolume current_hw_volume; /* The amount of usec volume up events are delayed and volume diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index bc951af8..84c8edca 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -307,8 +307,8 @@ pa_source* pa_source_new( PA_LLIST_HEAD_INIT(pa_source_volume_change, s->thread_info.volume_changes); s->thread_info.volume_changes_tail = NULL; pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume); - s->thread_info.volume_change_safety_margin = core->sync_volume_safety_margin_usec; - s->thread_info.volume_change_extra_delay = core->sync_volume_extra_delay_usec; + s->thread_info.volume_change_safety_margin = core->deferred_volume_safety_margin_usec; + s->thread_info.volume_change_extra_delay = core->deferred_volume_extra_delay_usec; /* FIXME: This should probably be moved to pa_source_put() */ pa_assert_se(pa_idxset_put(core->sources, s, &s->index) >= 0); @@ -426,9 +426,9 @@ void pa_source_set_write_volume_callback(pa_source *s, pa_source_cb_t cb) { flags = s->flags; if (cb) - s->flags |= PA_SOURCE_SYNC_VOLUME; + s->flags |= PA_SOURCE_DEFERRED_VOLUME; else - s->flags &= ~PA_SOURCE_SYNC_VOLUME; + s->flags &= ~PA_SOURCE_DEFERRED_VOLUME; /* If the flags have changed after init, let any clients know via a change event */ if (s->state != PA_SOURCE_INIT && flags != s->flags) @@ -526,7 +526,7 @@ void pa_source_put(pa_source *s) { * Note: All of these flags set here can change over the life time * of the source. */ pa_assert(!(s->flags & PA_SOURCE_HW_VOLUME_CTRL) || s->set_volume); - pa_assert(!(s->flags & PA_SOURCE_SYNC_VOLUME) || s->write_volume); + pa_assert(!(s->flags & PA_SOURCE_DEFERRED_VOLUME) || s->write_volume); pa_assert(!(s->flags & PA_SOURCE_HW_MUTE_CTRL) || s->set_mute); /* XXX: Currently decibel volume is disabled for all sources that use volume @@ -1452,7 +1452,7 @@ void pa_source_set_volume( * apply one to root_source->soft_volume */ pa_cvolume_reset(&root_source->soft_volume, root_source->sample_spec.channels); - if (!(root_source->flags & PA_SOURCE_SYNC_VOLUME)) + if (!(root_source->flags & PA_SOURCE_DEFERRED_VOLUME)) root_source->set_volume(root_source); } else @@ -1472,7 +1472,7 @@ void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume) { pa_source_assert_ref(s); pa_assert(!(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)); - if (s->flags & PA_SOURCE_SYNC_VOLUME) + if (s->flags & PA_SOURCE_DEFERRED_VOLUME) pa_source_assert_io_context(s); else pa_assert_ctl_context(); @@ -1482,7 +1482,7 @@ void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume) { else s->soft_volume = *volume; - if (PA_SOURCE_IS_LINKED(s->state) && !(s->flags & PA_SOURCE_SYNC_VOLUME)) + if (PA_SOURCE_IS_LINKED(s->state) && !(s->flags & PA_SOURCE_DEFERRED_VOLUME)) pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_VOLUME, NULL, 0, NULL) == 0); else s->thread_info.soft_volume = s->soft_volume; @@ -1575,7 +1575,7 @@ const pa_cvolume *pa_source_get_volume(pa_source *s, pa_bool_t force_refresh) { old_real_volume = s->real_volume; - if (!(s->flags & PA_SOURCE_SYNC_VOLUME) && s->get_volume) + if (!(s->flags & PA_SOURCE_DEFERRED_VOLUME) && s->get_volume) s->get_volume(s); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_VOLUME, NULL, 0, NULL) == 0); @@ -1616,7 +1616,7 @@ void pa_source_set_mute(pa_source *s, pa_bool_t mute, pa_bool_t save) { s->muted = mute; s->save_muted = (old_muted == s->muted && s->save_muted) || save; - if (!(s->flags & PA_SOURCE_SYNC_VOLUME) && s->set_mute) + if (!(s->flags & PA_SOURCE_DEFERRED_VOLUME) && s->set_mute) s->set_mute(s); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0); @@ -1635,7 +1635,7 @@ pa_bool_t pa_source_get_mute(pa_source *s, pa_bool_t force_refresh) { if (s->refresh_muted || force_refresh) { pa_bool_t old_muted = s->muted; - if (!(s->flags & PA_SOURCE_SYNC_VOLUME) && s->get_mute) + if (!(s->flags & PA_SOURCE_DEFERRED_VOLUME) && s->get_mute) s->get_mute(s); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_MUTE, NULL, 0, NULL) == 0); @@ -1885,7 +1885,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ case PA_SOURCE_MESSAGE_SET_VOLUME_SYNCED: - if (s->flags & PA_SOURCE_SYNC_VOLUME) { + if (s->flags & PA_SOURCE_DEFERRED_VOLUME) { s->set_volume(s); pa_source_volume_change_push(s); } @@ -1905,7 +1905,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ case PA_SOURCE_MESSAGE_GET_VOLUME: - if ((s->flags & PA_SOURCE_SYNC_VOLUME) && s->get_volume) { + if ((s->flags & PA_SOURCE_DEFERRED_VOLUME) && s->get_volume) { s->get_volume(s); pa_source_volume_change_flush(s); pa_sw_cvolume_divide(&s->thread_info.current_hw_volume, &s->real_volume, &s->soft_volume); @@ -1924,14 +1924,14 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ s->thread_info.soft_muted = s->muted; } - if (s->flags & PA_SOURCE_SYNC_VOLUME && s->set_mute) + if (s->flags & PA_SOURCE_DEFERRED_VOLUME && s->set_mute) s->set_mute(s); return 0; case PA_SOURCE_MESSAGE_GET_MUTE: - if (s->flags & PA_SOURCE_SYNC_VOLUME && s->get_mute) + if (s->flags & PA_SOURCE_DEFERRED_VOLUME && s->get_mute) s->get_mute(s); return 0; @@ -2423,7 +2423,7 @@ int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save) { return 0; } - if (s->flags & PA_SOURCE_SYNC_VOLUME) { + if (s->flags & PA_SOURCE_DEFERRED_VOLUME) { struct source_message_set_port msg = { .port = port, .ret = 0 }; pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_PORT, &msg, 0, NULL) == 0); ret = msg.ret; diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h index 52e9be67..05f82427 100644 --- a/src/pulsecore/source.h +++ b/src/pulsecore/source.h @@ -133,9 +133,9 @@ struct pa_source { * set this callback. */ pa_source_cb_t set_volume; /* may be NULL */ - /* Source drivers that set PA_SOURCE_SYNC_VOLUME must provide this + /* Source drivers that set PA_SOURCE_DEFERRED_VOLUME must provide this * callback. This callback is not used with source that do not set - * PA_SOURCE_SYNC_VOLUME. This is called from the IO thread when a + * PA_SOURCE_DEFERRED_VOLUME. This is called from the IO thread when a * pending hardware volume change has to be written to the * hardware. The requested volume is passed to the callback * implementation in s->thread_info.current_hw_volume. @@ -207,7 +207,7 @@ struct pa_source { PA_LLIST_HEAD(pa_source_volume_change, volume_changes); pa_source_volume_change *volume_changes_tail; /* This value is updated in pa_source_volume_change_apply() and - * used only by sources with PA_SOURCE_SYNC_VOLUME. */ + * used only by sources with PA_SOURCE_DEFERRED_VOLUME. */ pa_cvolume current_hw_volume; /* The amount of usec volume up events are delayed and volume -- 2.39.2