mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	daemon-conf: Add sync volume parameters to daemon-conf
Signed-off-by: Jyri Sarha <jyri.sarha@nokia.com> Reviewed-by: Tanu Kaskinen <tanu.kaskinen@digia.com> Reviewd-by: Colin Guthrie <cguthrie@mandriva.org>
This commit is contained in:
		
							parent
							
								
									43b3f39a2f
								
							
						
					
					
						commit
						3e53e3bba3
					
				
					 9 changed files with 31 additions and 6 deletions
				
			
		| 
						 | 
					@ -89,8 +89,11 @@ static const pa_daemon_conf default_conf = {
 | 
				
			||||||
    .no_cpu_limit = TRUE,
 | 
					    .no_cpu_limit = TRUE,
 | 
				
			||||||
    .disable_shm = FALSE,
 | 
					    .disable_shm = FALSE,
 | 
				
			||||||
    .lock_memory = FALSE,
 | 
					    .lock_memory = FALSE,
 | 
				
			||||||
 | 
					    .sync_volume = TRUE,
 | 
				
			||||||
    .default_n_fragments = 4,
 | 
					    .default_n_fragments = 4,
 | 
				
			||||||
    .default_fragment_size_msec = 25,
 | 
					    .default_fragment_size_msec = 25,
 | 
				
			||||||
 | 
					    .sync_volume_safety_margin_usec = 8000,
 | 
				
			||||||
 | 
					    .sync_volume_extra_delay_usec = 0,
 | 
				
			||||||
    .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 },
 | 
					    .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 } },
 | 
					    .default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } },
 | 
				
			||||||
    .shm_size = 0
 | 
					    .shm_size = 0
 | 
				
			||||||
| 
						 | 
					@ -508,6 +511,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
 | 
				
			||||||
        { "enable-shm",                 pa_config_parse_not_bool, &c->disable_shm, NULL },
 | 
					        { "enable-shm",                 pa_config_parse_not_bool, &c->disable_shm, NULL },
 | 
				
			||||||
        { "flat-volumes",               pa_config_parse_bool,     &c->flat_volumes, NULL },
 | 
					        { "flat-volumes",               pa_config_parse_bool,     &c->flat_volumes, NULL },
 | 
				
			||||||
        { "lock-memory",                pa_config_parse_bool,     &c->lock_memory, NULL },
 | 
					        { "lock-memory",                pa_config_parse_bool,     &c->lock_memory, NULL },
 | 
				
			||||||
 | 
					        { "enable-sync-volume",         pa_config_parse_bool,     &c->sync_volume, NULL },
 | 
				
			||||||
        { "exit-idle-time",             pa_config_parse_int,      &c->exit_idle_time, 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 },
 | 
					        { "scache-idle-time",           pa_config_parse_int,      &c->scache_idle_time, NULL },
 | 
				
			||||||
        { "realtime-priority",          parse_rtprio,             c, NULL },
 | 
					        { "realtime-priority",          parse_rtprio,             c, NULL },
 | 
				
			||||||
| 
						 | 
					@ -523,6 +527,8 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
 | 
				
			||||||
        { "default-channel-map",        parse_channel_map,        &ci,  NULL },
 | 
					        { "default-channel-map",        parse_channel_map,        &ci,  NULL },
 | 
				
			||||||
        { "default-fragments",          parse_fragments,          c, NULL },
 | 
					        { "default-fragments",          parse_fragments,          c, NULL },
 | 
				
			||||||
        { "default-fragment-size-msec", parse_fragment_size_msec, 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 },
 | 
				
			||||||
        { "nice-level",                 parse_nice_level,         c, NULL },
 | 
					        { "nice-level",                 parse_nice_level,         c, NULL },
 | 
				
			||||||
        { "disable-remixing",           pa_config_parse_bool,     &c->disable_remixing, NULL },
 | 
					        { "disable-remixing",           pa_config_parse_bool,     &c->disable_remixing, NULL },
 | 
				
			||||||
        { "enable-remixing",            pa_config_parse_not_bool, &c->disable_remixing, NULL },
 | 
					        { "enable-remixing",            pa_config_parse_not_bool, &c->disable_remixing, NULL },
 | 
				
			||||||
| 
						 | 
					@ -706,6 +712,7 @@ 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, "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, "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, "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, "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, "scache-idle-time = %i\n", c->scache_idle_time);
 | 
				
			||||||
    pa_strbuf_printf(s, "dl-search-path = %s\n", pa_strempty(c->dl_search_path));
 | 
					    pa_strbuf_printf(s, "dl-search-path = %s\n", pa_strempty(c->dl_search_path));
 | 
				
			||||||
| 
						 | 
					@ -722,6 +729,8 @@ 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-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-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, "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, "shm-size-bytes = %lu\n", (unsigned long) c->shm_size);
 | 
					    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-meta = %s\n", pa_yes_no(c->log_meta));
 | 
				
			||||||
    pa_strbuf_printf(s, "log-time = %s\n", pa_yes_no(c->log_time));
 | 
					    pa_strbuf_printf(s, "log-time = %s\n", pa_yes_no(c->log_time));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,8 @@ typedef struct pa_daemon_conf {
 | 
				
			||||||
        log_meta,
 | 
					        log_meta,
 | 
				
			||||||
        log_time,
 | 
					        log_time,
 | 
				
			||||||
        flat_volumes,
 | 
					        flat_volumes,
 | 
				
			||||||
        lock_memory;
 | 
					        lock_memory,
 | 
				
			||||||
 | 
					        sync_volume;
 | 
				
			||||||
    pa_server_type_t local_server_type;
 | 
					    pa_server_type_t local_server_type;
 | 
				
			||||||
    int exit_idle_time,
 | 
					    int exit_idle_time,
 | 
				
			||||||
        scache_idle_time,
 | 
					        scache_idle_time,
 | 
				
			||||||
| 
						 | 
					@ -127,6 +128,8 @@ typedef struct pa_daemon_conf {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unsigned default_n_fragments, default_fragment_size_msec;
 | 
					    unsigned default_n_fragments, default_fragment_size_msec;
 | 
				
			||||||
 | 
					    unsigned sync_volume_safety_margin_usec;
 | 
				
			||||||
 | 
					    int sync_volume_extra_delay_usec;
 | 
				
			||||||
    pa_sample_spec default_sample_spec;
 | 
					    pa_sample_spec default_sample_spec;
 | 
				
			||||||
    pa_channel_map default_channel_map;
 | 
					    pa_channel_map default_channel_map;
 | 
				
			||||||
    size_t shm_size;
 | 
					    size_t shm_size;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,3 +80,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
; default-fragments = 4
 | 
					; default-fragments = 4
 | 
				
			||||||
; default-fragment-size-msec = 25
 | 
					; default-fragment-size-msec = 25
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					; enable-sync-volume = yes
 | 
				
			||||||
 | 
					; sync-volume-safety-margin-usec = 8000
 | 
				
			||||||
 | 
					; sync-volume-extra-delay-usec = 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -945,6 +945,8 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
    c->default_channel_map = conf->default_channel_map;
 | 
					    c->default_channel_map = conf->default_channel_map;
 | 
				
			||||||
    c->default_n_fragments = conf->default_n_fragments;
 | 
					    c->default_n_fragments = conf->default_n_fragments;
 | 
				
			||||||
    c->default_fragment_size_msec = conf->default_fragment_size_msec;
 | 
					    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->exit_idle_time = conf->exit_idle_time;
 | 
					    c->exit_idle_time = conf->exit_idle_time;
 | 
				
			||||||
    c->scache_idle_time = conf->scache_idle_time;
 | 
					    c->scache_idle_time = conf->scache_idle_time;
 | 
				
			||||||
    c->resample_method = conf->resample_method;
 | 
					    c->resample_method = conf->resample_method;
 | 
				
			||||||
| 
						 | 
					@ -952,6 +954,7 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
    c->realtime_scheduling = !!conf->realtime_scheduling;
 | 
					    c->realtime_scheduling = !!conf->realtime_scheduling;
 | 
				
			||||||
    c->disable_remixing = !!conf->disable_remixing;
 | 
					    c->disable_remixing = !!conf->disable_remixing;
 | 
				
			||||||
    c->disable_lfe_remixing = !!conf->disable_lfe_remixing;
 | 
					    c->disable_lfe_remixing = !!conf->disable_lfe_remixing;
 | 
				
			||||||
 | 
					    c->sync_volume = !!conf->sync_volume;
 | 
				
			||||||
    c->running_as_daemon = !!conf->daemonize;
 | 
					    c->running_as_daemon = !!conf->daemonize;
 | 
				
			||||||
    c->disallow_exit = conf->disallow_exit;
 | 
					    c->disallow_exit = conf->disallow_exit;
 | 
				
			||||||
    c->flat_volumes = conf->flat_volumes;
 | 
					    c->flat_volumes = conf->flat_volumes;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1831,6 +1831,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sync_volume = m->core->sync_volume;
 | 
				
			||||||
    if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) {
 | 
					    if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) {
 | 
				
			||||||
        pa_log("Failed to parse sync_volume argument.");
 | 
					        pa_log("Failed to parse sync_volume argument.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -666,7 +666,7 @@ int pa__init(pa_module *m) {
 | 
				
			||||||
    struct udev_enumerate *enumerate = NULL;
 | 
					    struct udev_enumerate *enumerate = NULL;
 | 
				
			||||||
    struct udev_list_entry *item = NULL, *first = NULL;
 | 
					    struct udev_list_entry *item = NULL, *first = NULL;
 | 
				
			||||||
    int fd;
 | 
					    int fd;
 | 
				
			||||||
    pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, sync_volume = FALSE;
 | 
					    pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, sync_volume = m->core->sync_volume;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(m);
 | 
					    pa_assert(m);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,6 +117,9 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
 | 
				
			||||||
    c->default_n_fragments = 4;
 | 
					    c->default_n_fragments = 4;
 | 
				
			||||||
    c->default_fragment_size_msec = 25;
 | 
					    c->default_fragment_size_msec = 25;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    c->sync_volume_safety_margin_usec = 8000;
 | 
				
			||||||
 | 
					    c->sync_volume_extra_delay_usec = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    c->module_defer_unload_event = NULL;
 | 
					    c->module_defer_unload_event = NULL;
 | 
				
			||||||
    c->scache_auto_unload_event = NULL;
 | 
					    c->scache_auto_unload_event = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,6 +144,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
 | 
				
			||||||
    c->realtime_priority = 5;
 | 
					    c->realtime_priority = 5;
 | 
				
			||||||
    c->disable_remixing = FALSE;
 | 
					    c->disable_remixing = FALSE;
 | 
				
			||||||
    c->disable_lfe_remixing = FALSE;
 | 
					    c->disable_lfe_remixing = FALSE;
 | 
				
			||||||
 | 
					    c->sync_volume = TRUE;
 | 
				
			||||||
    c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
 | 
					    c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (j = 0; j < PA_CORE_HOOK_MAX; j++)
 | 
					    for (j = 0; j < PA_CORE_HOOK_MAX; j++)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,6 +142,8 @@ struct pa_core {
 | 
				
			||||||
    pa_channel_map default_channel_map;
 | 
					    pa_channel_map default_channel_map;
 | 
				
			||||||
    pa_sample_spec default_sample_spec;
 | 
					    pa_sample_spec default_sample_spec;
 | 
				
			||||||
    unsigned default_n_fragments, default_fragment_size_msec;
 | 
					    unsigned default_n_fragments, default_fragment_size_msec;
 | 
				
			||||||
 | 
					    unsigned sync_volume_safety_margin_usec;
 | 
				
			||||||
 | 
					    int sync_volume_extra_delay_usec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_defer_event *module_defer_unload_event;
 | 
					    pa_defer_event *module_defer_unload_event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,6 +167,7 @@ struct pa_core {
 | 
				
			||||||
    pa_bool_t realtime_scheduling:1;
 | 
					    pa_bool_t realtime_scheduling:1;
 | 
				
			||||||
    pa_bool_t disable_remixing:1;
 | 
					    pa_bool_t disable_remixing:1;
 | 
				
			||||||
    pa_bool_t disable_lfe_remixing:1;
 | 
					    pa_bool_t disable_lfe_remixing:1;
 | 
				
			||||||
 | 
					    pa_bool_t sync_volume:1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_resample_method_t resample_method;
 | 
					    pa_resample_method_t resample_method;
 | 
				
			||||||
    int realtime_priority;
 | 
					    int realtime_priority;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,8 +53,6 @@
 | 
				
			||||||
#define ABSOLUTE_MIN_LATENCY (500)
 | 
					#define ABSOLUTE_MIN_LATENCY (500)
 | 
				
			||||||
#define ABSOLUTE_MAX_LATENCY (10*PA_USEC_PER_SEC)
 | 
					#define ABSOLUTE_MAX_LATENCY (10*PA_USEC_PER_SEC)
 | 
				
			||||||
#define DEFAULT_FIXED_LATENCY (250*PA_USEC_PER_MSEC)
 | 
					#define DEFAULT_FIXED_LATENCY (250*PA_USEC_PER_MSEC)
 | 
				
			||||||
#define VOLUME_CHANGE_SAFETY_MARGIN_DEFAULT (8*PA_USEC_PER_MSEC)
 | 
					 | 
				
			||||||
#define VOLUME_CHANGE_EXTRA_DELAY_DEFAULT (0*PA_USEC_PER_MSEC)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
PA_DEFINE_PUBLIC_CLASS(pa_sink, pa_msgobject);
 | 
					PA_DEFINE_PUBLIC_CLASS(pa_sink, pa_msgobject);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -333,8 +331,8 @@ pa_sink* pa_sink_new(
 | 
				
			||||||
    PA_LLIST_HEAD_INIT(pa_sink_volume_change, s->thread_info.volume_changes);
 | 
					    PA_LLIST_HEAD_INIT(pa_sink_volume_change, s->thread_info.volume_changes);
 | 
				
			||||||
    s->thread_info.volume_changes_tail = NULL;
 | 
					    s->thread_info.volume_changes_tail = NULL;
 | 
				
			||||||
    pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume);
 | 
					    pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume);
 | 
				
			||||||
    s->thread_info.volume_change_safety_margin = VOLUME_CHANGE_SAFETY_MARGIN_DEFAULT;
 | 
					    s->thread_info.volume_change_safety_margin = core->sync_volume_safety_margin_usec;
 | 
				
			||||||
    s->thread_info.volume_change_extra_delay = VOLUME_CHANGE_EXTRA_DELAY_DEFAULT;
 | 
					    s->thread_info.volume_change_extra_delay = core->sync_volume_extra_delay_usec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* FIXME: This should probably be moved to pa_sink_put() */
 | 
					    /* FIXME: This should probably be moved to pa_sink_put() */
 | 
				
			||||||
    pa_assert_se(pa_idxset_put(core->sinks, s, &s->index) >= 0);
 | 
					    pa_assert_se(pa_idxset_put(core->sinks, s, &s->index) >= 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue