[alsa-devel] [PATCH] pcm_ladspa: add support for softfloat

Mike Frysinger vapier at gentoo.org
Wed Jan 7 11:06:50 CET 2009


The ladspa module uses math functions unconditionally which breaks when
building with --with-softfloat.  Tweak the code to only call the math
functions when HAVE_SOFT_FLOAT is not defined.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 src/pcm/pcm_ladspa.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
index 5161820..0e9321c 100644
--- a/src/pcm/pcm_ladspa.c
+++ b/src/pcm/pcm_ladspa.c
@@ -34,7 +34,9 @@
   
 #include <dirent.h>
 #include <locale.h>
+#ifndef HAVE_SOFT_FLOAT
 #include <math.h>
+#endif
 #include "pcm_local.h"
 #include "pcm_plugin.h"
 
@@ -511,36 +513,39 @@ static void snd_pcm_ladspa_get_default_cvalue(const LADSPA_Descriptor * desc, un
                 *val = desc->PortRangeHints[port].LowerBound;
                 break;
         case LADSPA_HINT_DEFAULT_LOW:
-                if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) {
+#ifndef HAVE_SOFT_FLOAT
+                if (LADSPA_IS_HINT_LOGARITHMIC(hdesc))
                         *val = exp(log(desc->PortRangeHints[port].LowerBound)
                                         * 0.75
                                         + log(desc->PortRangeHints[port].UpperBound)
                                         * 0.25);
-                } else {
+                else
+#endif
                         *val = (desc->PortRangeHints[port].LowerBound * 0.75) +
                                (desc->PortRangeHints[port].UpperBound * 0.25);
-                }
                 break;
         case LADSPA_HINT_DEFAULT_MIDDLE:
-                if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) {
+#ifndef HAVE_SOFT_FLOAT
+                if (LADSPA_IS_HINT_LOGARITHMIC(hdesc))
                         *val = sqrt(desc->PortRangeHints[port].LowerBound *
                                     desc->PortRangeHints[port].UpperBound);
-                } else {
+                else
+#endif
                         *val = 0.5 *
                                (desc->PortRangeHints[port].LowerBound +
                                 desc->PortRangeHints[port].UpperBound);
-                }
                 break;
         case LADSPA_HINT_DEFAULT_HIGH:
-                if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) {
+#ifndef HAVE_SOFT_FLOAT
+                if (LADSPA_IS_HINT_LOGARITHMIC(hdesc))
                         *val = exp(log(desc->PortRangeHints[port].LowerBound)
                                         * 0.25
                                         + log(desc->PortRangeHints[port].UpperBound)
                                         * 0.75);
-                } else {
+                else
+#endif
                         *val = (desc->PortRangeHints[port].LowerBound * 0.25) +
                                (desc->PortRangeHints[port].UpperBound * 0.75);
-                }
                 break;
         case LADSPA_HINT_DEFAULT_MAXIMUM:
                 *val = desc->PortRangeHints[port].UpperBound;
-- 
1.6.0.6



More information about the Alsa-devel mailing list