J.A. Roberts Tunney avatar J.A. Roberts Tunney committed 778de39

Changed API renaming 'struct soundtouch4c' as 'soundtouch4c_t' and
made it a void pointer so it can be checked. Plus other cleanup

Comments (0)

Files changed (9)

 # emacs garbage files
 syntax: regexp
 SUBDIRS         = 
-EXTRA_DIST      = bootstrap.sh data/monkeys-8khz-slin.raw m4/soundtouch4c.m4
+EXTRA_DIST      = bootstrap.sh data/monkeys-8khz-slin.raw m4/soundtouch4c.m4 soundtouch4c.7
 man7_MANS       = soundtouch4c.7
 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.h.in \
 	soundtouch4c.7 $(AUX_DIST)
+DISTCLEANFILES = data/monkeys-8khz-slin-deepened.raw soundtouch4c.7
 AM_CC                        = g++
-AM_CFLAGS                    = -Isrc
+AM_CFLAGS                    = -I$(srcdir)/src
 AM_CPPFLAGS                  = $(AM_CFLAGS)
 AM_LDFLAGS                   = 
 library_include_HEADERS      = src/soundtouch4c.h
 libsoundtouch4c_la_SOURCES   = src/soundtouch4c.cpp
-libsoundtouch4c_la_LIBADD    = -lstdc++ @SOUNDTOUCH_LIBS@
+libsoundtouch4c_la_CPPFLAGS  = $(AM_CFLAGS)
+libsoundtouch4c_la_LIBADD    = -lstdc++ -lSoundTouch
 soundtouch4c_demo_SOURCES    = src/example.c
 soundtouch4c_demo_LDADD      = libsoundtouch4c.la
+m4srcdir                     = $(top_srcdir)/m4
 m4datadir                    = $(datadir)/aclocal
-m4data_DATA                  = m4/soundtouch4c.m4
+m4data_DATA                  = $(m4srcdir)/soundtouch4c.m4
-# generate ChangeLog using mercurial
-	if test -d .hg; then \
-	    hg log --style changelog >$(distdir)/ChangeLog; \
-	    rst2man README >$(distdir)/soundtouch4c.7; \
+	if test -d $(top_srcdir)/.hg; then \
+	    $(MERCURIAL) log --style changelog >$(distdir)/ChangeLog; \
 soundtouch4c.7: README
-	if test -d .hg; then \
-	    rst2man README >soundtouch4c.7; \
+	if test -n "$(RST2MAN)"; then \
+	    $(RST2MAN) $< >$@; \
-	hg pull
-	hg update
+	$(MERCURIAL) pull
+	$(MERCURIAL) update
 upgrade: clean upgrade-code all
 	@echo "------------------------------------------------------------"
   sudo make install
+You also get a happy little man page::
+  man soundtouch4c
 If you have problems, you might want to try following the *full*
 instructions on the Asterisk Voice Changer web page.
   sudo apt-get install mercurial build-essential autoconf \
-      libtool automake m4 autotools-dev soundtouch-dev
+      libtool automake m4 autotools-dev soundtouch-dev rst2man
   hg clone http://bitbucket.org/jart/soundtouch4c
   cd soundtouch4c
 Some other useful commands for advanced users::
   ./configure --help
+  make tags
+  make distclean
   make maintainer-clean
-  make tags
   make uninstall
   make dist dist-bzip2 dist-zip
-* ``struct soundtouch4c``
+* ``soundtouch4c_t``: void pointer
-* ``struct soundtouch4c *SoundTouch_construct(void)``
-* ``void SoundTouch_destruct(struct soundtouch4c *st)``
-* ``void SoundTouch_setRate(struct soundtouch4c *st, float newRate)``
-* ``void SoundTouch_setTempo(struct soundtouch4c *st, float newTempo)``
-* ``void SoundTouch_setRateChange(struct soundtouch4c *st, float newRate)``
-* ``void SoundTouch_setTempoChange(struct soundtouch4c *st, float newTempo)``
-* ``void SoundTouch_setPitch(struct soundtouch4c *st, float newPitch)``
-* ``void SoundTouch_setPitchOctaves(struct soundtouch4c *st, float newPitch)``
-* ``void SoundTouch_setPitchSemiTonesInt(struct soundtouch4c *st, int newPitch)``
-* ``void SoundTouch_setPitchSemiTonesFloat(struct soundtouch4c *st, float newPitch)``
-* ``void SoundTouch_setChannels(struct soundtouch4c *st, uint numChannels)``
-* ``void SoundTouch_setSampleRate(struct soundtouch4c *st, uint srate)``
-* ``void SoundTouch_flush(struct soundtouch4c *st)``
-* ``void SoundTouch_putSamples(struct soundtouch4c *st, int16_t *samples, uint numSamples)``
-* ``void SoundTouch_clear(struct soundtouch4c *st)``
-* ``int SoundTouch_setSetting(struct soundtouch4c *st, uint settingId, uint value)``
-* ``uint SoundTouch_getSetting(struct soundtouch4c *st, uint settingId)``
-* ``uint SoundTouch_numUnprocessedSamples(struct soundtouch4c *st)``
-* ``uint SoundTouch_receiveSamplesEx(struct soundtouch4c *st, int16_t *output, uint maxSamples)``
-* ``uint SoundTouch_receiveSamples(struct soundtouch4c *st, uint maxSamples)``
-* ``uint SoundTouch_numSamples(struct soundtouch4c *st)``
-* ``int SoundTouch_isEmpty(struct soundtouch4c *st)``
+* ``soundtouch4c_t SoundTouch_construct(void)``
+* ``void SoundTouch_destruct(soundtouch4c_t st)``
+* ``void SoundTouch_setRate(soundtouch4c_t st, float newRate)``
+* ``void SoundTouch_setTempo(soundtouch4c_t st, float newTempo)``
+* ``void SoundTouch_setRateChange(soundtouch4c_t st, float newRate)``
+* ``void SoundTouch_setTempoChange(soundtouch4c_t st, float newTempo)``
+* ``void SoundTouch_setPitch(soundtouch4c_t st, float newPitch)``
+* ``void SoundTouch_setPitchOctaves(soundtouch4c_t st, float newPitch)``
+* ``void SoundTouch_setPitchSemiTonesInt(soundtouch4c_t st, int newPitch)``
+* ``void SoundTouch_setPitchSemiTonesFloat(soundtouch4c_t st, float newPitch)``
+* ``void SoundTouch_setChannels(soundtouch4c_t st, uint numChannels)``
+* ``void SoundTouch_setSampleRate(soundtouch4c_t st, uint srate)``
+* ``void SoundTouch_flush(soundtouch4c_t st)``
+* ``void SoundTouch_putSamples(soundtouch4c_t st, int16_t *samples, uint numSamples)``
+* ``void SoundTouch_clear(soundtouch4c_t st)``
+* ``int SoundTouch_setSetting(soundtouch4c_t st, uint settingId, uint value)``
+* ``uint SoundTouch_getSetting(soundtouch4c_t st, uint settingId)``
+* ``uint SoundTouch_numUnprocessedSamples(soundtouch4c_t st)``
+* ``uint SoundTouch_receiveSamplesEx(soundtouch4c_t st, int16_t *output, uint maxSamples)``
+* ``uint SoundTouch_receiveSamples(soundtouch4c_t st, uint maxSamples)``
+* ``uint SoundTouch_numSamples(soundtouch4c_t st)``
+* ``int SoundTouch_isEmpty(soundtouch4c_t st)``
-        [],
-        [AC_MSG_ERROR([Please install SoundTouch! sudo apt-get install soundtouch-dev])]])
+AC_PATH_PROG([RST2MAN], [rst2man], :)
 # Checks for header files.
 # Checks for typedefs, structures, and compiler characteristics.
-# m4 configure test script for the SoundTouch library
-# (c)2003 David W. Durham
-# $Id: soundtouch.m4,v 1.1 2003/12/25 11:36:07 Olli Exp $
-# This file can be included with other packages that need to test
-# for libSoundTouch.
-# It will #define HAVE_LIBSOUNDTOUCH iff the library is found
-# It also defines some flags to the configure script for specifying
-# the location to search for libSoundTouch
-# A user of libSoundTouch should add @SOUNDTOUCH_LIBS@ and 
-# @SOUNDTOUCH_CXXFLAGS@ to the appropriate variables in his
-# Makefile.am files
-# This script works with autoconf-2.5x and automake-1.6 but I have
-# not tested it with older versions.
+#  -*-Autoconf-*-
+# i couldn't figure out the m4 script that came with soundtouch
-dnl        min version not supported yet
+AC_CHECK_HEADER([soundtouch/SoundTouch.h], [],
+        AC_MSG_ERROR([Please install SoundTouch: sudo apt-get install libsoundtouch-dev]))
+AC_CHECK_LIB([SoundTouch], [soundtouch_ac_test],
+        AC_DEFINE(HAVE_LIBSOUNDTOUCH, 1, [SoundTouch library is installed]),
+        AC_MSG_ERROR([SoundTouch looks installed but can't link it!  Try running ldconfig]))
-	AC_ARG_WITH(soundtouch-prefix,[  --with-soundtouch-prefix=DIR   Prefix where SoundTouch was installed (optional)], [soundtouch_prefix="$withval"],[soundtouch_prefix=""])
-	AC_ARG_ENABLE(soundtouch-check,[  --disable-soundtouch-check   Do not look for the SoundTouch Library],[enable_soundtouch_check="$enableval"],[enable_soundtouch_check="yes"])
-	if test "$enable_soundtouch_check" = "yes"
-	then
-		CPPFLAGS="$CPPFLAGS -I$soundtouch_prefix/include"
-		LDFLAGS="$LDFLAGS -L$soundtouch_prefix/lib"
-		dnl make sure SoundTouch.h header file exists
-			dnl could use AC_CHECK_HEADERS to check for all of them, but the supporting .h file names may change later
-		AC_CHECK_HEADER([soundtouch/SoundTouch.h],[
-				dnl SoundTouch.h found
-				dnl make sure libSoundTouch is linkable
-				AC_CHECK_LIB([SoundTouch],[soundtouch_ac_test],[
-					dnl libSoundTouch found
-					SOUNDTOUCH_CXXFLAGS="-I$soundtouch_prefix/include"
-					SOUNDTOUCH_LIBS="-L$soundtouch_prefix/lib -lSoundTouch"
-					dnl run action-if-found
-					ifelse([$2], , :, [$2])
-				],[ 
-					dnl run action-if-not-found
-					ifelse([$3], , :, [$3])
-				])
-			],[
-				dnl run action-if-not-found
-				ifelse([$3], , :, [$3])
-			])
-	fi


-AC_CHECK_HEADER([soundtouch4c.h], ,
+AC_CHECK_HEADER([soundtouch4c.h], [],
         AC_MSG_ERROR([Please install libsoundtouch4c: http://bitbucket.org/jart/soundtouch4c]))
 AC_CHECK_LIB([soundtouch4c], [SoundTouch_construct],
         AC_DEFINE(HAVE_LIBSOUNDTOUCH4C, 1, [libsoundtouch4c library is installed]),
-        AC_MSG_ERROR([Please install libsoundtouch4c: http://bitbucket.org/jart/soundtouch4c]))
+        AC_MSG_ERROR([Can't seem to link against libsoundtouch4c.  Try reinstalling]))
+AC_CHECK_TYPES([soundtouch4c_t], [],
+        AC_MSG_ERROR(['soundtouch4c_t' not found.  Please upgrade to soundtouch4c >= 0.5]),
+        [[#include <soundtouch4c.h>]])
 #  include <config.h>
 #include <sys/types.h>
 #include <soundtouch4c.h>
-#define BUFSAMPLES 4096
+#define BUFSAMPLES 160
 #define IN_FILE "data/monkeys-8khz-slin.raw"
 #define OUT_FILE "data/monkeys-8khz-slin-deepened.raw"
-static struct soundtouch4c *create(int hz, float pitch)
+static soundtouch4c_t create(int hz, float pitch)
-	struct soundtouch4c *snd;
+	soundtouch4c_t snd;
 	snd = SoundTouch_construct();
 	if (!snd) {
 		fprintf(stderr, "Failed to create SoundTouch object\n");
 	int n;
 	size_t cnt;
+	soundtouch4c_t snd;
 	FILE *fin, *fout;
 	int16_t buf[BUFSAMPLES];
-	struct soundtouch4c *snd;
 	snd = create(8000, -5.0); /* deepen voice, telephone quality 8khz */
 	fin = fopen(IN_FILE, "rb");


 #  include <config.h>
 extern "C" {
-struct soundtouch4c *SoundTouch_construct()
+soundtouch4c_t SoundTouch_construct()
-	return (struct soundtouch4c *)(new SoundTouch());
+	return (soundtouch4c_t)(new SoundTouch());
-void SoundTouch_destruct(struct soundtouch4c *st)
+void SoundTouch_destruct(soundtouch4c_t st)
 	delete (SoundTouch *)st;
-void SoundTouch_setRate(struct soundtouch4c *st, float newRate)
+void SoundTouch_setRate(soundtouch4c_t st, float newRate)
 	((SoundTouch *)st)->setRate(newRate);
-void SoundTouch_setTempo(struct soundtouch4c *st, float newTempo)
+void SoundTouch_setTempo(soundtouch4c_t st, float newTempo)
 	((SoundTouch *)st)->setTempo(newTempo);
-void SoundTouch_setRateChange(struct soundtouch4c *st, float newRate)
+void SoundTouch_setRateChange(soundtouch4c_t st, float newRate)
 	((SoundTouch *)st)->setRateChange(newRate);
-void SoundTouch_setTempoChange(struct soundtouch4c *st, float newTempo)
+void SoundTouch_setTempoChange(soundtouch4c_t st, float newTempo)
 	((SoundTouch *)st)->setTempoChange(newTempo);
-void SoundTouch_setPitch(struct soundtouch4c *st, float newPitch)
+void SoundTouch_setPitch(soundtouch4c_t st, float newPitch)
 	((SoundTouch *)st)->setPitch(newPitch);
-void SoundTouch_setPitchOctaves(struct soundtouch4c *st, float newPitch)
+void SoundTouch_setPitchOctaves(soundtouch4c_t st, float newPitch)
 	((SoundTouch *)st)->setPitchOctaves(newPitch);
-void SoundTouch_setPitchSemiTonesInt(struct soundtouch4c *st, int newPitch)
+void SoundTouch_setPitchSemiTonesInt(soundtouch4c_t st, int newPitch)
 	((SoundTouch *)st)->setPitchSemiTones(newPitch);
-void SoundTouch_setPitchSemiTonesFloat(struct soundtouch4c *st, float newPitch)
+void SoundTouch_setPitchSemiTonesFloat(soundtouch4c_t st, float newPitch)
 	((SoundTouch *)st)->setPitchSemiTones(newPitch);
-void SoundTouch_setChannels(struct soundtouch4c *st, uint numChannels)
+void SoundTouch_setChannels(soundtouch4c_t st, uint numChannels)
 	((SoundTouch *)st)->setChannels(numChannels);
-void SoundTouch_setSampleRate(struct soundtouch4c *st, uint srate)
+void SoundTouch_setSampleRate(soundtouch4c_t st, uint srate)
 	((SoundTouch *)st)->setSampleRate(srate);
-void SoundTouch_flush(struct soundtouch4c *st)
+void SoundTouch_flush(soundtouch4c_t st)
 	((SoundTouch *)st)->flush();
-void SoundTouch_putSamples(struct soundtouch4c *st, int16_t *samples, uint numSamples)
+void SoundTouch_putSamples(soundtouch4c_t st, int16_t *samples, uint numSamples)
 	SAMPLETYPE buf[numSamples];
 	uint n;
 	((SoundTouch *)st)->putSamples(buf, numSamples);
-void SoundTouch_clear(struct soundtouch4c *st)
+void SoundTouch_clear(soundtouch4c_t st)
 	((SoundTouch *)st)->clear();
-int SoundTouch_setSetting(struct soundtouch4c *st, uint settingId, uint value)
+int SoundTouch_setSetting(soundtouch4c_t st, uint settingId, uint value)
 	return ((SoundTouch *)st)->setSetting(settingId, value);
-uint SoundTouch_getSetting(struct soundtouch4c *st, uint settingId)
+uint SoundTouch_getSetting(soundtouch4c_t st, uint settingId)
 	return ((SoundTouch *)st)->getSetting(settingId);
-uint SoundTouch_numUnprocessedSamples(struct soundtouch4c *st)
+uint SoundTouch_numUnprocessedSamples(soundtouch4c_t st)
 	return ((SoundTouch *)st)->numUnprocessedSamples();
-uint SoundTouch_receiveSamplesEx(struct soundtouch4c *st, int16_t *output, uint maxSamples)
+uint SoundTouch_receiveSamplesEx(soundtouch4c_t st, int16_t *output, uint maxSamples)
 	SAMPLETYPE buf[maxSamples];
 	uint n;
 	return c;
-uint SoundTouch_receiveSamples(struct soundtouch4c *st, uint maxSamples)
+uint SoundTouch_receiveSamples(soundtouch4c_t st, uint maxSamples)
 	return ((SoundTouch *)st)->receiveSamples(maxSamples);
-uint SoundTouch_numSamples(struct soundtouch4c *st)
+uint SoundTouch_numSamples(soundtouch4c_t st)
 	return ((SoundTouch *)st)->numSamples();
-int SoundTouch_isEmpty(struct soundtouch4c *st)
+int SoundTouch_isEmpty(soundtouch4c_t st)
 	return ((SoundTouch *)st)->isEmpty();


-/* this name was changed in 0.4 -> 0.5, provide backward compatability
-   for C libraries as they won't clash with SoundTouch's namespace */
-#define soundtouch soundtouch4c
 #define SETTING_USE_AA_FILTER       0
 #define SETTING_USE_QUICKSEEK       2
 #endif /* #ifdef __cplusplus */
-struct soundtouch4c;
-struct soundtouch4c *SoundTouch_construct(void);
-void SoundTouch_destruct(struct soundtouch4c *st);
-void SoundTouch_setRate(struct soundtouch4c *st, float newRate);
-void SoundTouch_setTempo(struct soundtouch4c *st, float newTempo);
-void SoundTouch_setRateChange(struct soundtouch4c *st, float newRate);
-void SoundTouch_setTempoChange(struct soundtouch4c *st, float newTempo);
-void SoundTouch_setPitch(struct soundtouch4c *st, float newPitch);
-void SoundTouch_setPitchOctaves(struct soundtouch4c *st, float newPitch);
-void SoundTouch_setPitchSemiTonesInt(struct soundtouch4c *st, int newPitch);
-void SoundTouch_setPitchSemiTonesFloat(struct soundtouch4c *st, float newPitch);
-void SoundTouch_setChannels(struct soundtouch4c *st, uint numChannels);
-void SoundTouch_setSampleRate(struct soundtouch4c *st, uint srate);
-void SoundTouch_flush(struct soundtouch4c *st);
-void SoundTouch_putSamples(struct soundtouch4c *st, int16_t *samples, uint numSamples);
-void SoundTouch_clear(struct soundtouch4c *st);
-int SoundTouch_setSetting(struct soundtouch4c *st, uint settingId, uint value);
-uint SoundTouch_getSetting(struct soundtouch4c *st, uint settingId);
-uint SoundTouch_numUnprocessedSamples(struct soundtouch4c *st);
-uint SoundTouch_receiveSamplesEx(struct soundtouch4c *st, int16_t *output, uint maxSamples);
-uint SoundTouch_receiveSamples(struct soundtouch4c *st, uint maxSamples);
-uint SoundTouch_numSamples(struct soundtouch4c *st);
-int SoundTouch_isEmpty(struct soundtouch4c *st);
+typedef void *soundtouch4c_t;
+soundtouch4c_t SoundTouch_construct(void);
+void SoundTouch_destruct(soundtouch4c_t st);
+void SoundTouch_setRate(soundtouch4c_t st, float newRate);
+void SoundTouch_setTempo(soundtouch4c_t st, float newTempo);
+void SoundTouch_setRateChange(soundtouch4c_t st, float newRate);
+void SoundTouch_setTempoChange(soundtouch4c_t st, float newTempo);
+void SoundTouch_setPitch(soundtouch4c_t st, float newPitch);
+void SoundTouch_setPitchOctaves(soundtouch4c_t st, float newPitch);
+void SoundTouch_setPitchSemiTonesInt(soundtouch4c_t st, int newPitch);
+void SoundTouch_setPitchSemiTonesFloat(soundtouch4c_t st, float newPitch);
+void SoundTouch_setChannels(soundtouch4c_t st, uint numChannels);
+void SoundTouch_setSampleRate(soundtouch4c_t st, uint srate);
+void SoundTouch_flush(soundtouch4c_t st);
+void SoundTouch_putSamples(soundtouch4c_t st, int16_t *samples, uint numSamples);
+void SoundTouch_clear(soundtouch4c_t st);
+int SoundTouch_setSetting(soundtouch4c_t st, uint settingId, uint value);
+uint SoundTouch_getSetting(soundtouch4c_t st, uint settingId);
+uint SoundTouch_numUnprocessedSamples(soundtouch4c_t st);
+uint SoundTouch_receiveSamplesEx(soundtouch4c_t st, int16_t *output, uint maxSamples);
+uint SoundTouch_receiveSamples(soundtouch4c_t st, uint maxSamples);
+uint SoundTouch_numSamples(soundtouch4c_t st);
+int SoundTouch_isEmpty(soundtouch4c_t st);
 #ifdef __cplusplus
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.