aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rw-r--r--configure.in37
-rw-r--r--examples/Makefile.am7
-rw-r--r--examples/simpletest/Makefile.am8
-rw-r--r--examples/simpletest/simpletest.c33
-rw-r--r--src/Makefile.am4
-rw-r--r--src/libxtract.c2
-rw-r--r--xtract/Makefile.am8
-rw-r--r--xtract/libxtract.h4
9 files changed, 91 insertions, 15 deletions
diff --git a/config.h.in b/config.h.in
index 58c3175..120d8f5 100644
--- a/config.h.in
+++ b/config.h.in
@@ -3,6 +3,9 @@
/* Build the pd example */
#undef BUILD_PD_EXAMPLE
+/* Build the simpletest example */
+#undef BUILD_SIMPLETEST
+
/* Build the vector functions */
#undef BUILD_VECTOR
diff --git a/configure.in b/configure.in
index 880b492..4f38526 100644
--- a/configure.in
+++ b/configure.in
@@ -21,10 +21,6 @@ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_ENABLE_STATIC(no)
AC_ENABLE_SHARED(yes)
AC_PROG_LIBTOOL
-#AC_ARG_WITH(fftw, AC_HELP_STRING([--with-vector], [build vector features]),
-# [ if test $withval = "yes"; then with_vector=yes ;
-# else with_vector=no ; fi ], with_vector=no)
-
AC_CHECK_HEADERS([math.h, stdlib.h, stdio.h])
AC_CHECK_PROG([DOXYGEN], [doxygen], [doc], [])
AC_SUBST(DOXYGEN)
@@ -44,6 +40,14 @@ AC_ARG_ENABLE(pd_example,
no) pd_example=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-pd_external) ;;
esac],[pd_example=false])
+
+AC_ARG_ENABLE(simpletest,
+ [ --enable-simpletest Compile the 'simpletest' example],
+ [case "${enableval}" in
+ yes) simpletest=true ;;
+ no) simpletest=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-simpletest) ;;
+ esac],[simpletest=false])
# libtool version: current:revision:age
#
@@ -61,7 +65,7 @@ AC_ARG_ENABLE(pd_example,
XTRACT_SO_VERSION=0:0:0
CFLAGS="$CFLAGS -pedantic -ansi -O3"
-LDFLAGS="$LDFLAGS -lm"
+LDFLAGS="$LDFLAGS -lm --allow-shlib-undefined"
AC_ARG_WITH(pd_dir,
[ --with-pd-dir=path pd header path (default=/usr/local/include) ],
@@ -82,7 +86,6 @@ AC_ARG_WITH(fftw3_dir,
])
dnl Are we building with fftw?
-#if [[ "$with_vector" = "yes" ]] ; then
if [[ "$vector" = "true" ]] ; then
LDFLAGS="$LDFLAGS -lfftw3f"
AC_DEFINE([BUILD_VECTOR], [1], [Build the vector functions])
@@ -95,9 +98,17 @@ if [[ "$vector" = "true" ]] ; then
])
fi
-
AM_CONDITIONAL(BUILD_VECTOR, test "x${vector}" = 'xtrue')
+
+dnl are we building the simpletest example
+if [[ "$simpletest" = "true" ]] ; then
+ AC_DEFINE([BUILD_SIMPLETEST], [1], [Build the simpletest example])
+fi
+
+AM_CONDITIONAL(BUILD_SIMPLETEST, test "x${simpletest}" = 'xtrue')
+
+
dnl Are we building the PD examples?
if [[ "$pd_example" = "true" ]] ; then
PD_SOURCES="xtract~.c"
@@ -201,7 +212,7 @@ AC_SUBST(PD_SOURCES)
AC_CONFIG_FILES([doc/documentation.doxygen
libxtract.pc])
-AC_OUTPUT(Makefile src/Makefile xtract/Makefile doc/Makefile examples/Makefile examples/puredata/Makefile)
+AC_OUTPUT(Makefile src/Makefile xtract/Makefile doc/Makefile examples/Makefile examples/puredata/Makefile examples/simpletest/Makefile)
echo
echo "**************************************************************"
@@ -213,7 +224,12 @@ dnl echo you are using the ${host} architecture
if test "$vector" = "true"; then
echo "Fftw3: yes (using fftw3f)"
else
- echo "Fftw3: no (not using fftw3, the vector functions will not work)"
+ echo "Fftw3: no (not using fftw3, no vector functions)"
+fi
+if test "$simpletest" = "true"; then
+ echo "simpletest example: yes"
+else
+ echo "simpletest example: no"
fi
if test "$pd_example" = "true"; then
echo "PD external: yes"
@@ -222,8 +238,9 @@ if test "$pd_example" = "true"; then
echo ${prefix}"/lib/doc/5.reference/xtract/"
echo "You must make sure that this is in your PD help path"
else
- echo "PD external: no"
+ echo "PD external: no"
fi
+
echo
echo "**************************************************************"
echo
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 8ca132d..7e0e052 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,4 +1,9 @@
if BUILD_PD_EXAMPLE
-SUBDIRS = puredata
+PUREDATA_DIR = puredata
endif
+if BUILD_SIMPLETEST
+SIMPLETEST_DIR = simpletest
+endif
+
+SUBDIRS = $(PUREDATA_DIR) $(SIMPLETEST_DIR)
diff --git a/examples/simpletest/Makefile.am b/examples/simpletest/Makefile.am
new file mode 100644
index 0000000..c3ab176
--- /dev/null
+++ b/examples/simpletest/Makefile.am
@@ -0,0 +1,8 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+noinst_PROGRAMS = simpletest
+INCLUDES = -I$(top_srcdir)/src
+simpletest_SOURCES = simpletest.c
+simpletest_LDADD = ../../src/libxtract.la
+
+
diff --git a/examples/simpletest/simpletest.c b/examples/simpletest/simpletest.c
new file mode 100644
index 0000000..a65d846
--- /dev/null
+++ b/examples/simpletest/simpletest.c
@@ -0,0 +1,33 @@
+/* xtract~ - PD library for feature extraction
+Copyright (C) 2006 Jamie Bullock
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#define XTRACT
+#include "xtract/libxtract.h"
+#include <stdio.h>
+
+int main() {
+
+ float mean = 0, vector[] = {1, 2, 3};
+
+ xtract[MEAN]((void *)&vector, 6, NULL, (void *)&mean);
+
+ printf("\nThe mean of [1, 2, 3] = %.1f\n\n", mean);
+
+ return 0;
+
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index cf4125c..1ef2862 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,11 +5,13 @@ SOURCES = libxtract.c scalar.c delta.c init.c
if BUILD_VECTOR
VECTOR = vector.c
+VECTOR_DEFINE = -DVECTORFUNCS
else
VECTOR =
+VECTOR_DEFINE =
endif
lib_LTLIBRARIES = libxtract.la
-libxtract_la_CFLAGS = -pedantic -ansi -g -O0 -ggdb
+libxtract_la_CFLAGS = $(VECTOR_DEFINE)
libxtract_la_SOURCES = $(SOURCES) $(VECTOR)
libxtract_la_LDFLAGS = -shared
diff --git a/src/libxtract.c b/src/libxtract.c
index 5e1cdf2..14b089d 100644
--- a/src/libxtract.c
+++ b/src/libxtract.c
@@ -55,6 +55,7 @@ int(*xtract[])(float *, int, void *, float *) = {
xtract_hps,
xtract_f0,
/* xtract_vector.h */
+#ifdef VECTORFUNCS
xtract_magnitude_spectrum,
xtract_autocorrelation,
xtract_autocorrelation_fft,
@@ -64,6 +65,7 @@ int(*xtract[])(float *, int, void *, float *) = {
xtract_dct,
xtract_bark_coefficients,
xtract_peaks,
+#endif
/* xtract_delta.h */
xtract_flux,
xtract_attack_time,
diff --git a/xtract/Makefile.am b/xtract/Makefile.am
index b29e60d..0dd9942 100644
--- a/xtract/Makefile.am
+++ b/xtract/Makefile.am
@@ -1,5 +1,11 @@
libxtractdir = $(includedir)/xtract
+if BUILD_VECTOR
+XTRACT_VECTOR = xtract_vector.h
+else
+XTRACT_VECTOR =
+endif
+
libxtract_HEADERS = libxtract.h xtract_macros.h xtract_types.h xtract_delta.h \
- xtract_scalar.h xtract_vector.h
+ xtract_scalar.h $(XTRACT_VECTOR)
diff --git a/xtract/libxtract.h b/xtract/libxtract.h
index 81f261f..6b90da3 100644
--- a/xtract/libxtract.h
+++ b/xtract/libxtract.h
@@ -67,7 +67,7 @@ enum features_ {
AVERAGE_DEVIATION,
SKEWNESS,
KURTOSIS,
- CENTROID,
+ CENTROID,
IRREGULARITY_K,
IRREGULARITY_J,
TRISTIMULUS_1,
@@ -125,7 +125,7 @@ enum return_codes_ {
MALLOC_FAILED,
BAD_ARGV,
BAD_VECTOR_SIZE,
- NO_RESULT
+ NO_RESULT
};
/**