Skip to contentSkip to conversation

pcm_ladspa: add support for softfloat

PATCH In review Mike Frysinger 2 participants 3 messages Jan 7, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcm_ladspa: add support for softfloat

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.

---
 src/pcm/pcm_ladspa.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
src/pcm/pcm_ladspa.c +14 -9
index 5161820..0e9321c 100644
@@ -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;
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 3 lines · Mike Frysinger

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.

It would be better to disable building of ladspa plugin when soft-float is enabled completely as Takashi already proposed. LADSPA works only with float samples which does not make much sense for soft-float platforms.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

#2 lore raw
In reply to Mike Frysinger
Quoted 3 lines · On Wednesday 07 January 2009 05:06:50 Mike Frysinger wrote:

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.

bah, i'm not used to our alsa guy actually talking to upstream (since the last one didnt). guess i'll sit back and let you handle things since you're much more proactive :).

so please ignore the last two patches from me ... Cliff will take care of things.
-mike

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel