From 0e2ee653db9a19d857ad2408022d58c239eb4495 Mon Sep 17 00:00:00 2001 From: oparviai Date: Thu, 25 Dec 2008 16:33:39 +0000 Subject: [PATCH] Repaired Linux compilation --- config/am_include.mk | 2 -- configure.ac | 3 +-- source/SoundTouch/Makefile.am | 12 ++++++------ source/example/Makefile.am | 2 +- source/example/SoundStretch/Makefile.am | 5 ++--- source/example/SoundStretch/WavFile.cpp | 14 +++++++------- source/example/SoundStretch/main.cpp | 5 +++-- 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/config/am_include.mk b/config/am_include.mk index 475e53a..ddbef0d 100644 --- a/config/am_include.mk +++ b/config/am_include.mk @@ -34,5 +34,3 @@ INCLUDES=-I$(top_srcdir)/include # doc directory pkgdocdir=$(prefix)/doc/@PACKAGE@ - - diff --git a/configure.ac b/configure.ac index 45bdde3..6aafb5a 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ dnl this program; if not, write to the Free Software Foundation, Inc., 59 Temple dnl Place - Suite 330, Boston, MA 02111-1307, USA # Process this file with autoconf to produce a configure script. -AC_INIT(SoundTouch, 1.3.2, [http://www.surina.net/soundtouch]) +AC_INIT(SoundTouch, 1.4.0, [http://www.surina.net/soundtouch]) AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER([include/soundtouch_config.h]) AM_INIT_AUTOMAKE @@ -126,7 +126,6 @@ AC_CONFIG_FILES([ source/SoundTouch/Makefile source/example/Makefile source/example/SoundStretch/Makefile - source/example/bpm/Makefile include/Makefile ]) diff --git a/source/SoundTouch/Makefile.am b/source/SoundTouch/Makefile.am index 88190ba..4eb6c23 100644 --- a/source/SoundTouch/Makefile.am +++ b/source/SoundTouch/Makefile.am @@ -26,18 +26,18 @@ include $(top_srcdir)/config/am_include.mk # set to something if you want other stuff to be included in the distribution tarball EXTRA_DIST=3dnow_win.cpp cpu_detect_x86_win.cpp SoundTouch.dsp SoundTouch.dsw SoundTouch.sln SoundTouch.vcproj -noinst_HEADERS=AAFilter.h cpu_detect.h cpu_detect_x86_gcc.cpp FIRFilter.h RateTransposer.h TDStretch.h +noinst_HEADERS=AAFilter.h cpu_detect.h cpu_detect_x86_gcc.cpp FIRFilter.h RateTransposer.h TDStretch.h PeakFinder.h lib_LTLIBRARIES=libSoundTouch.la # -libSoundTouch_la_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp mmx_optimized.cpp sse_optimized.cpp RateTransposer.cpp SoundTouch.cpp TDStretch.cpp cpu_detect_x86_gcc.cpp +libSoundTouch_la_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp mmx_optimized.cpp sse_optimized.cpp RateTransposer.cpp SoundTouch.cpp TDStretch.cpp cpu_detect_x86_gcc.cpp BPMDetect.cpp PeakFinder.cpp -# Note by authore: '-msse2' might not work in non-X86 compilations. If someone can -# fix this script to automatically check for CPU architecture, please submit a patch +# Note by authore: '-msse2' might not work in non-X86 compilations. If someone can +# fix this script to automatically check for CPU architecture, please submit a patch # to me. -AM_CXXFLAGS=-O3 -msse2 -fcheck-new -I../../include - +AM_CXXFLAGS=-O3 -msse2 -fcheck-new -I../../include + # other linking flags to add # noinst_LTLIBRARIES = libSoundTouchOpt.la diff --git a/source/example/Makefile.am b/source/example/Makefile.am index 3a41ba8..d653278 100644 --- a/source/example/Makefile.am +++ b/source/example/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/config/am_include.mk -SUBDIRS=bpm SoundStretch +SUBDIRS=SoundStretch # set to something if you want other stuff to be included in the distribution tarball #EXTRA_DIST= diff --git a/source/example/SoundStretch/Makefile.am b/source/example/SoundStretch/Makefile.am index d61b9d2..82b3f11 100644 --- a/source/example/SoundStretch/Makefile.am +++ b/source/example/SoundStretch/Makefile.am @@ -41,14 +41,13 @@ soundstretch_SOURCES=main.cpp RunParameters.cpp WavFile.cpp ## created by the above soundstretch_SOURCES are automatically linked in, so here I ## list object files from other directories as well as flags passed to the ## linker. -soundstretch_LDADD=../../SoundTouch/libSoundTouch.la ../bpm/libBPM.la -lm +soundstretch_LDADD=../../SoundTouch/libSoundTouch.la -lm ## linker flags soundstretch_LDFLAGS=-s ## additional compiler flags -soundstretch_CXXFLAGS=-O3 -I../bpm +soundstretch_CXXFLAGS=-O3 #clean-local: # -rm -f additional-files-to-remove-on-make-clean - diff --git a/source/example/SoundStretch/WavFile.cpp b/source/example/SoundStretch/WavFile.cpp index 7a7c506..b84afec 100644 --- a/source/example/SoundStretch/WavFile.cpp +++ b/source/example/SoundStretch/WavFile.cpp @@ -366,7 +366,7 @@ static int isAlphaStr(char *str) int WavInFile::readRIFFBlock() { - fread(&(header.riff), sizeof(WavRiff), 1, fptr); + if (fread(&(header.riff), sizeof(WavRiff), 1, fptr) != 1) return -1; // swap 32bit data byte order if necessary _swap32((unsigned int &)header.riff.package_len); @@ -388,7 +388,7 @@ int WavInFile::readHeaderBlock() string sLabel; // lead label string - fread(label, 1, 4, fptr); + if (fread(label, 1, 4, fptr) !=4) return -1; label[4] = 0; if (isAlphaStr(label) == 0) return -1; // not a valid label @@ -402,7 +402,7 @@ int WavInFile::readHeaderBlock() memcpy(header.format.fmt, fmtStr, 4); // read length of the format field - fread(&nLen, sizeof(int), 1, fptr); + if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1; // swap byte order if necessary _swap32((unsigned int &)nLen); // int format_len; header.format.format_len = nLen; @@ -417,7 +417,7 @@ int WavInFile::readHeaderBlock() } // read data - fread(&(header.format.fixed), nLen, 1, fptr); + if (fread(&(header.format.fixed), nLen, 1, fptr) != 1) return -1; // swap byte order if necessary _swap16((unsigned short &)header.format.fixed); // short int fixed; @@ -439,7 +439,7 @@ int WavInFile::readHeaderBlock() { // 'data' block memcpy(header.data.data_field, dataStr, 4); - fread(&(header.data.data_len), sizeof(uint), 1, fptr); + if (fread(&(header.data.data_len), sizeof(uint), 1, fptr) != 1) return -1; // swap byte order if necessary _swap32((unsigned int &)header.data.data_len); @@ -453,11 +453,11 @@ int WavInFile::readHeaderBlock() // unknown block // read length - fread(&len, sizeof(len), 1, fptr); + if (fread(&len, sizeof(len), 1, fptr) != 1) return -1; // scan through the block for (i = 0; i < len; i ++) { - fread(&temp, 1, 1, fptr); + if (fread(&temp, 1, 1, fptr) != 1) return -1; if (feof(fptr)) return -1; // unexpected eof } } diff --git a/source/example/SoundStretch/main.cpp b/source/example/SoundStretch/main.cpp index 963c540..3a0abe3 100644 --- a/source/example/SoundStretch/main.cpp +++ b/source/example/SoundStretch/main.cpp @@ -38,6 +38,7 @@ #include #include +#include #include "RunParameters.h" #include "WavFile.h" #include "SoundTouch.h" @@ -56,8 +57,8 @@ using namespace std; // Macro for Win32 standard input/output stream support: Sets a file stream into binary mode #define SET_STREAM_TO_BIN_MODE(f) (_setmode(fileno(f), _O_BINARY)) #else - // Not needed for GNU environment... ? - #define SET_STREAM_TO_BIN_MODE(f) () + // Not needed for GNU environment... + #define SET_STREAM_TO_BIN_MODE(f) {} #endif