michael@0: diff -u /src/cpu_detect_x86.cpp /src/cpu_detect_x86.cpp michael@0: --- /src/cpu_detect_x86.cpp michael@0: +++ /src/cpu_detect_x86.cpp michael@0: @@ -44,9 +44,8 @@ michael@0: michael@0: michael@0: #if defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS) michael@0: - michael@0: - #if defined(__GNUC__) && defined(__i386__) michael@0: - // gcc michael@0: + #if defined(__GNUC__) && defined(HAVE_CPUID_H) michael@0: + // gcc and clang michael@0: #include "cpuid.h" michael@0: #elif defined(_M_IX86) michael@0: // windows non-gcc michael@0: @@ -97,18 +96,7 @@ michael@0: michael@0: uint res = 0; michael@0: michael@0: -#if defined(__GNUC__) michael@0: - // GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support. michael@0: - uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable. michael@0: - michael@0: - // Check if no cpuid support. michael@0: - if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; // always disable extensions. michael@0: - michael@0: - if (edx & bit_MMX) res = res | SUPPORT_MMX; michael@0: - if (edx & bit_SSE) res = res | SUPPORT_SSE; michael@0: - if (edx & bit_SSE2) res = res | SUPPORT_SSE2; michael@0: - michael@0: -#else michael@0: +#if !defined(__GNUC__) michael@0: // Window / VS version of cpuid. Notice that Visual Studio 2005 or later required michael@0: // for __cpuid intrinsic support. michael@0: int reg[4] = {-1}; michael@0: @@ -121,7 +109,19 @@ michael@0: if ((unsigned int)reg[3] & bit_MMX) res = res | SUPPORT_MMX; michael@0: if ((unsigned int)reg[3] & bit_SSE) res = res | SUPPORT_SSE; michael@0: if ((unsigned int)reg[3] & bit_SSE2) res = res | SUPPORT_SSE2; michael@0: +#elif defined(HAVE_CPUID_H) michael@0: + // GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support. michael@0: + uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable. michael@0: + michael@0: + // Check if no cpuid support. michael@0: + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; // always disable extensions. michael@0: michael@0: + if (edx & bit_MMX) res = res | SUPPORT_MMX; michael@0: + if (edx & bit_SSE) res = res | SUPPORT_SSE; michael@0: + if (edx & bit_SSE2) res = res | SUPPORT_SSE2; michael@0: +#else michael@0: + // Compatible with GCC but no cpuid.h. michael@0: + return 0; michael@0: #endif michael@0: michael@0: return res & ~_dwDisabledISA; michael@0: diff -u /src/STTypes.h /src/STTypes.h michael@0: --- /src/STTypes.h michael@0: +++ /src/STTypes.h michael@0: @@ -54,12 +54,17 @@ michael@0: #define SOUNDTOUCH_ALIGN_POINTER_16(x) ( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 ) michael@0: michael@0: michael@0: -#if (defined(__GNUC__) && !defined(ANDROID)) michael@0: - // In GCC, include soundtouch_config.h made by config scritps. michael@0: - // Skip this in Android compilation that uses GCC but without configure scripts. michael@0: - #include "soundtouch_config.h" michael@0: -#endif michael@0: +#include "soundtouch_config.h" michael@0: michael@0: +#ifdef WIN32 michael@0: +#ifdef BUILDING_SOUNDTOUCH michael@0: +#define EXPORT __declspec(dllexport) michael@0: +#else michael@0: +#define EXPORT __declspec(dllimport) michael@0: +#endif michael@0: +#else michael@0: +#define EXPORT michael@0: +#endif michael@0: michael@0: namespace soundtouch michael@0: { michael@0: @@ -164,7 +169,7 @@ michael@0: }; michael@0: michael@0: // define ST_NO_EXCEPTION_HANDLING switch to disable throwing std exceptions: michael@0: -// #define ST_NO_EXCEPTION_HANDLING 1 michael@0: +#define ST_NO_EXCEPTION_HANDLING 1 michael@0: #ifdef ST_NO_EXCEPTION_HANDLING michael@0: // Exceptions disabled. Throw asserts instead if enabled. michael@0: #include michael@0: diff -u /src/SoundTouch.h /src/SoundTouch.h michael@0: --- /src/SoundTouch.h michael@0: +++ /src/SoundTouch.h michael@0: @@ -141,7 +141,7 @@ michael@0: /// tempo/pitch/rate/samplerate settings. michael@0: #define SETTING_NOMINAL_OUTPUT_SEQUENCE 7 michael@0: michael@0: -class SoundTouch : public FIFOProcessor michael@0: +class EXPORT SoundTouch : public FIFOProcessor michael@0: { michael@0: private: michael@0: /// Rate transposer class instance michael@0: diff -u /src/FIRFilter.cpp /src/FIRFilter.cpp michael@0: --- /src/FIRFilter.cpp michael@0: +++ /src/FIRFilter.cpp michael@0: @@ -46,6 +46,11 @@ michael@0: #include "FIRFilter.h" michael@0: #include "cpu_detect.h" michael@0: michael@0: +#ifdef _MSC_VER michael@0: +#include michael@0: +#define alloca _alloca michael@0: +#endif michael@0: + michael@0: using namespace soundtouch; michael@0: michael@0: /***************************************************************************** michael@0: @@ -291,9 +296,11 @@ michael@0: michael@0: FIRFilter * FIRFilter::newInstance() michael@0: { michael@0: +#if defined(SOUNDTOUCH_ALLOW_MMX) || defined(SOUNDTOUCH_ALLOW_SSE) michael@0: uint uExtensions; michael@0: michael@0: uExtensions = detectCPUextensions(); michael@0: +#endif michael@0: michael@0: // Check if MMX/SSE instruction set extensions supported by CPU michael@0: michael@0: diff -u /src/TDStretch.cpp /src/TDStretch.cpp michael@0: --- /src/TDStretch.cpp michael@0: +++ /src/TDStretch.cpp michael@0: @@ -624,9 +624,11 @@ michael@0: michael@0: TDStretch * TDStretch::newInstance() michael@0: { michael@0: +#if defined(SOUNDTOUCH_ALLOW_MMX) || defined(SOUNDTOUCH_ALLOW_SSE) michael@0: uint uExtensions; michael@0: michael@0: uExtensions = detectCPUextensions(); michael@0: +#endif michael@0: michael@0: // Check if MMX/SSE instruction set extensions supported by CPU michael@0: michael@0: diff -u /src/SoundTouch.cpp /src/SoundTouch.cpp michael@0: --- /src/SoundTouch.cpp michael@0: +++ /src/SoundTouch.cpp michael@0: @@ -80,6 +80,11 @@ michael@0: #include "RateTransposer.h" michael@0: #include "cpu_detect.h" michael@0: michael@0: +#ifdef _MSC_VER michael@0: +#include michael@0: +#define alloca _alloca michael@0: +#endif michael@0: + michael@0: using namespace soundtouch; michael@0: michael@0: /// test if two floating point numbers are equal