[alsa-devel] [PATCH] 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.
Signed-off-by: Mike Frysinger vapier@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;
On Wed, 7 Jan 2009, 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.
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 perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.
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
participants (2)
-
Jaroslav Kysela
-
Mike Frysinger