]> code.delx.au - pulseaudio/commitdiff
Add new option to disable remixing from/to LFE and set it to on by default
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Sep 2008 13:04:42 +0000 (16:04 +0300)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Sep 2008 13:04:42 +0000 (16:04 +0300)
man/pulse-daemon.conf.5.xml.in
src/daemon/daemon-conf.c
src/daemon/daemon-conf.h
src/daemon/daemon.conf.in
src/daemon/main.c
src/pulsecore/core.c
src/pulsecore/core.h
src/pulsecore/resampler.c
src/pulsecore/resampler.h
src/pulsecore/sink-input.c
src/pulsecore/source-output.c

index c2eefaa56a6552b7afc8b3af545aadcb05facb32..ed158dfa06ee024e9ae87da83a7b272e0185eab9 100644 (file)
@@ -105,6 +105,16 @@ USA.
       matching only.</p>
     </option>
 
+    <option>
+      <p><opt>disable-lfe-remixing=</opt> When upmixing or downmixing
+      ignore LFE channels. When this option is on the output LFE
+      channel will only get a signal when an input LFE channel is
+      available as well. If no input LFE channel is available the
+      output LFE channel will always be 0. If no output LFE channel is
+      available the signal on the input LFE channel will be
+      ignored.</p>
+    </option>
+
     <option>
       <p><opt>use-pid-file=</opt> Create a PID file in
       <file>/tmp/pulse-$USER/pid</file>. Of this is enabled you may
index 40e0a170f397f86588def7d86b913afaf9cc5415..77da3f7ebabea395019eb57403d4d8120bc18255 100644 (file)
@@ -76,6 +76,7 @@ static const pa_daemon_conf default_conf = {
     .log_level = PA_LOG_NOTICE,
     .resample_method = PA_RESAMPLER_AUTO,
     .disable_remixing = FALSE,
+    .disable_lfe_remixing = TRUE,
     .config_file = NULL,
     .use_pid_file = TRUE,
     .system_instance = FALSE,
@@ -426,6 +427,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
         { "default-fragment-size-msec", parse_fragment_size_msec, NULL },
         { "nice-level",                 parse_nice_level,         NULL },
         { "disable-remixing",           pa_config_parse_bool,     NULL },
+        { "disable-lfe-remixing",       pa_config_parse_bool,     NULL },
         { "load-default-script-file",   pa_config_parse_bool,     NULL },
 #ifdef HAVE_SYS_RESOURCE_H
         { "rlimit-fsize",               parse_rlimit,             NULL },
@@ -490,66 +492,67 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
     table[24].data = c;
     table[25].data = c;
     table[26].data = &c->disable_remixing;
-    table[27].data = &c->load_default_script_file;
+    table[27].data = &c->disable_lfe_remixing;
+    table[28].data = &c->load_default_script_file;
 #ifdef HAVE_SYS_RESOURCE_H
-    table[28].data = &c->rlimit_fsize;
-    table[29].data = &c->rlimit_data;
-    table[30].data = &c->rlimit_stack;
-    table[31].data = &c->rlimit_as;
-    table[32].data = &c->rlimit_core;
-    table[33].data = &c->rlimit_nofile;
-    table[34].data = &c->rlimit_as;
+    table[29].data = &c->rlimit_fsize;
+    table[30].data = &c->rlimit_data;
+    table[31].data = &c->rlimit_stack;
+    table[32].data = &c->rlimit_as;
+    table[33].data = &c->rlimit_core;
+    table[34].data = &c->rlimit_nofile;
+    table[35].data = &c->rlimit_as;
 #ifdef RLIMIT_NPROC
-    table[35].data = &c->rlimit_nproc;
+    table[36].data = &c->rlimit_nproc;
 #endif
 
 #ifdef RLIMIT_MEMLOCK
 #ifndef RLIMIT_NPROC
 #error "Houston, we have a numbering problem!"
 #endif
-    table[36].data = &c->rlimit_memlock;
+    table[37].data = &c->rlimit_memlock;
 #endif
 
 #ifdef RLIMIT_LOCKS
 #ifndef RLIMIT_MEMLOCK
 #error "Houston, we have a numbering problem!"
 #endif
-    table[37].data = &c->rlimit_locks;
+    table[38].data = &c->rlimit_locks;
 #endif
 
 #ifdef RLIMIT_SIGPENDING
 #ifndef RLIMIT_LOCKS
 #error "Houston, we have a numbering problem!"
 #endif
-    table[38].data = &c->rlimit_sigpending;
+    table[39].data = &c->rlimit_sigpending;
 #endif
 
 #ifdef RLIMIT_MSGQUEUE
 #ifndef RLIMIT_SIGPENDING
 #error "Houston, we have a numbering problem!"
 #endif
-    table[39].data = &c->rlimit_msgqueue;
+    table[40].data = &c->rlimit_msgqueue;
 #endif
 
 #ifdef RLIMIT_NICE
 #ifndef RLIMIT_MSGQUEUE
 #error "Houston, we have a numbering problem!"
 #endif
-    table[40].data = &c->rlimit_nice;
+    table[41].data = &c->rlimit_nice;
 #endif
 
 #ifdef RLIMIT_RTPRIO
 #ifndef RLIMIT_NICE
 #error "Houston, we have a numbering problem!"
 #endif
-    table[41].data = &c->rlimit_rtprio;
+    table[42].data = &c->rlimit_rtprio;
 #endif
 
 #ifdef RLIMIT_RTTIME
 #ifndef RLIMIT_RTTIME
 #error "Houston, we have a numbering problem!"
 #endif
-    table[42].data = &c->rlimit_rttime;
+    table[43].data = &c->rlimit_rttime;
 #endif
 #endif
 
@@ -661,6 +664,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     pa_strbuf_printf(s, "log-level = %s\n", log_level_to_string[c->log_level]);
     pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method));
     pa_strbuf_printf(s, "disable-remixing = %s\n", pa_yes_no(c->disable_remixing));
+    pa_strbuf_printf(s, "disable-lfe-remixing = %s\n", pa_yes_no(c->disable_lfe_remixing));
     pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
     pa_strbuf_printf(s, "default-sample-rate = %u\n", c->default_sample_spec.rate);
     pa_strbuf_printf(s, "default-sample-channels = %u\n", c->default_sample_spec.channels);
index c42984f99ccca13d8455ae4240ae7d44ad831092..309a142850def4ade658ed2e7b67ae585224c29d 100644 (file)
@@ -66,6 +66,7 @@ typedef struct pa_daemon_conf {
         no_cpu_limit,
         disable_shm,
         disable_remixing,
+        disable_lfe_remixing,
         load_default_script_file,
         disallow_exit;
     int exit_idle_time,
index 33b1d61d9a4ff3eb441da4d2efc33e8763d78824..ea09fe09c6fbd7dd1937ece47f4230fa7290a38d 100644 (file)
@@ -47,6 +47,7 @@
 
 ; resample-method = speex-float-3
 ; disable-remixing = no
+; disable-lfe-remixing = yes
 
 ; no-cpu-limit = no
 
index bb8af444e94dec30d9b5c03cc5f7a6560f091eab..f91573b4c36b87bc7f6494f6203b4ce1d28f377d 100644 (file)
@@ -869,6 +869,7 @@ int main(int argc, char *argv[]) {
     c->realtime_priority = conf->realtime_priority;
     c->realtime_scheduling = !!conf->realtime_scheduling;
     c->disable_remixing = !!conf->disable_remixing;
+    c->disable_lfe_remixing = !!conf->disable_lfe_remixing;
     c->running_as_daemon = !!conf->daemonize;
     c->disallow_exit = conf->disallow_exit;
 
index 6f8a292984b6e0e13b94010b28a36f870f122bd9..bd956ae0b5b287198a3873e865bca53681b42e73 100644 (file)
@@ -138,6 +138,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
     c->realtime_scheduling = FALSE;
     c->realtime_priority = 5;
     c->disable_remixing = FALSE;
+    c->disable_lfe_remixing = FALSE;
 
     for (j = 0; j < PA_CORE_HOOK_MAX; j++)
         pa_hook_init(&c->hooks[j], c);
index eb7684185a2348243a3cf0d6d0e95e31dea9d950..fb4490f2fc0a5386484ce5e948c770e69add4f80 100644 (file)
@@ -124,6 +124,7 @@ struct pa_core {
     pa_bool_t running_as_daemon:1;
     pa_bool_t realtime_scheduling:1;
     pa_bool_t disable_remixing:1;
+    pa_bool_t disable_lfe_remixing:1;
 
     pa_resample_method_t resample_method;
     int realtime_priority;
index 45cd68c1cf051c20181ec05331274677f306fb0f..0ae029b3fda8169bc1a60d6040f594dbdaa5bfa4 100644 (file)
@@ -716,7 +716,11 @@ static void calc_map_table(pa_resampler *r) {
                  * channels for LFE. */
 
                 for (ic = 0; ic < r->i_ss.channels; ic++) {
-                    r->map_table[oc][ic] = 1.0f / (float) r->i_ss.channels;
+
+                    if (!(r->flags & PA_RESAMPLER_NO_LFE))
+                        r->map_table[oc][ic] = 1.0f / (float) r->i_ss.channels;
+                    else
+                        r->map_table[oc][ic] = 0;
 
                     /* Please note that a channel connected to LFE
                      * doesn't really count as connected. */
@@ -851,7 +855,7 @@ static void calc_map_table(pa_resampler *r) {
             }
         }
 
-        if (ic_unconnected_lfe > 0) {
+        if (ic_unconnected_lfe > 0 && !(r->flags & PA_RESAMPLER_NO_LFE)) {
 
             /* OK, so there is an unconnected LFE channel. Let's mix
              * it into all channels, with factor 0.375 */
index 5e302a9b953112dfa30696e873447bce8bf37fdc..87110cc2dd90d5527e6007d205ff929332d494f3 100644 (file)
@@ -49,9 +49,10 @@ typedef enum pa_resample_method {
 } pa_resample_method_t;
 
 typedef enum pa_resample_flags {
-    PA_RESAMPLER_VARIABLE_RATE = 1,
-    PA_RESAMPLER_NO_REMAP = 2,  /* implies NO_REMIX */
-    PA_RESAMPLER_NO_REMIX = 4
+    PA_RESAMPLER_VARIABLE_RATE = 0x0001U,
+    PA_RESAMPLER_NO_REMAP      = 0x0002U,  /* implies NO_REMIX */
+    PA_RESAMPLER_NO_REMIX      = 0x0004U,
+    PA_RESAMPLER_NO_LFE        = 0x0008U
 } pa_resample_flags_t;
 
 pa_resampler* pa_resampler_new(
index 7d80242f44ea5e0eb6ac85f36b51528a1f62f3a1..326a7e2ce1651c6ace61eacffff0701805e99848 100644 (file)
@@ -201,7 +201,8 @@ pa_sink_input* pa_sink_input_new(
                       data->resample_method,
                       ((flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
                       ((flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-                      (core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {
+                      (core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+                      (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
             pa_log_warn("Unsupported resampling operation.");
             return NULL;
         }
index 5df950a87d22e7e7b5281af2ce012382f210b45d..d76f6e4e94bda85889b046a4dcd7e4aa4e121383 100644 (file)
@@ -171,7 +171,8 @@ pa_source_output* pa_source_output_new(
                       data->resample_method,
                       ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
                       ((flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-                      (core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {
+                      (core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+                      (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
             pa_log_warn("Unsupported resampling operation.");
             return NULL;
         }