shithub: sox

Download patch

ref: 0d83b778c62fb0a8186f96ab52a1e2248bd0ad97
parent: a89de0a6e11d26f3dbebbf60c123481eeb6566dc
author: Doug Cook <idigdoug@users.sourceforge.net>
date: Mon Dec 19 08:56:16 EST 2011

Add hilbert.c and upsample.c to MSVC projects.
Fix typo in COPYING file.
Change global variable lsx_wave_enum to function lsx_get_wave_enum().
Fall back to "long long" if limits.h does not define LLONG_MAX (for GCC 3 compat).

--- a/COPYING
+++ b/COPYING
@@ -5,7 +5,7 @@
 GPL, while the files that make up libsox are licensed under the less
 restrictive LGPL.
 
-Note that some of the external packages that can be linked in to libsox
+Note that some of the external packages that can be linked into libsox
 are GPLed and/or may have licensing problems, so they can be disabled
 at configure time with the relevant--with-* options. If libsox is built
 with such libraries, it must be distributed under the GPL.
--- a/msvc10/LibSoX.vcxproj
+++ b/msvc10/LibSoX.vcxproj
@@ -165,6 +165,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\src\hilbert.c" />
     <ClCompile Include="..\src\oss.c">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -246,6 +247,7 @@
     <ClCompile Include="..\src\tempo.c" />
     <ClCompile Include="..\src\tremolo.c" />
     <ClCompile Include="..\src\trim.c" />
+    <ClCompile Include="..\src\upsample.c" />
     <ClCompile Include="..\src\vad.c" />
     <ClCompile Include="..\src\vol.c" />
     <ClCompile Include="..\src\8svx.c" />
--- a/msvc10/LibSoX.vcxproj.filters
+++ b/msvc10/LibSoX.vcxproj.filters
@@ -606,5 +606,11 @@
     <ClCompile Include="..\src\xmalloc.c">
       <Filter>Shared Sources</Filter>
     </ClCompile>
+    <ClCompile Include="..\src\hilbert.c">
+      <Filter>Effect Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\src\upsample.c">
+      <Filter>Effect Sources</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file
--- a/msvc9/LibSoX.vcproj
+++ b/msvc9/LibSoX.vcproj
@@ -716,6 +716,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\src\hilbert.c"
+				>
+			</File>
+			<File
 				RelativePath="..\src\input.c"
 				>
 			</File>
@@ -837,6 +841,10 @@
 			</File>
 			<File
 				RelativePath="..\src\trim.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\upsample.c"
 				>
 			</File>
 			<File
--- a/src/effects_i.c
+++ b/src/effects_i.c
@@ -47,10 +47,15 @@
   return *usage;
 }
 
-lsx_enum_item const lsx_wave_enum[] = {
+static lsx_enum_item const s_lsx_wave_enum[] = {
   LSX_ENUM_ITEM(SOX_WAVE_,SINE)
   LSX_ENUM_ITEM(SOX_WAVE_,TRIANGLE)
   {0, 0}};
+
+lsx_enum_item const * lsx_get_wave_enum(void)
+{
+  return s_lsx_wave_enum;
+}
 
 void lsx_generate_wave_table(
     lsx_wave_t wave_type,
--- a/src/flanger.c
+++ b/src/flanger.c
@@ -76,7 +76,7 @@
     NUMERIC_PARAMETER(feedback_gain,-95 , 95 )
     NUMERIC_PARAMETER(delay_gain   , 0  , 100)
     NUMERIC_PARAMETER(speed        , 0.1, 10 )
-    TEXTUAL_PARAMETER(wave_shape, lsx_wave_enum)
+    TEXTUAL_PARAMETER(wave_shape, lsx_get_wave_enum())
     NUMERIC_PARAMETER(channel_phase, 0  , 100)
     TEXTUAL_PARAMETER(interpolation, interp_enum)
   } while (0);
@@ -98,7 +98,7 @@
       p->feedback_gain,
       p->delay_gain,
       p->speed,
-      lsx_wave_enum[p->wave_shape].text,
+      lsx_get_wave_enum()[p->wave_shape].text,
       p->channel_phase,
       interp_enum[p->interpolation].text);
 
--- a/src/sox.h
+++ b/src/sox.h
@@ -15,6 +15,9 @@
 #include <stdarg.h>
 #include <stddef.h>
 
+#define lsx_static_assert(e,f) \
+    enum {lsx_static_assert_##f = 1/(e)}
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
@@ -79,7 +82,8 @@
 #elif defined(_MSC_VER)
 typedef __int64 sox_int64_t;
 #else
-#error Unable to determine an appropriate definition for sox_int64_t.
+typedef long long sox_int64_t;
+lsx_static_assert(sizeof(sox_int64_t)==8, sox_int64_size);
 #endif
 
 #if ULONG_MAX==0xffffffffffffffff
@@ -89,7 +93,8 @@
 #elif defined(_MSC_VER)
 typedef unsigned __int64 sox_uint64_t;
 #else
-#error Unable to determine an appropriate definition for sox_uint64_t.
+typedef unsigned long long sox_uint64_t;
+lsx_static_assert(sizeof(sox_uint64_t)==8, sox_uint64_size);
 #endif
 
 typedef sox_int32_t sox_int24_t;   /* sox_int24_t == sox_int32_t (beware of the extra byte) */
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -42,7 +42,7 @@
 
 typedef enum {SOX_SHORT, SOX_INT, SOX_FLOAT, SOX_DOUBLE} sox_data_t;
 typedef enum {SOX_WAVE_SINE, SOX_WAVE_TRIANGLE} lsx_wave_t;
-extern lsx_enum_item const lsx_wave_enum[];
+lsx_enum_item const * lsx_get_wave_enum(void);
 
 /* Define fseeko and ftello for platforms lacking them */
 #ifndef HAVE_FSEEKO