]> code.delx.au - pulseaudio/commitdiff
add new paramter ignore_dB= to alsa modules
authorLennart Poettering <lennart@poettering.net>
Tue, 27 Jan 2009 16:55:50 +0000 (17:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Jan 2009 16:55:50 +0000 (17:55 +0100)
src/modules/alsa/alsa-sink.c
src/modules/alsa/alsa-source.c
src/modules/alsa/module-alsa-card.c
src/modules/alsa/module-alsa-sink.c
src/modules/alsa/module-alsa-source.c

index 3503c4a3a8a20615f3cc37ad943eab5ba8aab683..4328957e079b256312bc44269d0ad473a5f5e700 100644 (file)
@@ -1236,7 +1236,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     size_t frame_size;
     snd_pcm_info_t *pcm_info = NULL;
     int err;
-    pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d;
+    pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
     pa_usec_t usec;
     pa_sink_new_data data;
 
@@ -1282,6 +1282,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         goto fail;
     }
 
+    if (pa_modargs_get_value_boolean(ma, "ignore_dB", &ignore_dB) < 0) {
+        pa_log("Failed to parse ignore_dB argument.");
+        goto fail;
+    }
+
     if (use_tsched && !pa_rtclock_hrtimer()) {
         pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel.");
         use_tsched = FALSE;
@@ -1503,8 +1508,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
             }
 
             if (suitable) {
-                if (snd_mixer_selem_get_playback_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
-                    pa_log_info("Mixer doesn't support dB information.");
+                if (ignore_dB || snd_mixer_selem_get_playback_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
+                    pa_log_info("Mixer doesn't support dB information or data is ignored.");
                 else {
 #ifdef HAVE_VALGRIND_MEMCHECK_H
                     VALGRIND_MAKE_MEM_DEFINED(&u->hw_dB_min, sizeof(u->hw_dB_min));
index c4d34180dbb4d9bfa31ad70210c2b82b09854473..42042978ae7d0c6250b807eb076a37332d210266 100644 (file)
@@ -1072,7 +1072,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     size_t frame_size;
     snd_pcm_info_t *pcm_info = NULL;
     int err;
-    pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d;
+    pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
     pa_source_new_data data;
 
     snd_pcm_info_alloca(&pcm_info);
@@ -1116,6 +1116,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         goto fail;
     }
 
+    if (pa_modargs_get_value_boolean(ma, "ignore_dB", &ignore_dB) < 0) {
+        pa_log("Failed to parse ignore_dB argument.");
+        goto fail;
+    }
+
     if (use_tsched && !pa_rtclock_hrtimer()) {
         pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel.");
         use_tsched = FALSE;
@@ -1324,8 +1329,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
             }
 
             if (suitable) {
-                if (snd_mixer_selem_get_capture_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
-                    pa_log_info("Mixer doesn't support dB information.");
+                if (ignore_dB || snd_mixer_selem_get_capture_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
+                    pa_log_info("Mixer doesn't support dB information or data is ignored.");
                 else {
 #ifdef HAVE_VALGRIND_MEMCHECK_H
                     VALGRIND_MAKE_MEM_DEFINED(&u->hw_dB_min, sizeof(u->hw_dB_min));
index 891195c3554837d1ef7f99673f7b9e88dd52c2a4..8f192c2ef3a8b75a38fc01fbe930765bc36d7bed 100644 (file)
@@ -51,7 +51,8 @@ PA_MODULE_USAGE(
         "tsched=<enable system timer based scheduling mode?> "
         "tsched_buffer_size=<buffer size when using timer based scheduling> "
         "tsched_buffer_watermark=<lower fill watermark> "
-        "profile=<profile name>");
+        "profile=<profile name> "
+        "ignore_dB=<ignore dB information from the device?>");
 
 static const char* const valid_modargs[] = {
     "name",
@@ -68,6 +69,7 @@ static const char* const valid_modargs[] = {
     "tsched_buffer_size",
     "tsched_buffer_watermark",
     "profile",
+    "ignore_dB",
     NULL
 };
 
index 6cf48b58d28881212a62d1f53ba98f421cb5f21b..4f844e0822fd9d9a37cae58243f4f43358f2263c 100644 (file)
@@ -51,7 +51,8 @@ PA_MODULE_USAGE(
         "mmap=<enable memory mapping?> "
         "tsched=<enable system timer based scheduling mode?> "
         "tsched_buffer_size=<buffer size when using timer based scheduling> "
-        "tsched_buffer_watermark=<lower fill watermark>");
+        "tsched_buffer_watermark=<lower fill watermark> "
+        "ignore_dB=<ignore dB information from the device?>");
 
 static const char* const valid_modargs[] = {
     "name",
@@ -68,6 +69,7 @@ static const char* const valid_modargs[] = {
     "tsched",
     "tsched_buffer_size",
     "tsched_buffer_watermark",
+    "ignore_dB",
     NULL
 };
 
index 1e7c387cc192a06b30d4835213ad220e7e466f75..c35936dfb748d12fa58a93b63821cef15676c76e 100644 (file)
@@ -75,7 +75,8 @@ PA_MODULE_USAGE(
         "mmap=<enable memory mapping?> "
         "tsched=<enable system timer based scheduling mode?> "
         "tsched_buffer_size=<buffer size when using timer based scheduling> "
-        "tsched_buffer_watermark=<upper fill watermark>");
+        "tsched_buffer_watermark=<upper fill watermark> "
+        "ignore_dB=<ignore dB information from the device?>");
 
 static const char* const valid_modargs[] = {
     "name",
@@ -92,6 +93,7 @@ static const char* const valid_modargs[] = {
     "tsched",
     "tsched_buffer_size",
     "tsched_buffer_watermark",
+    "ignore_dB",
     NULL
 };