diff --git a/configure.in b/configure.in
index e1e2efce..ec913929 100644
--- a/configure.in
+++ b/configure.in
@@ -60,6 +60,7 @@ AC_LANG_POP(C++)
AC_C_VARARRAYS
AC_C_BIGENDIAN
+AC_C_INLINE
AC_CHECK_TYPES(socklen_t, [], [])
@@ -316,12 +317,15 @@ fi
CPPFLAGS='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'" $CPPFLAGS"
if test "x$debug" = xtrue; then
- CPPFLAGS="-DDEBUG $CPPFLAGS"
+ CPPFLAGS="-DDEBUG -DFLaC__INLINE= $CPPFLAGS"
CFLAGS="-g $CFLAGS"
else
CPPFLAGS="-DNDEBUG $CPPFLAGS"
+ # $ac_cv_c_inline from AC_C_INLINE
+ if test "x$ac_cv_c_inline" != xno ; then
+ CPPFLAGS="-DFLaC__INLINE=$ac_cv_c_inline $CPPFLAGS"
+ fi
if test "x$GCC" = xyes; then
- CPPFLAGS="-DFLaC__INLINE=__inline__ $CPPFLAGS"
CFLAGS="-O3 -funroll-loops -finline-functions -Wall -W -Winline $CFLAGS"
fi
fi
diff --git a/doc/html/changelog.html b/doc/html/changelog.html
index d812626a..891c8e87 100644
--- a/doc/html/changelog.html
+++ b/doc/html/changelog.html
@@ -106,6 +106,7 @@
diff --git a/include/share/replaygain_analysis.h b/include/share/replaygain_analysis.h
index 02067d21..6aef649e 100644
--- a/include/share/replaygain_analysis.h
+++ b/include/share/replaygain_analysis.h
@@ -1,59 +1,59 @@
-/*
- * ReplayGainAnalysis - analyzes input samples and give the recommended dB change
- * Copyright (C) 2001 David Robinson and Glen Sawyer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * concept and filter values by David Robinson (David@Robinson.org)
- * -- blame him if you think the idea is flawed
- * coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
- * -- blame him if you think this runs too slowly, or the coding is otherwise flawed
- * minor cosmetic tweaks to integrate with FLAC by Josh Coalson
- *
- * For an explanation of the concepts and the basic algorithms involved, go to:
- * http://www.replaygain.org/
- */
-
-#ifndef GAIN_ANALYSIS_H
-#define GAIN_ANALYSIS_H
-
-#include
-
-#define GAIN_NOT_ENOUGH_SAMPLES -24601
-#define GAIN_ANALYSIS_ERROR 0
-#define GAIN_ANALYSIS_OK 1
-
-#define INIT_GAIN_ANALYSIS_ERROR 0
-#define INIT_GAIN_ANALYSIS_OK 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef float Float_t; /* Type used for filtering */
-
-extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
-
-int InitGainAnalysis ( long samplefreq );
-int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
-int ResetSampleFrequency ( long samplefreq );
-Float_t GetTitleGain ( void );
-Float_t GetAlbumGain ( void );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GAIN_ANALYSIS_H */
+/*
+ * ReplayGainAnalysis - analyzes input samples and give the recommended dB change
+ * Copyright (C) 2001 David Robinson and Glen Sawyer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * concept and filter values by David Robinson (David@Robinson.org)
+ * -- blame him if you think the idea is flawed
+ * coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
+ * -- blame him if you think this runs too slowly, or the coding is otherwise flawed
+ * minor cosmetic tweaks to integrate with FLAC by Josh Coalson
+ *
+ * For an explanation of the concepts and the basic algorithms involved, go to:
+ * http://www.replaygain.org/
+ */
+
+#ifndef GAIN_ANALYSIS_H
+#define GAIN_ANALYSIS_H
+
+#include
+
+#define GAIN_NOT_ENOUGH_SAMPLES -24601
+#define GAIN_ANALYSIS_ERROR 0
+#define GAIN_ANALYSIS_OK 1
+
+#define INIT_GAIN_ANALYSIS_ERROR 0
+#define INIT_GAIN_ANALYSIS_OK 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef float Float_t; /* Type used for filtering */
+
+extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
+
+int InitGainAnalysis ( long samplefreq );
+int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
+int ResetSampleFrequency ( long samplefreq );
+Float_t GetTitleGain ( void );
+Float_t GetAlbumGain ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GAIN_ANALYSIS_H */
diff --git a/src/libFLAC/libFLAC_dynamic.dsp b/src/libFLAC/libFLAC_dynamic.dsp
index 243f6395..17b9291d 100644
--- a/src/libFLAC/libFLAC_dynamic.dsp
+++ b/src/libFLAC/libFLAC_dynamic.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D FLaC__INLINE=_inline /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
diff --git a/src/libFLAC/libFLAC_dynamic.vcproj b/src/libFLAC/libFLAC_dynamic.vcproj
index f2322c34..b31cb17f 100644
--- a/src/libFLAC/libFLAC_dynamic.vcproj
+++ b/src/libFLAC/libFLAC_dynamic.vcproj
@@ -119,7 +119,7 @@
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLaC__INLINE=_inline"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
diff --git a/src/libFLAC/libFLAC_static.dsp b/src/libFLAC/libFLAC_static.dsp
index 9726b8ab..82541d10 100644
--- a/src/libFLAC/libFLAC_static.dsp
+++ b/src/libFLAC/libFLAC_static.dsp
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D FLaC__INLINE=_inline /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
diff --git a/src/libFLAC/libFLAC_static.vcproj b/src/libFLAC/libFLAC_static.vcproj
index fdb1b2fd..51435600 100644
--- a/src/libFLAC/libFLAC_static.vcproj
+++ b/src/libFLAC/libFLAC_static.vcproj
@@ -108,7 +108,7 @@
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL;FLaC__INLINE=_inline"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
diff --git a/src/plugin_common/plugin_common_static.dsp b/src/plugin_common/plugin_common_static.dsp
index 7415c8de..c8737739 100644
--- a/src/plugin_common/plugin_common_static.dsp
+++ b/src/plugin_common/plugin_common_static.dsp
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /WX /GX /Ox /Og /Oi /Os /Op /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GX /Ox /Og /Oi /Os /Op /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D FLaC__INLINE=_inline /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
diff --git a/src/plugin_common/plugin_common_static.vcproj b/src/plugin_common/plugin_common_static.vcproj
index 710ed961..4923c26d 100644
--- a/src/plugin_common/plugin_common_static.vcproj
+++ b/src/plugin_common/plugin_common_static.vcproj
@@ -108,7 +108,7 @@
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL;FLaC__INLINE=_inline"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
diff --git a/src/share/replaygain_analysis/replaygain_analysis.c b/src/share/replaygain_analysis/replaygain_analysis.c
index 027b0ad8..35f29c0a 100644
--- a/src/share/replaygain_analysis/replaygain_analysis.c
+++ b/src/share/replaygain_analysis/replaygain_analysis.c
@@ -110,24 +110,24 @@ typedef signed int Int32_t;
#define YULE_ORDER 10
#define BUTTER_ORDER 2
#define RMS_PERCENTILE 0.95 /* percentile which is louder than the proposed level */
-#define MAX_SAMP_FREQ 48000. /* maximum allowed sample frequency [Hz] */
-#define RMS_WINDOW_TIME 0.050 /* Time slice size [s] */
+#define MAX_SAMP_FREQ 48000 /* maximum allowed sample frequency [Hz] */
+#define RMS_WINDOW_TIME 50 /* Time slice size [ms] */
#define STEPS_per_dB 100. /* Table entries per dB */
#define MAX_dB 120. /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */
#define MAX_ORDER (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
/* [JEC] the following was originally #defined as:
- * (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME)
+ * (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME / 1000)
* but that seemed to fail to take into account the ceil() part of the
* sampleWindow calculation in ResetSampleFrequency(), and was causing
* buffer overflows for 48kHz analysis, hence the +1.
*/
-#ifndef __sun
- #define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1.) /* max. Samples per Time slice */
-#else
- /* [JEC] Solaris Forte compiler doesn't like float calc in array indices */
- #define MAX_SAMPLES_PER_WINDOW (size_t) (2401)
-#endif
+/* [JEC] WATCHOUT: if MAX_SAMP_FREQ * RMS_WINDOW_TIME / 1000 is not an
+ * integer it must be manually rounded up. there is a limit on the
+ * kind of calculation that can be done in array size definition (e.g.
+ * Sun Forte compiler cannot handle any floating point terms).
+ */
+#define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME / 1000 + 1) /* max. Samples per Time slice */
#define PINK_REF 64.82 /* 298640883795 */ /* calibration value */
static Float_t linprebuf [MAX_ORDER * 2];
@@ -255,7 +255,7 @@ ResetSampleFrequency ( long samplefreq ) {
default: return INIT_GAIN_ANALYSIS_ERROR;
}
- sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME);
+ sampleWindow = (int) ceil ((double)samplefreq * (double)RMS_WINDOW_TIME / 1000.0);
lsum = 0.;
rsum = 0.;