[pulseaudio-discuss] [PATCH] volume: Fix spelling of PA_DECIBEL_MINFINITY

Peter Meerwald pmeerw at pmeerw.net
Wed May 20 13:47:33 PDT 2015


From: Peter Meerwald <p.meerwald at bct-electronic.com>

... and keep backward-compatible PA_DECIBEL_MININFTY

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulse/volume.c | 10 +++++-----
 src/pulse/volume.h |  5 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 69bef4f..22315cb 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -229,7 +229,7 @@ static double dB_to_linear(double v) {
 }
 
 pa_volume_t pa_sw_volume_from_dB(double dB) {
-    if (isinf(dB) < 0 || dB <= PA_DECIBEL_MININFTY)
+    if (isinf(dB) < 0 || dB <= PA_DECIBEL_MINFINITY)
         return PA_VOLUME_MUTED;
 
     return pa_sw_volume_from_linear(dB_to_linear(dB));
@@ -237,10 +237,10 @@ pa_volume_t pa_sw_volume_from_dB(double dB) {
 
 double pa_sw_volume_to_dB(pa_volume_t v) {
 
-    pa_return_val_if_fail(PA_VOLUME_IS_VALID(v), PA_DECIBEL_MININFTY);
+    pa_return_val_if_fail(PA_VOLUME_IS_VALID(v), PA_DECIBEL_MINFINITY);
 
     if (v <= PA_VOLUME_MUTED)
-        return PA_DECIBEL_MININFTY;
+        return PA_DECIBEL_MINFINITY;
 
     return linear_to_dB(pa_sw_volume_to_linear(v));
 }
@@ -349,7 +349,7 @@ char *pa_sw_cvolume_snprint_dB(char *s, size_t l, const pa_cvolume *c) {
         l -= pa_snprintf(e, l, "%s%u: %0.2f dB",
                          first ? "" : " ",
                          channel,
-                         isinf(f) < 0 || f <= PA_DECIBEL_MININFTY ? -INFINITY : f);
+                         isinf(f) < 0 || f <= PA_DECIBEL_MINFINITY ? -INFINITY : f);
 
         e = strchr(e, 0);
         first = false;
@@ -414,7 +414,7 @@ char *pa_sw_volume_snprint_dB(char *s, size_t l, pa_volume_t v) {
     }
 
     f = pa_sw_volume_to_dB(v);
-    pa_snprintf(s, l, "%0.2f dB", isinf(f) < 0 || f <= PA_DECIBEL_MININFTY ? -INFINITY : f);
+    pa_snprintf(s, l, "%0.2f dB", isinf(f) < 0 || f <= PA_DECIBEL_MINFINITY ? -INFINITY : f);
 
     return s;
 }
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index ec777b2..8aa7447 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -319,11 +319,12 @@ pa_volume_t pa_sw_volume_from_linear(double v) PA_GCC_CONST;
 double pa_sw_volume_to_linear(pa_volume_t v) PA_GCC_CONST;
 
 #ifdef INFINITY
-#define PA_DECIBEL_MININFTY ((double) -INFINITY)
+#define PA_DECIBEL_MINFINITY ((double) -INFINITY)
 #else
 /** This floor value is used as minus infinity when using pa_sw_volume_to_dB() / pa_sw_volume_from_dB(). */
-#define PA_DECIBEL_MININFTY ((double) -200.0)
+#define PA_DECIBEL_MINFINITY ((double) -200.0)
 #endif
+#define PA_DECIBEL_MININFTY PA_DECIBEL_MINFINITY
 
 /** Remap a volume from one channel mapping to a different channel mapping. \since 0.9.12 */
 pa_cvolume *pa_cvolume_remap(pa_cvolume *v, const pa_channel_map *from, const pa_channel_map *to);
-- 
1.9.1



More information about the pulseaudio-discuss mailing list