aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-05-25 12:38:51 +0200
committerTakashi Iwai <tiwai@suse.de>2011-05-25 12:39:11 +0200
commit47aa20e8ca97319b31a006e1fda68d3924c9eca5 (patch)
treedb78be4b6416485c3d11026004c0b5b5fb852688
parent3bf347ef37cc52d564c0ce6c9bae78d07a32143b (diff)
downloadsalsa-lib-47aa20e8ca97319b31a006e1fda68d3924c9eca5.tar.gz
Add the support of floating-point
Used only in TLV linear dB conversion.
-rw-r--r--configure.ac19
-rw-r--r--src/Makefile.am2
-rw-r--r--src/control.c10
-rw-r--r--src/recipe.h.in3
4 files changed, 29 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 93694f7..36d37fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,6 +111,11 @@ AC_ARG_ENABLE(symbolic-functions,
[use -Bsymbolic-functions option if available (optmization for size and speed)]),
symfuncs="$enableval", symfuncs="no")
+AC_ARG_ENABLE(float,
+ AS_HELP_STRING([--enable-float],
+ [support floatin-point unit]),
+ support_float="$enableval", support_float="no")
+
AC_ARG_ENABLE(everything,
AS_HELP_STRING([--enable-everything],
[enable everything :)]),
@@ -129,8 +134,11 @@ if test "$everything" = "yes"; then
libasound="yes"
symfuncs="yes"
output_buffer="yes"
+ support_float="yes"
fi
+SALSA_DEPLIBS=""
+
AM_CONDITIONAL(BUILD_PCM, test "$pcm" = "yes")
AM_CONDITIONAL(BUILD_MIXER, test "$mixer" = "yes")
AM_CONDITIONAL(BUILD_RAWMIDI, test "$rawmidi" = "yes")
@@ -176,6 +184,14 @@ else
fi
AC_SUBST(SALSA_SUPPORT_OUTPUT_BUFFER)
+if test "$support_float" = "yes"; then
+ SALSA_SUPPORT_FLOAT=1
+ SALSA_DEPLIBS="$SALSA_DEPLIBS -lm"
+else
+ SALSA_SUPPORT_FLOAT=0
+fi
+AC_SUBST(SALSA_SUPPORT_FLOAT)
+
if test "$delight_valgrind" = "yes"; then
AC_DEFINE(DELIGHT_VALGRIND)
fi
@@ -193,6 +209,8 @@ else
fi
AM_CONDITIONAL(SYMBOLIC_FUNCTIONS, test x"$symfuncs" = xyes)
+AC_SUBST(SALSA_DEPLIBS)
+
dnl OK, let's output...
AC_OUTPUT([
@@ -229,3 +247,4 @@ echo " - Async handler support: $async"
echo " - Make ABI-compatible libasound.so: $libasound"
echo " - Mark deprecated attribute: $markdeprecated"
echo " - Support string-output via snd_output: $output_buffer"
+echo " - Support floating-point: $support_float"
diff --git a/src/Makefile.am b/src/Makefile.am
index a6270dd..d5d04e5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,7 @@ libsalsa_la_SOURCES += timer.c
endif
libsalsa_la_LDFLAGS = -version-info 0:1:0 $(SYMFUNCS)
+libsalsa_la_LIBADD = @SALSA_DEPLIBS@
alsaincludedir = $(includedir)/alsa
@@ -99,5 +100,6 @@ VSYMS =
endif
libasound_la_LDFLAGS = -version-info 2:0:0 $(VSYMS) $(SYMFUNCS)
+libasound_la_LIBADD = @SALSA_DEPLIBS@
endif
diff --git a/src/control.c b/src/control.c
index d7c4ed4..0d53f05 100644
--- a/src/control.c
+++ b/src/control.c
@@ -27,11 +27,11 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/poll.h>
-#ifdef SALSA_SUPPORT_FLOAT
-#include <math.h>
-#endif
#include "control.h"
#include "local.h"
+#if SALSA_SUPPORT_FLOAT
+#include <math.h>
+#endif
/*
@@ -414,7 +414,7 @@ static int tlv_to_dB_minmax(unsigned int *tlv, long rangemin, long rangemax,
return 0;
}
-#ifdef SALSA_SUPPORT_FLOAT
+#if SALSA_SUPPORT_FLOAT
static int tlv_to_dB_linear(unsigned int *tlv, long rangemin, long rangemax,
long volume, long *db_gain)
{
@@ -633,7 +633,7 @@ static int tlv_from_dB_minmax(unsigned int *tlv, long rangemin, long rangemax,
return 0;
}
-#ifdef SALSA_SUPPORT_FLOAT
+#if SALSA_SUPPORT_FLOAT
static int tlv_from_dB_linear(unsigned int *tlv, long rangemin, long rangemax,
long db_gain, long *value, int xdir)
{
diff --git a/src/recipe.h.in b/src/recipe.h.in
index 24ef2e2..dfe022e 100644
--- a/src/recipe.h.in
+++ b/src/recipe.h.in
@@ -16,6 +16,9 @@
/* Don't support string output via snd_output_*() */
#define SALSA_SIMPLE_OUTPUT @SALSA_SIMPLE_OUTPUT@
+/* Support floating pointer */
+#define SALSA_SUPPORT_FLOAT @SALSA_SUPPORT_FLOAT@
+
#define SALSA_DEVPATH "@DEVPATH@"
#endif /* __ALSA_RECIPE_H */