external libs: updates to opus and libmodplug, rebuild:
authorOzkan Sezer <sezeroz@gmail.com>
Thu, 05 Dec 2019 01:41:50 +0300
changeset 1055df723393f0cf
parent 1054 ae77864d2fa7
child 1056 4e97a14ce2bf
external libs: updates to opus and libmodplug, rebuild:

opus:
- bugfix commit 8493bf50 from mainstream git, add missing src

libmodplug:
- replace GlobalAllocPtr()/GlobalFreePtr with calloc()/free().
- replace POSIX.1 sranrom()/random with ANSI C srand()/rand().
- fix wrong translation of POSIX.1 sleep into Windows Sleep().
- add FIXME note about the non-Windows BOOL typedef.
VisualC/external/lib/x64/libmodplug-1.dll
VisualC/external/lib/x64/libopus-0.dll
VisualC/external/lib/x86/libmodplug-1.dll
VisualC/external/lib/x86/libopus-0.dll
Xcode/Frameworks/Opus.framework/Versions/A/Opus
Xcode/Frameworks/modplug.framework/Versions/A/modplug
external/libmodplug-0.8.9.0.patch
external/libmodplug-0.8.9.0/libmodplug-0.8.9.0.patch
external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h
external/libmodplug-0.8.9.0/src/load_abc.cpp
external/libmodplug-0.8.9.0/src/load_mid.cpp
external/libmodplug-0.8.9.0/src/load_pat.cpp
external/libmodplug-0.8.9.0/src/mmcmp.cpp
external/libmodplug-0.8.9.0/src/sndfile.cpp
external/opus-1.3.1/0004-opus.git-8493bf50.patch
external/opus-1.3.1/celt/arm/celt_pitch_xcorr_arm-gnu.S
external/opus-1.3.1/src/opus_multistream_decoder.c
     1.1 Binary file VisualC/external/lib/x64/libmodplug-1.dll has changed
     2.1 Binary file VisualC/external/lib/x64/libopus-0.dll has changed
     3.1 Binary file VisualC/external/lib/x86/libmodplug-1.dll has changed
     4.1 Binary file VisualC/external/lib/x86/libopus-0.dll has changed
     5.1 Binary file Xcode/Frameworks/Opus.framework/Versions/A/Opus has changed
     6.1 Binary file Xcode/Frameworks/modplug.framework/Versions/A/modplug has changed
     7.1 --- a/external/libmodplug-0.8.9.0.patch	Wed Dec 04 18:50:02 2019 +0300
     7.2 +++ b/external/libmodplug-0.8.9.0.patch	Thu Dec 05 01:41:50 2019 +0300
     7.3 @@ -1,7 +1,7 @@
     7.4  diff -ruN libmodplug-0.8.9.0.orig/Android.mk libmodplug-0.8.9.0/Android.mk
     7.5  --- libmodplug-0.8.9.0.orig/Android.mk	1969-12-31 16:00:00.000000000 -0800
     7.6  +++ libmodplug-0.8.9.0/Android.mk	2017-10-22 11:43:42.132552241 -0700
     7.7 -@@ -0,0 +1,47 @@
     7.8 +@@ -0,0 +1,46 @@
     7.9  +LOCAL_PATH := $(call my-dir)
    7.10  +
    7.11  +include $(CLEAR_VARS)
     8.1 --- a/external/libmodplug-0.8.9.0/libmodplug-0.8.9.0.patch	Wed Dec 04 18:50:02 2019 +0300
     8.2 +++ b/external/libmodplug-0.8.9.0/libmodplug-0.8.9.0.patch	Thu Dec 05 01:41:50 2019 +0300
     8.3 @@ -14,69 +14,10 @@
     8.4  - merge libmodplug github PR/41 (timidity paths update)
     8.5  - merge libmodplug github PR/24 (make some stuff static)
     8.6  
     8.7 -diff -u libmodplug-0.8.9.0/configure.ac~ libmodplug-0.8.9.0/configure.ac
     8.8 ---- libmodplug-0.8.9.0/configure.ac~
     8.9 -+++ libmodplug-0.8.9.0/configure.ac
    8.10 -@@ -29,7 +29,7 @@ LT_INIT([win32-dll])
    8.11 - 
    8.12 - AC_HEADER_STDC
    8.13 - AC_CHECK_HEADERS([inttypes.h stdint.h malloc.h])
    8.14 --AC_CHECK_FUNCS(setenv sinf)
    8.15 -+AC_CHECK_FUNCS(sinf)
    8.16 - 
    8.17 - CXXFLAGS="$CXXFLAGS -fno-exceptions -Wall -ffast-math -fno-common -D_REENTRANT"
    8.18 - 
    8.19 -@@ -82,6 +82,39 @@ case ${target_os} in
    8.20 - 		;;
    8.21 - esac
    8.22 - 
    8.23 -+AC_ARG_ENABLE([cxx_interface],
    8.24 -+    [AS_HELP_STRING([--enable-cxx-interface],
    8.25 -+                    [export C++ interface from library [[default=yes]]])],,
    8.26 -+    [enable_cxx_interface=yes])
    8.27 -+if test x$enable_cxx_interface != xyes; then
    8.28 -+    AC_DEFINE(NO_CXX_EXPORTS, 1, [Do not export the C++ interface.])
    8.29 -+fi
    8.30 -+AM_CONDITIONAL(EXPORT_CXX, test x$enable_cxx_interface = xyes)
    8.31 -+
    8.32 -+AC_ARG_ENABLE([midi],
    8.33 -+    [AS_HELP_STRING([--enable-midi],
    8.34 -+                    [compile with midi formats support [[default=no]]])],,
    8.35 -+    [enable_midi=no])
    8.36 -+if test x$enable_midi = xyes; then
    8.37 -+    AC_DEFINE(MIDIFMT_SUPPORT, 1, [Enable midi formats support.])
    8.38 -+fi
    8.39 -+
    8.40 -+AC_ARG_ENABLE([wav],
    8.41 -+    [AS_HELP_STRING([--enable-wav],
    8.42 -+                    [compile with wav formats support [[default=no]]])],,
    8.43 -+    [enable_wav=no])
    8.44 -+if test x$enable_wav = xyes; then
    8.45 -+    AC_DEFINE(WAV_SUPPORT, 1, [Enable wav formats support.])
    8.46 -+fi
    8.47 -+
    8.48 -+AC_ARG_ENABLE([mmcmp],
    8.49 -+    [AS_HELP_STRING([--enable-mmcmp],
    8.50 -+                    [compile with mmcmp and pp20 decompression support [[default=no]]])],,
    8.51 -+    [enable_mmcmp=no])
    8.52 -+if test x$enable_mmcmp = xyes; then
    8.53 -+    AC_DEFINE(MMCMP_SUPPORT, 1, [Enable mmcmp and pp20 decompression support.])
    8.54 -+fi
    8.55 -+
    8.56 - # portable types. requires autoconf 2.60
    8.57 - # `configure' will check if these are defined in system headers.
    8.58 - # if not, it will auto-detect and define them in `config.h'
    8.59 -@@ -99,6 +132,6 @@ MODPLUG_LIBRARY_VERSION=1:0:0
    8.60 - AC_SUBST(MODPLUG_LIBRARY_VERSION)
    8.61 - 
    8.62 - AC_CONFIG_FILES([Makefile
    8.63 --          src/Makefile
    8.64 -+	  src/Makefile
    8.65 - 	  libmodplug.pc])
    8.66 - AC_OUTPUT
    8.67 -diff -u libmodplug-0.8.9.0/CMakeLists.txt~ libmodplug-0.8.9.0/CMakeLists.txt
    8.68 ---- libmodplug-0.8.9.0/CMakeLists.txt~
    8.69 -+++ libmodplug-0.8.9.0/CMakeLists.txt
    8.70 +diff --git a/CMakeLists.txt b/CMakeLists.txt
    8.71 +index 468f1a3..34099d8 100644
    8.72 +--- a/CMakeLists.txt
    8.73 ++++ b/CMakeLists.txt
    8.74  @@ -1,19 +1,73 @@
    8.75   cmake_minimum_required(VERSION 2.8.0)
    8.76   
    8.77 @@ -85,7 +26,7 @@
    8.78  +set(VERSION "0.8.9.0")
    8.79  +
    8.80  +option(BUILD_SHARED_LIBS "Build Shared Library (DLL)" OFF)
    8.81 -+option(EXPORT_CXX "Export C++ interface from library" OFF)
    8.82 ++option(EXPORT_CXX "Export C++ interface from library" ON)
    8.83  +option(MIDIFMT_SUPPORT "Enable midi formats support" OFF)
    8.84  +option(WAV_SUPPORT "Enable wav formats support" OFF)
    8.85  +option(MMCMP_SUPPORT "Enable mmcmp and pp20 decompression support" OFF)
    8.86 @@ -288,140 +229,10 @@
    8.87   
    8.88   if (NOT WIN32)
    8.89     set(prefix "${CMAKE_INSTALL_PREFIX}")
    8.90 -diff -u libmodplug-0.8.9.0/configure~ libmodplug-0.8.9.0/configure
    8.91 ---- libmodplug-0.8.9.0/configure~
    8.92 -+++ libmodplug-0.8.9.0/configure
    8.93 -@@ -634,6 +634,8 @@ am__EXEEXT_TRUE
    8.94 - LTLIBOBJS
    8.95 - LIBOBJS
    8.96 - MODPLUG_LIBRARY_VERSION
    8.97 -+EXPORT_CXX_FALSE
    8.98 -+EXPORT_CXX_TRUE
    8.99 - LT_LDFLAGS
   8.100 - LT_SYS_LIBRARY_PATH
   8.101 - OTOOL64
   8.102 -@@ -772,6 +774,10 @@ with_aix_soname
   8.103 - with_gnu_ld
   8.104 - with_sysroot
   8.105 - enable_libtool_lock
   8.106 -+enable_cxx_interface
   8.107 -+enable_midi
   8.108 -+enable_wav
   8.109 -+enable_mmcmp
   8.110 - '
   8.111 -       ac_precious_vars='build_alias
   8.112 - host_alias
   8.113 -@@ -1418,6 +1424,11 @@ Optional Features:
   8.114 -   --enable-fast-install[=PKGS]
   8.115 -                           optimize for fast installation [default=yes]
   8.116 -   --disable-libtool-lock  avoid locking (might break parallel builds)
   8.117 -+  --enable-cxx-interface  export C++ interface from library [[default=yes]]
   8.118 -+  --enable-midi           compile with midi formats support [[default=no]]
   8.119 -+  --enable-wav            compile with wav formats support [[default=no]]
   8.120 -+  --enable-mmcmp          compile with mmcmp and pp20 decompression support
   8.121 -+                          [[default=no]]
   8.122 - 
   8.123 - Optional Packages:
   8.124 -   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   8.125 -@@ -16702,13 +16713,12 @@ fi
   8.126 - 
   8.127 - done
   8.128 - 
   8.129 --for ac_func in setenv sinf
   8.130 -+for ac_func in sinf
   8.131 - do :
   8.132 --  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
   8.133 --ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
   8.134 --if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   8.135 -+  ac_fn_cxx_check_func "$LINENO" "sinf" "ac_cv_func_sinf"
   8.136 -+if test "x$ac_cv_func_sinf" = xyes; then :
   8.137 -   cat >>confdefs.h <<_ACEOF
   8.138 --#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
   8.139 -+#define HAVE_SINF 1
   8.140 - _ACEOF
   8.141 - 
   8.142 - fi
   8.143 -@@ -16786,6 +16796,66 @@ case ${target_os} in
   8.144 - 		;;
   8.145 - esac
   8.146 - 
   8.147 -+# Check whether --enable-cxx_interface was given.
   8.148 -+if test "${enable_cxx_interface+set}" = set; then :
   8.149 -+  enableval=$enable_cxx_interface;
   8.150 -+else
   8.151 -+  enable_cxx_interface=yes
   8.152 -+fi
   8.153 -+
   8.154 -+if test x$enable_cxx_interface != xyes; then
   8.155 -+
   8.156 -+$as_echo "#define NO_CXX_EXPORTS 1" >>confdefs.h
   8.157 -+
   8.158 -+fi
   8.159 -+ if test x$enable_cxx_interface = xyes; then
   8.160 -+  EXPORT_CXX_TRUE=
   8.161 -+  EXPORT_CXX_FALSE='#'
   8.162 -+else
   8.163 -+  EXPORT_CXX_TRUE='#'
   8.164 -+  EXPORT_CXX_FALSE=
   8.165 -+fi
   8.166 -+
   8.167 -+
   8.168 -+# Check whether --enable-midi was given.
   8.169 -+if test "${enable_midi+set}" = set; then :
   8.170 -+  enableval=$enable_midi;
   8.171 -+else
   8.172 -+  enable_midi=no
   8.173 -+fi
   8.174 -+
   8.175 -+if test x$enable_midi = xyes; then
   8.176 -+
   8.177 -+$as_echo "#define MIDIFMT_SUPPORT 1" >>confdefs.h
   8.178 -+
   8.179 -+fi
   8.180 -+
   8.181 -+# Check whether --enable-wav was given.
   8.182 -+if test "${enable_wav+set}" = set; then :
   8.183 -+  enableval=$enable_wav;
   8.184 -+else
   8.185 -+  enable_wav=no
   8.186 -+fi
   8.187 -+
   8.188 -+if test x$enable_wav = xyes; then
   8.189 -+
   8.190 -+$as_echo "#define WAV_SUPPORT 1" >>confdefs.h
   8.191 -+
   8.192 -+fi
   8.193 -+
   8.194 -+# Check whether --enable-mmcmp was given.
   8.195 -+if test "${enable_mmcmp+set}" = set; then :
   8.196 -+  enableval=$enable_mmcmp;
   8.197 -+else
   8.198 -+  enable_mmcmp=no
   8.199 -+fi
   8.200 -+
   8.201 -+if test x$enable_mmcmp = xyes; then
   8.202 -+
   8.203 -+$as_echo "#define MMCMP_SUPPORT 1" >>confdefs.h
   8.204 -+
   8.205 -+fi
   8.206 -+
   8.207 - # portable types. requires autoconf 2.60
   8.208 - # `configure' will check if these are defined in system headers.
   8.209 - # if not, it will auto-detect and define them in `config.h'
   8.210 -@@ -17036,6 +17106,10 @@ if test -z "${am__fastdepCXX_TRUE}" && t
   8.211 - Usually this means the macro was only invoked conditionally." "$LINENO" 5
   8.212 - fi
   8.213 - 
   8.214 -+if test -z "${EXPORT_CXX_TRUE}" && test -z "${EXPORT_CXX_FALSE}"; then
   8.215 -+  as_fn_error $? "conditional \"EXPORT_CXX\" was never defined.
   8.216 -+Usually this means the macro was only invoked conditionally." "$LINENO" 5
   8.217 -+fi
   8.218 - 
   8.219 - : "${CONFIG_STATUS=./config.status}"
   8.220 - ac_write_fail=0
   8.221 -diff -u libmodplug-0.8.9.0/Makefile.am~ libmodplug-0.8.9.0b/Makefile.am
   8.222 ---- libmodplug-0.8.9.0/Makefile.am
   8.223 -+++ libmodplug-0.8.9.0/Makefile.am
   8.224 +diff --git a/Makefile.am b/Makefile.am
   8.225 +index abb51c1..0bf6578 100644
   8.226 +--- a/Makefile.am
   8.227 ++++ b/Makefile.am
   8.228  @@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
   8.229   
   8.230   SUBDIRS = src
   8.231 @@ -431,21 +242,94 @@
   8.232   	AUTHORS COPYING ChangeLog \
   8.233   	INSTALL README TODO
   8.234   
   8.235 -diff -u libmodplug-0.8.9.0/Makefile.in~ libmodplug-0.8.9.0b/Makefile.in
   8.236 ---- libmodplug-0.8.9.0/Makefile.in
   8.237 -+++ libmodplug-0.8.9.0/Makefile.in
   8.238 -@@ -359,7 +359,7 @@ top_builddir = @top_builddir@
   8.239 - top_srcdir = @top_srcdir@
   8.240 - ACLOCAL_AMFLAGS = -I m4
   8.241 - SUBDIRS = src
   8.242 --EXTRA_DIST = \
   8.243 -+EXTRA_DIST = CMakeLists.txt \
   8.244 - 	AUTHORS COPYING ChangeLog \
   8.245 - 	INSTALL README TODO
   8.246 +diff --git a/configure.ac b/configure.ac
   8.247 +index f96a28e..42a161d 100644
   8.248 +--- a/configure.ac
   8.249 ++++ b/configure.ac
   8.250 +@@ -29,7 +29,7 @@ LT_INIT([win32-dll])
   8.251   
   8.252 -diff -u libmodplug-0.8.9.0/src/config.h.in~ libmodplug-0.8.9.0/src/config.h.in
   8.253 ---- libmodplug-0.8.9.0/src/config.h.in~
   8.254 -+++ libmodplug-0.8.9.0/src/config.h.in
   8.255 + AC_HEADER_STDC
   8.256 + AC_CHECK_HEADERS([inttypes.h stdint.h malloc.h])
   8.257 +-AC_CHECK_FUNCS(setenv sinf)
   8.258 ++AC_CHECK_FUNCS(sinf)
   8.259 + 
   8.260 + CXXFLAGS="$CXXFLAGS -fno-exceptions -Wall -ffast-math -fno-common -D_REENTRANT"
   8.261 + 
   8.262 +@@ -82,6 +82,39 @@ case ${target_os} in
   8.263 + 		;;
   8.264 + esac
   8.265 + 
   8.266 ++AC_ARG_ENABLE([cxx_interface],
   8.267 ++    [AS_HELP_STRING([--enable-cxx-interface],
   8.268 ++                    [export C++ interface from library [[default=yes]]])],,
   8.269 ++    [enable_cxx_interface=yes])
   8.270 ++if test x$enable_cxx_interface != xyes; then
   8.271 ++    AC_DEFINE(NO_CXX_EXPORTS, 1, [Do not export the C++ interface.])
   8.272 ++fi
   8.273 ++AM_CONDITIONAL(EXPORT_CXX, test x$enable_cxx_interface = xyes)
   8.274 ++
   8.275 ++AC_ARG_ENABLE([midi],
   8.276 ++    [AS_HELP_STRING([--enable-midi],
   8.277 ++                    [compile with midi formats support [[default=no]]])],,
   8.278 ++    [enable_midi=no])
   8.279 ++if test x$enable_midi = xyes; then
   8.280 ++    AC_DEFINE(MIDIFMT_SUPPORT, 1, [Enable midi formats support.])
   8.281 ++fi
   8.282 ++
   8.283 ++AC_ARG_ENABLE([wav],
   8.284 ++    [AS_HELP_STRING([--enable-wav],
   8.285 ++                    [compile with wav formats support [[default=no]]])],,
   8.286 ++    [enable_wav=no])
   8.287 ++if test x$enable_wav = xyes; then
   8.288 ++    AC_DEFINE(WAV_SUPPORT, 1, [Enable wav formats support.])
   8.289 ++fi
   8.290 ++
   8.291 ++AC_ARG_ENABLE([mmcmp],
   8.292 ++    [AS_HELP_STRING([--enable-mmcmp],
   8.293 ++                    [compile with mmcmp and pp20 decompression support [[default=no]]])],,
   8.294 ++    [enable_mmcmp=no])
   8.295 ++if test x$enable_mmcmp = xyes; then
   8.296 ++    AC_DEFINE(MMCMP_SUPPORT, 1, [Enable mmcmp and pp20 decompression support.])
   8.297 ++fi
   8.298 ++
   8.299 + # portable types. requires autoconf 2.60
   8.300 + # `configure' will check if these are defined in system headers.
   8.301 + # if not, it will auto-detect and define them in `config.h'
   8.302 +@@ -99,6 +132,6 @@ MODPLUG_LIBRARY_VERSION=1:0:0
   8.303 + AC_SUBST(MODPLUG_LIBRARY_VERSION)
   8.304 + 
   8.305 + AC_CONFIG_FILES([Makefile
   8.306 +-          src/Makefile
   8.307 ++	  src/Makefile
   8.308 + 	  libmodplug.pc])
   8.309 + AC_OUTPUT
   8.310 +diff --git a/src/Makefile.am b/src/Makefile.am
   8.311 +index 19b32cc..00cecf4 100644
   8.312 +--- a/src/Makefile.am
   8.313 ++++ b/src/Makefile.am
   8.314 +@@ -35,7 +35,6 @@ libmodplug_la_SOURCES = tables.h         \
   8.315 +                         load_ams.cpp       \
   8.316 +                         load_amf.cpp       \
   8.317 +                         load_669.cpp       \
   8.318 +-                        load_j2b.cpp       \
   8.319 +                         load_mt2.cpp       \
   8.320 +                         load_psm.cpp       \
   8.321 +                         load_abc.cpp       \
   8.322 +@@ -45,6 +44,8 @@ libmodplug_la_SOURCES = tables.h         \
   8.323 + 
   8.324 + libmodplugincludedir = $(includedir)/libmodplug
   8.325 + 
   8.326 +-
   8.327 +-libmodpluginclude_HEADERS = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h modplug.h
   8.328 ++if EXPORT_CXX
   8.329 ++HEADERS_CXX = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h
   8.330 ++endif
   8.331 ++libmodpluginclude_HEADERS = modplug.h $(HEADERS_CXX)
   8.332 + noinst_HEADERS = load_pat.h
   8.333 +diff --git a/src/config.h.in b/src/config.h.in
   8.334 +index 4190283..2eb5f6a 100644
   8.335 +--- a/src/config.h.in
   8.336 ++++ b/src/config.h.in
   8.337  @@ -15,9 +15,6 @@
   8.338   /* Define to 1 if you have the <memory.h> header file. */
   8.339   #undef HAVE_MEMORY_H
   8.340 @@ -482,9 +366,10 @@
   8.341   /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
   8.342      significant byte first (like Motorola and SPARC, unlike Intel). */
   8.343   #if defined AC_APPLE_UNIVERSAL_BUILD
   8.344 -diff -u libmodplug-0.8.9.0/src/fastmix.cpp~ libmodplug-0.8.9.0/src/fastmix.cpp
   8.345 ---- libmodplug-0.8.9.0/src/fastmix.cpp~
   8.346 -+++ libmodplug-0.8.9.0/src/fastmix.cpp
   8.347 +diff --git a/src/fastmix.cpp b/src/fastmix.cpp
   8.348 +index d693d20..7aad373 100644
   8.349 +--- a/src/fastmix.cpp
   8.350 ++++ b/src/fastmix.cpp
   8.351  @@ -9,7 +9,7 @@
   8.352   #include "sndfile.h"
   8.353   #include <math.h>
   8.354 @@ -503,7 +388,32 @@
   8.355   #pragma bss_seg()
   8.356   #endif
   8.357   
   8.358 -@@ -1611,7 +1611,7 @@ UINT CSoundFile::CreateStereoMix(int cou
   8.359 +@@ -287,8 +287,14 @@ CzWINDOWEDFIR sfir;
   8.360 + // ----------------------------------------------------------------------------
   8.361 + // MIXING MACROS
   8.362 + // ----------------------------------------------------------------------------
   8.363 ++#if defined(__cplusplus) && (__cplusplus >= 201402L)
   8.364 ++#define REGISTER
   8.365 ++#else
   8.366 ++#define REGISTER register
   8.367 ++#endif
   8.368 ++
   8.369 + #define SNDMIX_BEGINSAMPLELOOP8\
   8.370 +-	register MODCHANNEL * const pChn = pChannel;\
   8.371 ++	REGISTER MODCHANNEL * const pChn = pChannel;\
   8.372 + 	nPos = pChn->nPosLo;\
   8.373 + 	const signed char *p = (signed char *)(pChn->pCurrentSample+pChn->nPos);\
   8.374 + 	if (pChn->dwFlags & CHN_STEREO) p += pChn->nPos;\
   8.375 +@@ -296,7 +302,7 @@ CzWINDOWEDFIR sfir;
   8.376 + 	do {
   8.377 + 
   8.378 + #define SNDMIX_BEGINSAMPLELOOP16\
   8.379 +-	register MODCHANNEL * const pChn = pChannel;\
   8.380 ++	REGISTER MODCHANNEL * const pChn = pChannel;\
   8.381 + 	nPos = pChn->nPosLo;\
   8.382 + 	const signed short *p = (signed short *)(pChn->pCurrentSample+(pChn->nPos*2));\
   8.383 + 	if (pChn->dwFlags & CHN_STEREO) p += pChn->nPos;\
   8.384 +@@ -1611,7 +1617,7 @@ UINT CSoundFile::CreateStereoMix(int count)
   8.385   #endif
   8.386   
   8.387   // Clip and convert to 8 bit
   8.388 @@ -512,7 +422,7 @@
   8.389   __declspec(naked) DWORD MPPASMCALL X86_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
   8.390   //------------------------------------------------------------------------------
   8.391   {
   8.392 -@@ -1701,7 +1701,7 @@ DWORD MPPASMCALL X86_Convert32To8(LPVOID
   8.393 +@@ -1701,7 +1707,7 @@ DWORD MPPASMCALL X86_Convert32To8(LPVOID lp8, int *pBuffer, DWORD lSampleCount,
   8.394   #endif //MSC_VER, else
   8.395   
   8.396   
   8.397 @@ -521,7 +431,7 @@
   8.398   // Clip and convert to 16 bit
   8.399   __declspec(naked) DWORD MPPASMCALL X86_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
   8.400   //------------------------------------------------------------------------------
   8.401 -@@ -1794,7 +1794,7 @@ DWORD MPPASMCALL X86_Convert32To16(LPVOI
   8.402 +@@ -1794,7 +1800,7 @@ DWORD MPPASMCALL X86_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount
   8.403   }
   8.404   #endif //MSC_VER, else
   8.405   
   8.406 @@ -530,7 +440,7 @@
   8.407   // Clip and convert to 24 bit
   8.408   __declspec(naked) DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
   8.409   //------------------------------------------------------------------------------
   8.410 -@@ -1902,7 +1902,7 @@ DWORD MPPASMCALL X86_Convert32To24(LPVOI
   8.411 +@@ -1902,7 +1908,7 @@ DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount
   8.412   }
   8.413   #endif
   8.414   
   8.415 @@ -539,7 +449,7 @@
   8.416   // Clip and convert to 32 bit
   8.417   __declspec(naked) DWORD MPPASMCALL X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
   8.418   //------------------------------------------------------------------------------
   8.419 -@@ -1992,7 +1992,7 @@ DWORD MPPASMCALL X86_Convert32To32(LPVOI
   8.420 +@@ -1992,7 +1998,7 @@ DWORD MPPASMCALL X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount
   8.421   #endif
   8.422   
   8.423   
   8.424 @@ -548,7 +458,7 @@
   8.425   void MPPASMCALL X86_InitMixBuffer(int *pBuffer, UINT nSamples)
   8.426   //------------------------------------------------------------
   8.427   {
   8.428 -@@ -2034,7 +2034,7 @@ void MPPASMCALL X86_InitMixBuffer(int *p
   8.429 +@@ -2034,7 +2040,7 @@ void MPPASMCALL X86_InitMixBuffer(int *pBuffer, UINT nSamples)
   8.430   #endif
   8.431   
   8.432   
   8.433 @@ -557,7 +467,7 @@
   8.434   __declspec(naked) void MPPASMCALL X86_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nSamples)
   8.435   //------------------------------------------------------------------------------
   8.436   {
   8.437 -@@ -2079,7 +2079,7 @@ void MPPASMCALL X86_InterleaveFrontRear(
   8.438 +@@ -2079,7 +2085,7 @@ void MPPASMCALL X86_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nSa
   8.439   #endif
   8.440   
   8.441   
   8.442 @@ -566,7 +476,7 @@
   8.443   VOID MPPASMCALL X86_MonoFromStereo(int *pMixBuf, UINT nSamples)
   8.444   //-------------------------------------------------------------
   8.445   {
   8.446 -@@ -2116,7 +2116,7 @@ VOID MPPASMCALL X86_MonoFromStereo(int *
   8.447 +@@ -2116,7 +2122,7 @@ VOID MPPASMCALL X86_MonoFromStereo(int *pMixBuf, UINT nSamples)
   8.448   #define OFSDECAYMASK	0xFF
   8.449   
   8.450   
   8.451 @@ -575,7 +485,7 @@
   8.452   void MPPASMCALL X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs)
   8.453   //------------------------------------------------------------------------------
   8.454   {
   8.455 -@@ -2217,7 +2217,7 @@ void MPPASMCALL X86_StereoFill(int *pBuf
   8.456 +@@ -2217,7 +2223,7 @@ void MPPASMCALL X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLON
   8.457   }
   8.458   #endif
   8.459   
   8.460 @@ -584,7 +494,7 @@
   8.461   void MPPASMCALL X86_EndChannelOfs(MODCHANNEL *pChannel, int *pBuffer, UINT nSamples)
   8.462   //------------------------------------------------------------------------------
   8.463   {
   8.464 -@@ -2291,7 +2291,7 @@ void MPPASMCALL X86_EndChannelOfs(MODCHA
   8.465 +@@ -2291,7 +2297,7 @@ void MPPASMCALL X86_EndChannelOfs(MODCHANNEL *pChannel, int *pBuffer, UINT nSamp
   8.466   #define MIXING_LIMITMAX		(0x08100000)
   8.467   #define MIXING_LIMITMIN		(-MIXING_LIMITMAX)
   8.468   
   8.469 @@ -593,7 +503,7 @@
   8.470   __declspec(naked) UINT MPPASMCALL X86_AGC(int *pBuffer, UINT nSamples, UINT nAGC)
   8.471   //------------------------------------------------------------------------------
   8.472   {
   8.473 -@@ -2327,7 +2327,6 @@ agcupdate:
   8.474 +@@ -2327,7 +2333,6 @@ agcupdate:
   8.475   	jmp agcrecover
   8.476   	}
   8.477   }
   8.478 @@ -601,7 +511,7 @@
   8.479   #pragma warning (default:4100)
   8.480   #else
   8.481   // Version for GCC
   8.482 -@@ -2378,11 +2377,9 @@ void CSoundFile::ProcessAGC(int count)
   8.483 +@@ -2378,11 +2383,9 @@ void CSoundFile::ProcessAGC(int count)
   8.484   }
   8.485   
   8.486   
   8.487 @@ -613,9 +523,10 @@
   8.488   }
   8.489  -
   8.490   #endif // NO_AGC
   8.491 -diff -u libmodplug-0.8.9.0/src/libmodplug/it_defs.h~ libmodplug-0.8.9.0/src/libmodplug/it_defs.h
   8.492 ---- libmodplug-0.8.9.0/src/libmodplug/it_defs.h~
   8.493 -+++ libmodplug-0.8.9.0/src/libmodplug/it_defs.h
   8.494 +diff --git a/src/libmodplug/it_defs.h b/src/libmodplug/it_defs.h
   8.495 +index 89cb456..43fb944 100644
   8.496 +--- a/src/libmodplug/it_defs.h
   8.497 ++++ b/src/libmodplug/it_defs.h
   8.498  @@ -128,7 +128,9 @@ typedef struct ITSAMPLESTRUCT
   8.499   
   8.500   #pragma pack()
   8.501 @@ -628,9 +539,10 @@
   8.502  +#endif
   8.503   
   8.504   #endif
   8.505 -diff -u libmodplug-0.8.9.0/src/libmodplug/sndfile.h~ libmodplug-0.8.9.0/src/libmodplug/sndfile.h
   8.506 ---- libmodplug-0.8.9.0/src/libmodplug/sndfile.h~
   8.507 -+++ libmodplug-0.8.9.0/src/libmodplug/sndfile.h
   8.508 +diff --git a/src/libmodplug/sndfile.h b/src/libmodplug/sndfile.h
   8.509 +index c009265..a638d2d 100644
   8.510 +--- a/src/libmodplug/sndfile.h
   8.511 ++++ b/src/libmodplug/sndfile.h
   8.512  @@ -43,7 +43,6 @@ typedef const BYTE * LPCBYTE;
   8.513   #define MAX_EQ_BANDS		6
   8.514   #define MAX_MIXPLUGINS		8
   8.515 @@ -877,10 +789,11 @@
   8.516   // Byte swapping functions from the GNU C Library and libsdl
   8.517   
   8.518   /* Swap bytes in 16 bit value.  */
   8.519 -diff -u libmodplug-0.8.9.0/src/libmodplug/stdafx.h~ libmodplug-0.8.9.0/src/libmodplug/stdafx.h
   8.520 ---- libmodplug-0.8.9.0/src/libmodplug/stdafx.h~
   8.521 -+++ libmodplug-0.8.9.0/src/libmodplug/stdafx.h
   8.522 -@@ -23,11 +23,11 @@
   8.523 +diff --git a/src/libmodplug/stdafx.h b/src/libmodplug/stdafx.h
   8.524 +index d45d949..219bc7d 100644
   8.525 +--- a/src/libmodplug/stdafx.h
   8.526 ++++ b/src/libmodplug/stdafx.h
   8.527 +@@ -23,35 +23,43 @@
   8.528   
   8.529   /* disable AGC and FILESAVE for all targets for uniformity. */
   8.530   #define NO_AGC
   8.531 @@ -894,8 +807,12 @@
   8.532   #pragma warning (disable:4201)
   8.533   #pragma warning (disable:4514)
   8.534   #endif
   8.535 -@@ -38,7 +38,16 @@
   8.536 - #include <mmsystem.h>
   8.537 + 
   8.538 + #define WIN32_LEAN_AND_MEAN
   8.539 + #include <windows.h>
   8.540 +-#include <windowsx.h>
   8.541 +-#include <mmsystem.h>
   8.542 ++#include <mmsystem.h> /* for WAVE_FORMAT_PCM */
   8.543   #include <stdio.h>
   8.544   #include <malloc.h>
   8.545  +#if defined(_MSC_VER) && (_MSC_VER < 1600)
   8.546 @@ -909,9 +826,16 @@
   8.547   #include <stdint.h>
   8.548  +#endif
   8.549   
   8.550 - #define srandom(_seed)  srand(_seed)
   8.551 - #define random()        rand()
   8.552 -@@ -51,7 +60,9 @@ inline void ProcessPlugins(int n) {}
   8.553 +-#define srandom(_seed)  srand(_seed)
   8.554 +-#define random()        rand()
   8.555 +-#define sleep(_ms)      Sleep(_ms)
   8.556 ++#define sleep(_ms)      Sleep(_ms * 1000)
   8.557 + 
   8.558 +-inline void ProcessPlugins(int n) {}
   8.559 ++inline void ProcessPlugins(int n) { (void)n; }
   8.560 + 
   8.561 + #undef strcasecmp
   8.562 + #undef strncasecmp
   8.563   #define strcasecmp(a,b)     _stricmp(a,b)
   8.564   #define strncasecmp(a,b,c)  _strnicmp(a,b,c)
   8.565   
   8.566 @@ -921,19 +845,16 @@
   8.567   
   8.568   #ifndef isblank
   8.569   #define isblank(c) ((c) == ' ' || (c) == '\t')
   8.570 -@@ -66,6 +77,11 @@ inline void ProcessPlugins(int n) {}
   8.571 - #include <malloc.h>
   8.572 - #endif
   8.573 - 
   8.574 -+#ifdef __WATCOMC__
   8.575 -+#define srandom(_seed)  srand(_seed)
   8.576 -+#define random()        rand()
   8.577 -+#endif
   8.578 -+
   8.579 - typedef int8_t CHAR;
   8.580 - typedef uint8_t UCHAR;
   8.581 - typedef uint8_t* PUCHAR;
   8.582 -@@ -88,12 +104,6 @@ typedef const char* LPCSTR;
   8.583 +@@ -80,7 +88,7 @@ typedef uint32_t* LPDWORD;
   8.584 + typedef uint16_t WORD;
   8.585 + typedef uint8_t BYTE;
   8.586 + typedef uint8_t* LPBYTE;
   8.587 +-typedef bool BOOL;
   8.588 ++typedef bool BOOL; /* FIXME: must be 'int' */
   8.589 + typedef char* LPSTR;
   8.590 + typedef void* LPVOID;
   8.591 + typedef uint16_t* LPWORD;
   8.592 +@@ -88,12 +96,6 @@ typedef const char* LPCSTR;
   8.593   typedef void* PVOID;
   8.594   typedef void VOID;
   8.595   
   8.596 @@ -946,7 +867,26 @@
   8.597   #define LPCTSTR LPCSTR
   8.598   #define lstrcpyn strncpy
   8.599   #define lstrcpy strcpy
   8.600 -@@ -132,10 +142,22 @@ inline void ProcessPlugins(int n) {}
   8.601 +@@ -102,17 +104,7 @@ inline LONG MulDiv (long a, long b, long c)
   8.602 + 
   8.603 + #define WAVE_FORMAT_PCM 1
   8.604 + 
   8.605 +-#define  GHND   0
   8.606 +-#define GlobalFreePtr(p) free((void *)(p))
   8.607 +-inline int8_t * GlobalAllocPtr(unsigned int, size_t size)
   8.608 +-{
   8.609 +-  int8_t * p = (int8_t *) malloc(size);
   8.610 +-
   8.611 +-  if (p != NULL) memset(p, 0, size);
   8.612 +-  return p;
   8.613 +-}
   8.614 +-
   8.615 +-inline void ProcessPlugins(int n) {}
   8.616 ++inline void ProcessPlugins(int n) { (void)n; }
   8.617 + 
   8.618 + #ifndef FALSE
   8.619 + #define FALSE	false
   8.620 +@@ -132,10 +124,22 @@ inline void ProcessPlugins(int n) {}
   8.621   # else
   8.622   #   define MODPLUG_EXPORT __declspec(dllimport)			/* using libmodplug dll for windows */
   8.623   # endif
   8.624 @@ -969,9 +909,10 @@
   8.625  +#endif
   8.626  +
   8.627   #endif
   8.628 -diff -u libmodplug-0.8.9.0/src/load_669.cpp~ libmodplug-0.8.9.0/src/load_669.cpp
   8.629 ---- libmodplug-0.8.9.0/src/load_669.cpp~
   8.630 -+++ libmodplug-0.8.9.0/src/load_669.cpp
   8.631 +diff --git a/src/load_669.cpp b/src/load_669.cpp
   8.632 +index c275615..236e07d 100644
   8.633 +--- a/src/load_669.cpp
   8.634 ++++ b/src/load_669.cpp
   8.635  @@ -17,7 +17,7 @@
   8.636   typedef struct tagFILEHEADER669
   8.637   {
   8.638 @@ -998,7 +939,7 @@
   8.639   	DWORD len = (length[3] << 24) +
   8.640   		(length[2] << 16) +
   8.641   		(length[1] << 8) +
   8.642 -@@ -156,9 +155,9 @@ BOOL CSoundFile::Read669(const BYTE *lpS
   8.643 +@@ -156,9 +155,9 @@ BOOL CSoundFile::Read669(const BYTE *lpStream, DWORD dwMemLength)
   8.644   					case 0x04:	command = CMD_VIBRATO; param |= 0x40; break;
   8.645   					case 0x05:	if (param) command = CMD_SPEED; else command = 0; param += 2; break;
   8.646   					case 0x06:	if (param == 0) { command = CMD_PANNINGSLIDE; param = 0xFE; }
   8.647 @@ -1011,10 +952,19 @@
   8.648   					default:	command = 0;
   8.649   					}
   8.650   					if (command)
   8.651 -diff -u libmodplug-0.8.9.0/src/load_abc.cpp~ libmodplug-0.8.9.0/src/load_abc.cpp
   8.652 ---- libmodplug-0.8.9.0/src/load_abc.cpp~
   8.653 -+++ libmodplug-0.8.9.0/src/load_abc.cpp
   8.654 -@@ -37,9 +37,19 @@
   8.655 +diff --git a/src/load_abc.cpp b/src/load_abc.cpp
   8.656 +index ee79f39..fe5e74c 100644
   8.657 +--- a/src/load_abc.cpp
   8.658 ++++ b/src/load_abc.cpp
   8.659 +@@ -31,15 +31,25 @@
   8.660 + #include <math.h>
   8.661 + #include <ctype.h>
   8.662 + #ifndef _WIN32
   8.663 +-#include <unistd.h> // for sleep
   8.664 +-#endif // _WIN32
   8.665 ++#include <unistd.h>  /* sleep() */
   8.666 ++#endif
   8.667 + 
   8.668   #include "stdafx.h"
   8.669   #include "sndfile.h"
   8.670   
   8.671 @@ -1035,7 +985,7 @@
   8.672   #define putenv _putenv
   8.673   #define strdup _strdup
   8.674   #endif
   8.675 -@@ -256,16 +266,6 @@ static void abc_add_setjumploop(ABCHANDL
   8.676 +@@ -256,16 +266,6 @@ static void abc_add_setjumploop(ABCHANDLE *h, ABCTRACK *tp, uint32_t tracktime,
   8.677   static uint32_t abc_pattracktime(ABCHANDLE *h, uint32_t tracktime);
   8.678   static int abc_patno(ABCHANDLE *h, uint32_t tracktime);
   8.679   
   8.680 @@ -1052,7 +1002,7 @@
   8.681   
   8.682   static int abc_isvalidchar(char c) {
   8.683   	return(isalpha(c) || isdigit(c) || isspace(c) || c == '%' || c == ':');
   8.684 -@@ -403,7 +403,7 @@ static void abc_dumptracks(ABCHANDLE *h,
   8.685 +@@ -403,7 +403,7 @@ static void abc_dumptracks(ABCHANDLE *h, const char *p)
   8.686   	}
   8.687   }
   8.688   
   8.689 @@ -1061,7 +1011,7 @@
   8.690   #undef _mm_free
   8.691   #endif
   8.692   
   8.693 -@@ -1484,7 +1484,7 @@ static void	abc_add_chord(const char *p,
   8.694 +@@ -1484,7 +1484,7 @@ static void	abc_add_chord(const char *p, ABCHANDLE *h, ABCTRACK *tp, uint32_t tr
   8.695   			d[chordnote] = i;
   8.696   			break;
   8.697   		}
   8.698 @@ -1070,7 +1020,7 @@
   8.699   	switch(*p) {
   8.700   		case 'b':
   8.701   			d[chordnote]--;
   8.702 -@@ -1506,7 +1506,7 @@ static void	abc_add_chord(const char *p,
   8.703 +@@ -1506,7 +1506,7 @@ static void	abc_add_chord(const char *p, ABCHANDLE *h, ABCTRACK *tp, uint32_t tr
   8.704   				d[chordbase] = i;
   8.705   				break;
   8.706   			}
   8.707 @@ -1079,7 +1029,7 @@
   8.708   		switch(*p) {
   8.709   			case 'b':
   8.710   				d[chordbase]--;
   8.711 -@@ -2345,9 +2345,9 @@ BOOL CSoundFile::TestABC(const BYTE *lpS
   8.712 +@@ -2345,9 +2345,9 @@ BOOL CSoundFile::TestABC(const BYTE *lpStream, DWORD dwMemLength)
   8.713   // =====================================================================================
   8.714   static ABCHANDLE *ABC_Init(void)
   8.715   {
   8.716 @@ -1101,8 +1051,10 @@
   8.717   		}
   8.718   	}
   8.719   	else {
   8.720 - 		srandom((uint32_t)time(0));	// initialize random generator with seed
   8.721 - 		retval->pickrandom = 1+(int)(10000.0*random()/(RAND_MAX+1.0));
   8.722 +-		srandom((uint32_t)time(0));	// initialize random generator with seed
   8.723 +-		retval->pickrandom = 1+(int)(10000.0*random()/(RAND_MAX+1.0));
   8.724 ++		srand((unsigned int)time(0));	// initialize random generator with seed
   8.725 ++		retval->pickrandom = 1+(int)(10000.0*rand()/(RAND_MAX+1.0));
   8.726   		// can handle pickin' from songbooks with 10.000 songs
   8.727  -		sprintf(buf,"-%ld",retval->pickrandom); // xmms preloads the file
   8.728  -		setenv(ABC_ENV_NORANDOMPICK, buf, 1);
   8.729 @@ -1111,7 +1063,7 @@
   8.730   	}
   8.731   	return retval;
   8.732   }
   8.733 -@@ -2643,10 +2643,11 @@ static int ABC_ReadPatterns(MODCOMMAND *
   8.734 +@@ -2643,10 +2643,11 @@ static int ABC_ReadPatterns(MODCOMMAND *pattern[], WORD psize[], ABCHANDLE *h, i
   8.735   static int ABC_Key(const char *p)
   8.736   {
   8.737   	int i,j;
   8.738 @@ -1124,7 +1076,7 @@
   8.739   	for( i=0; i<8 && *p && *p != ']'; p++ ) {
   8.740   		if( isspace(*p) ) {
   8.741   			while( isspace(*p) ) p++;
   8.742 -@@ -2939,9 +2940,10 @@ static void abc_MIDI_voice(const char *p
   8.743 +@@ -2939,9 +2940,10 @@ static void abc_MIDI_voice(const char *p, ABCTRACK *tp, ABCHANDLE *h)
   8.744   static void abc_MIDI_chordname(const char *p)
   8.745   {
   8.746   	char name[20];
   8.747 @@ -1137,7 +1089,7 @@
   8.748   	i = 0;
   8.749   	while ((i < 19) && (*p != ' ') && (*p != '\0')) {
   8.750   		name[i] = *p;
   8.751 -@@ -2953,9 +2955,12 @@ static void abc_MIDI_chordname(const cha
   8.752 +@@ -2953,9 +2955,12 @@ static void abc_MIDI_chordname(const char *p)
   8.753   		abc_message("Failure: Bad format for chordname command, %s", p);
   8.754   	}
   8.755   	else {
   8.756 @@ -1151,14 +1103,15 @@
   8.757   			p += abc_getnumber(p, &notes[i]);
   8.758   			i = i + 1;
   8.759   		}
   8.760 -@@ -4878,3 +4883,4 @@ BOOL CSoundFile::ReadABC(const uint8_t *
   8.761 +@@ -4878,3 +4883,4 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
   8.762   	ABC_Cleanup(h);	// we dont need it anymore
   8.763   	return 1;
   8.764   }
   8.765  +#endif // MIDIFMT_SUPPORT
   8.766 -diff -u libmodplug-0.8.9.0/src/load_amf.cpp~ libmodplug-0.8.9.0/src/load_amf.cpp
   8.767 ---- libmodplug-0.8.9.0/src/load_amf.cpp~
   8.768 -+++ libmodplug-0.8.9.0/src/load_amf.cpp
   8.769 +diff --git a/src/load_amf.cpp b/src/load_amf.cpp
   8.770 +index c560a29..82ea867 100644
   8.771 +--- a/src/load_amf.cpp
   8.772 ++++ b/src/load_amf.cpp
   8.773  @@ -44,7 +44,6 @@ typedef struct _AMFSAMPLE
   8.774   	UCHAR volume;
   8.775   } AMFSAMPLE;
   8.776 @@ -1176,7 +1129,7 @@
   8.777   //-------------------------------------------------------------------------------
   8.778   {
   8.779   	UINT lastinstr = 0;
   8.780 -@@ -163,7 +162,6 @@ VOID AMF_Unpack(MODCOMMAND *pPat, const 
   8.781 +@@ -163,7 +162,6 @@ VOID AMF_Unpack(MODCOMMAND *pPat, const BYTE *pTrack, UINT nRows, UINT nChannels
   8.782   }
   8.783   
   8.784   
   8.785 @@ -1184,10 +1137,11 @@
   8.786   BOOL CSoundFile::ReadAMF(LPCBYTE lpStream, const DWORD dwMemLength)
   8.787   //-----------------------------------------------------------
   8.788   {
   8.789 -diff -u libmodplug-0.8.9.0/src/load_dbm.cpp~ libmodplug-0.8.9.0/src/load_dbm.cpp
   8.790 ---- libmodplug-0.8.9.0/src/load_dbm.cpp~
   8.791 -+++ libmodplug-0.8.9.0/src/load_dbm.cpp
   8.792 -@@ -249,7 +249,7 @@ BOOL CSoundFile::ReadDBM(const BYTE *lpS
   8.793 +diff --git a/src/load_dbm.cpp b/src/load_dbm.cpp
   8.794 +index 9aff94b..8bc9c9b 100644
   8.795 +--- a/src/load_dbm.cpp
   8.796 ++++ b/src/load_dbm.cpp
   8.797 +@@ -249,7 +249,7 @@ BOOL CSoundFile::ReadDBM(const BYTE *lpStream, DWORD dwMemLength)
   8.798   					MODCOMMAND *m = AllocatePattern(nRows, m_nChannels);
   8.799   					if (m)
   8.800   					{
   8.801 @@ -1196,15 +1150,16 @@
   8.802   						UINT row = 0;
   8.803   						UINT i = 0;
   8.804   
   8.805 -@@ -365,4 +365,3 @@ BOOL CSoundFile::ReadDBM(const BYTE *lpS
   8.806 +@@ -365,4 +365,3 @@ BOOL CSoundFile::ReadDBM(const BYTE *lpStream, DWORD dwMemLength)
   8.807   	}
   8.808   	return TRUE;
   8.809   }
   8.810  -
   8.811 -diff -u libmodplug-0.8.9.0/src/load_dmf.cpp~ libmodplug-0.8.9.0/src/load_dmf.cpp
   8.812 ---- libmodplug-0.8.9.0/src/load_dmf.cpp~
   8.813 -+++ libmodplug-0.8.9.0/src/load_dmf.cpp
   8.814 -@@ -279,7 +279,8 @@ BOOL CSoundFile::ReadDMF(const BYTE *lpS
   8.815 +diff --git a/src/load_dmf.cpp b/src/load_dmf.cpp
   8.816 +index 7bfca22..1d4f8a7 100644
   8.817 +--- a/src/load_dmf.cpp
   8.818 ++++ b/src/load_dmf.cpp
   8.819 +@@ -279,7 +279,8 @@ BOOL CSoundFile::ReadDMF(const BYTE *lpStream, DWORD dwMemLength)
   8.820   								case 8: cmd.command = CMD_VIBRATO; cmd.param = eval; break;
   8.821   								// 12: Note cut
   8.822   								case 12: if (eval & 0xe0) { cmd.command = CMD_S3MCMDEX; cmd.param = (eval>>5)|0xc0; }
   8.823 @@ -1223,7 +1178,7 @@
   8.824   //-------------------------------------------
   8.825   {
   8.826   	BYTE x = 0, bitv = 1;
   8.827 -@@ -534,7 +535,7 @@ BYTE DMFReadBits(DMF_HTREE *tree, UINT n
   8.828 +@@ -534,7 +535,7 @@ BYTE DMFReadBits(DMF_HTREE *tree, UINT nbits)
   8.829   // tree: [8-bit value][12-bit index][12-bit index] = 32-bit
   8.830   //
   8.831   
   8.832 @@ -1232,9 +1187,10 @@
   8.833   //------------------------------
   8.834   {
   8.835   	BYTE isleft, isright;
   8.836 -diff -u libmodplug-0.8.9.0/src/load_it.cpp~ libmodplug-0.8.9.0/src/load_it.cpp
   8.837 ---- libmodplug-0.8.9.0/src/load_it.cpp~
   8.838 -+++ libmodplug-0.8.9.0/src/load_it.cpp
   8.839 +diff --git a/src/load_it.cpp b/src/load_it.cpp
   8.840 +index 4c6a4e1..32be603 100644
   8.841 +--- a/src/load_it.cpp
   8.842 ++++ b/src/load_it.cpp
   8.843  @@ -15,26 +15,13 @@
   8.844   #pragma warning(disable:4244)
   8.845   #endif
   8.846 @@ -1263,7 +1219,7 @@
   8.847   BOOL CSoundFile::ITInstrToMPT(const void *p, INSTRUMENTHEADER *penv, UINT trkvers)
   8.848   //--------------------------------------------------------------------------------
   8.849   {
   8.850 -@@ -165,6 +152,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpSt
   8.851 +@@ -165,6 +152,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
   8.852   	DWORD patpos[MAX_PATTERNS];
   8.853   	BYTE chnmask[64], channels_used[64];
   8.854   	MODCOMMAND lastvalue[64];
   8.855 @@ -1271,7 +1227,7 @@
   8.856   
   8.857   	if ((!lpStream) || (dwMemLength < sizeof(ITFILEHEADER))) return FALSE;
   8.858   	ITFILEHEADER pifh = *(ITFILEHEADER *)lpStream;
   8.859 -@@ -237,7 +225,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpSt
   8.860 +@@ -237,7 +225,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
   8.861   	if (inspossize > MAX_INSTRUMENTS) inspossize = MAX_INSTRUMENTS;
   8.862   	inspossize <<= 2;
   8.863   	memcpy(inspos, lpStream+dwMemPos, inspossize);
   8.864 @@ -1280,7 +1236,7 @@
   8.865   	{
   8.866   	       inspos[j] = bswapLE32(inspos[j]);
   8.867   	}
   8.868 -@@ -248,7 +236,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpSt
   8.869 +@@ -248,7 +236,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
   8.870   	if (smppossize > MAX_SAMPLES) smppossize = MAX_SAMPLES;
   8.871   	smppossize <<= 2;
   8.872   	memcpy(smppos, lpStream+dwMemPos, smppossize);
   8.873 @@ -1289,7 +1245,7 @@
   8.874   	{
   8.875   	       smppos[j] = bswapLE32(smppos[j]);
   8.876   	}
   8.877 -@@ -259,7 +247,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpSt
   8.878 +@@ -259,7 +247,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
   8.879   	if (patpossize > MAX_PATTERNS) patpossize = MAX_PATTERNS;
   8.880   	patpossize <<= 2;
   8.881   	memcpy(patpos, lpStream+dwMemPos, patpossize);
   8.882 @@ -1298,7 +1254,7 @@
   8.883   	{
   8.884   	       patpos[j] = bswapLE32(patpos[j]);
   8.885   	}
   8.886 -@@ -592,593 +580,6 @@ BOOL CSoundFile::ReadIT(const BYTE *lpSt
   8.887 +@@ -592,593 +580,6 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
   8.888   }
   8.889   
   8.890   
   8.891 @@ -1892,10 +1848,31 @@
   8.892   //////////////////////////////////////////////////////////////////////////////
   8.893   // IT 2.14 compression
   8.894   
   8.895 -Only in libmodplug-0.8.9.0/src: load_j2b.cpp
   8.896 -diff -u libmodplug-0.8.9.0/src/load_mdl.cpp~ libmodplug-0.8.9.0/src/load_mdl.cpp
   8.897 ---- libmodplug-0.8.9.0/src/load_mdl.cpp~
   8.898 -+++ libmodplug-0.8.9.0/src/load_mdl.cpp
   8.899 +diff --git a/src/load_j2b.cpp b/src/load_j2b.cpp
   8.900 +deleted file mode 100644
   8.901 +index 2d86ce8..0000000
   8.902 +--- a/src/load_j2b.cpp
   8.903 ++++ /dev/null
   8.904 +@@ -1,15 +0,0 @@
   8.905 +-/*
   8.906 +- * This source code is public domain.
   8.907 +- *
   8.908 +- * Authors: Olivier Lapicque <olivierl@jps.net>
   8.909 +-*/
   8.910 +-
   8.911 +-
   8.912 +-///////////////////////////////////////////////////
   8.913 +-//
   8.914 +-// J2B module loader
   8.915 +-//
   8.916 +-///////////////////////////////////////////////////
   8.917 +-#include "stdafx.h"
   8.918 +-#include "sndfile.h"
   8.919 +-
   8.920 +diff --git a/src/load_mdl.cpp b/src/load_mdl.cpp
   8.921 +index 8f2724f..177f322 100644
   8.922 +--- a/src/load_mdl.cpp
   8.923 ++++ b/src/load_mdl.cpp
   8.924  @@ -42,7 +42,7 @@ typedef struct MDLPATTERNDATA
   8.925   } MDLPATTERNDATA;
   8.926   
   8.927 @@ -1905,7 +1882,7 @@
   8.928   //--------------------------------------------------------
   8.929   {
   8.930   	UINT command = 0, param = data;
   8.931 -@@ -91,7 +91,7 @@ void ConvertMDLCommand(MODCOMMAND *m, UI
   8.932 +@@ -91,7 +91,7 @@ void ConvertMDLCommand(MODCOMMAND *m, UINT eff, UINT data)
   8.933   }
   8.934   
   8.935   
   8.936 @@ -1914,7 +1891,7 @@
   8.937   //-------------------------------------------------------------------------------------------------
   8.938   {
   8.939   	MODCOMMAND cmd, *m = pat;
   8.940 -@@ -168,7 +168,6 @@ void UnpackMDLTrack(MODCOMMAND *pat, UIN
   8.941 +@@ -168,7 +168,6 @@ void UnpackMDLTrack(MODCOMMAND *pat, UINT nChannels, UINT nRows, UINT nTrack, co
   8.942   }
   8.943   
   8.944   
   8.945 @@ -1922,10 +1899,11 @@
   8.946   BOOL CSoundFile::ReadMDL(const BYTE *lpStream, DWORD dwMemLength)
   8.947   //---------------------------------------------------------------
   8.948   {
   8.949 -diff -u libmodplug-0.8.9.0/src/load_med.cpp~ libmodplug-0.8.9.0/src/load_med.cpp
   8.950 ---- libmodplug-0.8.9.0/src/load_med.cpp~
   8.951 -+++ libmodplug-0.8.9.0/src/load_med.cpp
   8.952 -@@ -876,7 +876,7 @@ BOOL CSoundFile::ReadMed(const BYTE *lpS
   8.953 +diff --git a/src/load_med.cpp b/src/load_med.cpp
   8.954 +index 745e2c6..614674e 100644
   8.955 +--- a/src/load_med.cpp
   8.956 ++++ b/src/load_med.cpp
   8.957 +@@ -876,7 +876,7 @@ BOOL CSoundFile::ReadMed(const BYTE *lpStream, DWORD dwMemLength)
   8.958   				{
   8.959   					DWORD nameofs = bswapBE32(pbi->blockname);
   8.960   					UINT namelen = bswapBE32(pbi->blocknamelen);
   8.961 @@ -1934,10 +1912,17 @@
   8.962   					{
   8.963   						SetPatternName(iBlk, (LPCSTR)(lpStream+nameofs));
   8.964   					}
   8.965 -diff -u libmodplug-0.8.9.0/src/load_mid.cpp~ libmodplug-0.8.9.0/src/load_mid.cpp
   8.966 ---- libmodplug-0.8.9.0/src/load_mid.cpp~
   8.967 -+++ libmodplug-0.8.9.0/src/load_mid.cpp
   8.968 -@@ -35,6 +35,17 @@
   8.969 +diff --git a/src/load_mid.cpp b/src/load_mid.cpp
   8.970 +index 5992fa6..734a247 100644
   8.971 +--- a/src/load_mid.cpp
   8.972 ++++ b/src/load_mid.cpp
   8.973 +@@ -30,11 +30,22 @@
   8.974 + #include <math.h>
   8.975 + #include <ctype.h>
   8.976 + #ifndef _WIN32
   8.977 +-#include <unistd.h> // for sleep
   8.978 ++#include <unistd.h> /* sleep() */
   8.979 + #endif
   8.980   
   8.981   #include "stdafx.h"
   8.982   #include "sndfile.h"
   8.983 @@ -1969,13 +1954,12 @@
   8.984   #define _mm_fseek(f,pos,whence)			fseek(f,pos,whence)
   8.985   #define _mm_read_UBYTES(buf,sz,f)		fread(buf,sz,1,f)
   8.986   #define _mm_read_SBYTES(buf,sz,f)		fread(buf,sz,1,f)
   8.987 -@@ -256,18 +267,18 @@ static void mid_adjust_for_optimal_tempo
   8.988 +@@ -256,18 +267,18 @@ static void mid_adjust_for_optimal_tempo(MIDHANDLE *h, int maxtempo)
   8.989   static MIDEVENT *mid_new_event(MIDHANDLE *h)
   8.990   // =====================================================================================
   8.991   {
   8.992  -    MIDEVENT   *retval;
   8.993 -+	MIDEVENT   *retval;
   8.994 - 
   8.995 +-
   8.996  -    retval = (MIDEVENT *)_mm_calloc(h->trackhandle, 1,sizeof(MIDEVENT));
   8.997  -		retval->next      = NULL;
   8.998  -    retval->tracktick = h->tracktime;
   8.999 @@ -1986,6 +1970,8 @@
  8.1000  -		retval->fx        = none;
  8.1001  -		retval->fxparam   = 0;
  8.1002  -    return retval;
  8.1003 ++	MIDEVENT   *retval;
  8.1004 ++
  8.1005  +	retval = (MIDEVENT *)_mm_calloc(h->trackhandle, 1,sizeof(MIDEVENT));
  8.1006  +	retval->next      = NULL;
  8.1007  +	retval->tracktick = h->tracktime;
  8.1008 @@ -1999,15 +1985,16 @@
  8.1009   }
  8.1010   
  8.1011   // =====================================================================================
  8.1012 -@@ -1582,3 +1593,4 @@ BOOL CSoundFile::ReadMID(const BYTE *lpS
  8.1013 +@@ -1582,3 +1593,4 @@ BOOL CSoundFile::ReadMID(const BYTE *lpStream, DWORD dwMemLength)
  8.1014   	avoid_reentry = 0; // it is safe now, I'm finished
  8.1015   	return TRUE;
  8.1016   }
  8.1017  +#endif // MIDIFMT_SUPPORT
  8.1018 -diff -u libmodplug-0.8.9.0/src/load_mod.cpp~ libmodplug-0.8.9.0/src/load_mod.cpp
  8.1019 ---- libmodplug-0.8.9.0/src/load_mod.cpp~
  8.1020 -+++ libmodplug-0.8.9.0/src/load_mod.cpp
  8.1021 -@@ -39,7 +39,9 @@ void CSoundFile::ConvertModCommand(MODCO
  8.1022 +diff --git a/src/load_mod.cpp b/src/load_mod.cpp
  8.1023 +index c8ba8d2..68ee30b 100644
  8.1024 +--- a/src/load_mod.cpp
  8.1025 ++++ b/src/load_mod.cpp
  8.1026 +@@ -39,7 +39,9 @@ void CSoundFile::ConvertModCommand(MODCOMMAND *m) const
  8.1027   	case 0x0D:	command = CMD_PATTERNBREAK; param = ((param >> 4) * 10) + (param & 0x0F); break;
  8.1028   	case 0x0E:	command = CMD_MODCMDEX; break;
  8.1029   	case 0x0F:	command = (param <= (UINT)((m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? 0x1F : 0x20)) ? CMD_SPEED : CMD_TEMPO;
  8.1030 @@ -2018,7 +2005,7 @@
  8.1031   	// Extension for XM extended effects
  8.1032   	case 'G' - 55:	command = CMD_GLOBALVOLUME; break;
  8.1033   	case 'H' - 55:	command = CMD_GLOBALVOLSLIDE; if (param & 0xF0) param &= 0xF0; break;
  8.1034 -@@ -59,95 +61,7 @@ void CSoundFile::ConvertModCommand(MODCO
  8.1035 +@@ -59,95 +61,7 @@ void CSoundFile::ConvertModCommand(MODCOMMAND *m) const
  8.1036   	m->param = param;
  8.1037   }
  8.1038   
  8.1039 @@ -2122,7 +2109,7 @@
  8.1040   #pragma pack()
  8.1041   
  8.1042   static BOOL IsValidName(LPCSTR s, int length, CHAR minChar)
  8.1043 -@@ -184,12 +97,11 @@ static BOOL IsValidName(LPCSTR s, int le
  8.1044 +@@ -184,12 +97,11 @@ static BOOL IsValidName(LPCSTR s, int length, CHAR minChar)
  8.1045   	return TRUE;
  8.1046   }
  8.1047   
  8.1048 @@ -2136,7 +2123,7 @@
  8.1049   BOOL CSoundFile::ReadMod(const BYTE *lpStream, DWORD dwMemLength)
  8.1050   //---------------------------------------------------------------
  8.1051   {
  8.1052 -@@ -386,151 +298,5 @@ BOOL CSoundFile::ReadMod(const BYTE *lpS
  8.1053 +@@ -386,151 +298,5 @@ BOOL CSoundFile::ReadMod(const BYTE *lpStream, DWORD dwMemLength)
  8.1054   			dwErrCheck++;
  8.1055   		}
  8.1056   	}
  8.1057 @@ -2288,17 +2275,19 @@
  8.1058  -#endif
  8.1059  -
  8.1060  -#endif // MODPLUG_NO_FILESAVE
  8.1061 -diff -u libmodplug-0.8.9.0/src/load_pat.cpp~ libmodplug-0.8.9.0/src/load_pat.cpp
  8.1062 ---- libmodplug-0.8.9.0/src/load_pat.cpp~
  8.1063 -+++ libmodplug-0.8.9.0/src/load_pat.cpp
  8.1064 +diff --git a/src/load_pat.cpp b/src/load_pat.cpp
  8.1065 +index adcccc3..9546272 100644
  8.1066 +--- a/src/load_pat.cpp
  8.1067 ++++ b/src/load_pat.cpp
  8.1068  @@ -33,36 +33,47 @@
  8.1069   #include <string.h>
  8.1070   #include <math.h>
  8.1071   #include <ctype.h>
  8.1072 --#ifndef _WIN32
  8.1073 - #include <limits.h> // for PATH_MAX
  8.1074 -+#ifndef _WIN32
  8.1075 - #include <unistd.h> // for sleep
  8.1076 ++#include <limits.h> /* PATH_MAX */
  8.1077 + #ifndef _WIN32
  8.1078 +-#include <limits.h> // for PATH_MAX
  8.1079 +-#include <unistd.h> // for sleep
  8.1080 ++#include <unistd.h>  /* sleep() */
  8.1081   #endif
  8.1082  +
  8.1083  +#include "stdafx.h"
  8.1084 @@ -2356,7 +2345,7 @@
  8.1085   #undef _mm_free
  8.1086   #endif
  8.1087   
  8.1088 -@@ -764,10 +775,7 @@ BOOL CSoundFile::TestPAT(const BYTE *lpS
  8.1089 +@@ -764,10 +775,7 @@ BOOL CSoundFile::TestPAT(const BYTE *lpStream, DWORD dwMemLength)
  8.1090   // =====================================================================================
  8.1091   static PATHANDLE *PAT_Init(void)
  8.1092   {
  8.1093 @@ -2368,14 +2357,15 @@
  8.1094   }
  8.1095   
  8.1096   // =====================================================================================
  8.1097 -@@ -1259,3 +1267,4 @@ BOOL CSoundFile::ReadPAT(const BYTE *lpS
  8.1098 +@@ -1259,3 +1267,4 @@ BOOL CSoundFile::ReadPAT(const BYTE *lpStream, DWORD dwMemLength)
  8.1099   	PAT_Cleanup(h);	// we dont need it anymore
  8.1100   	return 1;
  8.1101   }
  8.1102  +#endif // MIDIFMT_SUPPORT
  8.1103 -diff -u libmodplug-0.8.9.0/src/load_psm.cpp~ libmodplug-0.8.9.0/src/load_psm.cpp
  8.1104 ---- libmodplug-0.8.9.0/src/load_psm.cpp~
  8.1105 -+++ libmodplug-0.8.9.0/src/load_psm.cpp
  8.1106 +diff --git a/src/load_psm.cpp b/src/load_psm.cpp
  8.1107 +index 92c5bf9..d107375 100644
  8.1108 +--- a/src/load_psm.cpp
  8.1109 ++++ b/src/load_psm.cpp
  8.1110  @@ -84,7 +84,9 @@ typedef struct _PSMSAMPLE
  8.1111   	BYTE reserved6[19];
  8.1112   } PSMSAMPLE;
  8.1113 @@ -2396,7 +2386,7 @@
  8.1114   
  8.1115   BOOL CSoundFile::ReadPSM(LPCBYTE lpStream, DWORD dwMemLength)
  8.1116   //-----------------------------------------------------------
  8.1117 -@@ -313,17 +313,17 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStrea
  8.1118 +@@ -313,17 +313,17 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStream, DWORD dwMemLength)
  8.1119   			ch = p[pos++];
  8.1120   			if (ch >= m_nChannels) {
  8.1121   				sp = &dummy;
  8.1122 @@ -2422,7 +2412,7 @@
  8.1123   			if ((flags & 0x40) && (pos+1 < len))
  8.1124   			{
  8.1125   				UINT nins = p[pos++];
  8.1126 -@@ -351,10 +351,10 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStrea
  8.1127 +@@ -351,10 +351,10 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStream, DWORD dwMemLength)
  8.1128   				case 0x01:	command = CMD_VOLUMESLIDE; param |= 0x0f;
  8.1129   						if (param == 15) param=31;
  8.1130   						break;
  8.1131 @@ -2437,7 +2427,7 @@
  8.1132   						if (param == 240) param=241;
  8.1133   						break;
  8.1134   				// 04: fine volslide down
  8.1135 -@@ -366,7 +366,7 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStrea
  8.1136 +@@ -366,7 +366,7 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStream, DWORD dwMemLength)
  8.1137   				// 0F: tone portamento
  8.1138   				case 0x0F:	command = CMD_TONEPORTAMENTO; param = param/4; break;
  8.1139   				// 15: vibrato
  8.1140 @@ -2446,7 +2436,7 @@
  8.1141   				// 29: sample offset
  8.1142   				case 0x29:	pos += 2; break;
  8.1143   				// 2A: retrigger note
  8.1144 -@@ -401,466 +401,3 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStrea
  8.1145 +@@ -401,466 +401,3 @@ BOOL CSoundFile::ReadPSM(LPCBYTE lpStream, DWORD dwMemLength)
  8.1146   	// Done (finally!)
  8.1147   	return TRUE;
  8.1148   }
  8.1149 @@ -2913,9 +2903,10 @@
  8.1150  -  END;
  8.1151  -
  8.1152  -*/
  8.1153 -diff -u libmodplug-0.8.9.0/src/load_s3m.cpp~ libmodplug-0.8.9.0/src/load_s3m.cpp
  8.1154 ---- libmodplug-0.8.9.0/src/load_s3m.cpp~
  8.1155 -+++ libmodplug-0.8.9.0/src/load_s3m.cpp
  8.1156 +diff --git a/src/load_s3m.cpp b/src/load_s3m.cpp
  8.1157 +index 121da12..136357a 100644
  8.1158 +--- a/src/load_s3m.cpp
  8.1159 ++++ b/src/load_s3m.cpp
  8.1160  @@ -39,7 +39,6 @@ typedef struct tagS3MSAMPLESTRUCT
  8.1161   	CHAR scrs[4];
  8.1162   } S3MSAMPLESTRUCT;
  8.1163 @@ -2932,7 +2923,7 @@
  8.1164   
  8.1165   
  8.1166   void CSoundFile::S3MConvert(MODCOMMAND *m, BOOL bIT) const
  8.1167 -@@ -104,85 +104,6 @@ void CSoundFile::S3MConvert(MODCOMMAND *
  8.1168 +@@ -104,85 +104,6 @@ void CSoundFile::S3MConvert(MODCOMMAND *m, BOOL bIT) const
  8.1169   	m->param = param;
  8.1170   }
  8.1171   
  8.1172 @@ -3018,7 +3009,7 @@
  8.1173   static DWORD boundInput(DWORD input, DWORD smin, DWORD smax)
  8.1174   {
  8.1175   	if (input > smax) input = smax;
  8.1176 -@@ -190,7 +111,6 @@ static DWORD boundInput(DWORD input, DWO
  8.1177 +@@ -190,7 +111,6 @@ static DWORD boundInput(DWORD input, DWORD smin, DWORD smax)
  8.1178   	return(input);
  8.1179   }
  8.1180   
  8.1181 @@ -3026,7 +3017,7 @@
  8.1182   BOOL CSoundFile::ReadS3M(const BYTE *lpStream, DWORD dwMemLength)
  8.1183   //---------------------------------------------------------------
  8.1184   {
  8.1185 -@@ -299,7 +219,7 @@ BOOL CSoundFile::ReadS3M(const BYTE *lpS
  8.1186 +@@ -299,7 +219,7 @@ BOOL CSoundFile::ReadS3M(const BYTE *lpStream, DWORD dwMemLength)
  8.1187   		}
  8.1188   		S3MSAMPLESTRUCT pSmp;
  8.1189   		memcpy(&pSmp, lpStream+nInd, 0x50);
  8.1190 @@ -3035,7 +3026,7 @@
  8.1191   		insflags[iSmp-1] = pSmp.flags;
  8.1192   		inspack[iSmp-1] = pSmp.pack;
  8.1193   		memcpy(m_szNames[iSmp], pSmp.name, 28);
  8.1194 -@@ -410,261 +330,3 @@ BOOL CSoundFile::ReadS3M(const BYTE *lpS
  8.1195 +@@ -410,261 +330,3 @@ BOOL CSoundFile::ReadS3M(const BYTE *lpStream, DWORD dwMemLength)
  8.1196   	if (psfh.flags & 0x10) m_dwSongFlags |= SONG_AMIGALIMITS;
  8.1197   	return TRUE;
  8.1198   }
  8.1199 @@ -3297,10 +3288,11 @@
  8.1200  -#endif
  8.1201  -
  8.1202  -#endif // MODPLUG_NO_FILESAVE
  8.1203 -diff -u libmodplug-0.8.9.0/src/load_stm.cpp~ libmodplug-0.8.9.0/src/load_stm.cpp
  8.1204 ---- libmodplug-0.8.9.0/src/load_stm.cpp~
  8.1205 -+++ libmodplug-0.8.9.0/src/load_stm.cpp
  8.1206 -@@ -64,8 +64,8 @@ BOOL CSoundFile::ReadSTM(const BYTE *lpS
  8.1207 +diff --git a/src/load_stm.cpp b/src/load_stm.cpp
  8.1208 +index 6f55b78..8b0ca0f 100644
  8.1209 +--- a/src/load_stm.cpp
  8.1210 ++++ b/src/load_stm.cpp
  8.1211 +@@ -64,8 +64,8 @@ BOOL CSoundFile::ReadSTM(const BYTE *lpStream, DWORD dwMemLength)
  8.1212   	
  8.1213   	if ((!lpStream) || (dwMemLength < sizeof(STMHEADER))) return FALSE;
  8.1214   	if ((phdr->filetype != 2) || (phdr->unused != 0x1A)
  8.1215 @@ -3311,9 +3303,10 @@
  8.1216   	memcpy(m_szNames[0], phdr->songname, 20);
  8.1217   	// Read STM header
  8.1218   	m_nType = MOD_TYPE_STM;
  8.1219 -diff -u libmodplug-0.8.9.0/src/load_wav.cpp~ libmodplug-0.8.9.0/src/load_wav.cpp
  8.1220 ---- libmodplug-0.8.9.0/src/load_wav.cpp~
  8.1221 -+++ libmodplug-0.8.9.0/src/load_wav.cpp
  8.1222 +diff --git a/src/load_wav.cpp b/src/load_wav.cpp
  8.1223 +index cf721df..e6232e9 100644
  8.1224 +--- a/src/load_wav.cpp
  8.1225 ++++ b/src/load_wav.cpp
  8.1226  @@ -7,6 +7,12 @@
  8.1227   #include "stdafx.h"
  8.1228   #include "sndfile.h"
  8.1229 @@ -3327,7 +3320,7 @@
  8.1230   #ifndef WAVE_FORMAT_EXTENSIBLE
  8.1231   #define WAVE_FORMAT_EXTENSIBLE	0xFFFE
  8.1232   #endif
  8.1233 -@@ -139,19 +145,16 @@ BOOL CSoundFile::ReadWav(const BYTE *lpS
  8.1234 +@@ -139,19 +145,16 @@ BOOL CSoundFile::ReadWav(const BYTE *lpStream, DWORD dwMemLength)
  8.1235   	return TRUE;
  8.1236   }
  8.1237   
  8.1238 @@ -3355,14 +3348,15 @@
  8.1239   BOOL IMAADPCMUnpack16(signed short *pdest, UINT nLen, LPBYTE psrc, DWORD dwBytes, UINT pkBlkAlign)
  8.1240   //------------------------------------------------------------------------------------------------
  8.1241   {
  8.1242 -@@ -215,3 +217,4 @@ BOOL IMAADPCMUnpack16(signed short *pdes
  8.1243 +@@ -215,3 +217,4 @@ BOOL IMAADPCMUnpack16(signed short *pdest, UINT nLen, LPBYTE psrc, DWORD dwBytes
  8.1244   	}
  8.1245   	return TRUE;
  8.1246   }
  8.1247  +#endif // WAV_SUPPORT
  8.1248 -diff -u libmodplug-0.8.9.0/src/load_xm.cpp~ libmodplug-0.8.9.0/src/load_xm.cpp
  8.1249 ---- libmodplug-0.8.9.0/src/load_xm.cpp~
  8.1250 -+++ libmodplug-0.8.9.0/src/load_xm.cpp
  8.1251 +diff --git a/src/load_xm.cpp b/src/load_xm.cpp
  8.1252 +index 3a22b7d..531b1d6 100644
  8.1253 +--- a/src/load_xm.cpp
  8.1254 ++++ b/src/load_xm.cpp
  8.1255  @@ -11,7 +11,7 @@
  8.1256   ////////////////////////////////////////////////////////
  8.1257   // FastTracker II XM file support
  8.1258 @@ -3396,7 +3390,7 @@
  8.1259   BOOL CSoundFile::ReadXM(const BYTE *lpStream, DWORD dwMemLength)
  8.1260   //--------------------------------------------------------------
  8.1261   {
  8.1262 -@@ -582,315 +579,3 @@ BOOL CSoundFile::ReadXM(const BYTE *lpSt
  8.1263 +@@ -582,315 +579,3 @@ BOOL CSoundFile::ReadXM(const BYTE *lpStream, DWORD dwMemLength)
  8.1264   	}
  8.1265   	return TRUE;
  8.1266   }
  8.1267 @@ -3712,92 +3706,10 @@
  8.1268  -}
  8.1269  -
  8.1270  -#endif // MODPLUG_NO_FILESAVE
  8.1271 -diff -u libmodplug-0.8.9.0/src/Makefile.am~ libmodplug-0.8.9.0/src/Makefile.am
  8.1272 ---- libmodplug-0.8.9.0/src/Makefile.am~
  8.1273 -+++ libmodplug-0.8.9.0/src/Makefile.am
  8.1274 -@@ -35,7 +35,6 @@ libmodplug_la_SOURCES = tables.h        
  8.1275 -                         load_ams.cpp       \
  8.1276 -                         load_amf.cpp       \
  8.1277 -                         load_669.cpp       \
  8.1278 --                        load_j2b.cpp       \
  8.1279 -                         load_mt2.cpp       \
  8.1280 -                         load_psm.cpp       \
  8.1281 -                         load_abc.cpp       \
  8.1282 -@@ -45,6 +44,8 @@ libmodplug_la_SOURCES = tables.h        
  8.1283 - 
  8.1284 - libmodplugincludedir = $(includedir)/libmodplug
  8.1285 - 
  8.1286 --
  8.1287 --libmodpluginclude_HEADERS = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h modplug.h
  8.1288 -+if EXPORT_CXX
  8.1289 -+HEADERS_CXX = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h
  8.1290 -+endif
  8.1291 -+libmodpluginclude_HEADERS = modplug.h $(HEADERS_CXX)
  8.1292 - noinst_HEADERS = load_pat.h
  8.1293 -diff -u libmodplug-0.8.9.0/src/Makefile.in~ libmodplug-0.8.9.0/src/Makefile.in
  8.1294 ---- libmodplug-0.8.9.0/src/Makefile.in~
  8.1295 -+++ libmodplug-0.8.9.0/src/Makefile.in
  8.1296 -@@ -97,8 +97,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/l
  8.1297 - 	$(top_srcdir)/configure.ac
  8.1298 - am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
  8.1299 - 	$(ACLOCAL_M4)
  8.1300 --DIST_COMMON = $(srcdir)/Makefile.am $(libmodpluginclude_HEADERS) \
  8.1301 --	$(noinst_HEADERS) $(am__DIST_COMMON)
  8.1302 -+DIST_COMMON = $(srcdir)/Makefile.am \
  8.1303 -+	$(am__libmodpluginclude_HEADERS_DIST) $(noinst_HEADERS) \
  8.1304 -+	$(am__DIST_COMMON)
  8.1305 - mkinstalldirs = $(install_sh) -d
  8.1306 - CONFIG_HEADER = config.h
  8.1307 - CONFIG_CLEAN_FILES =
  8.1308 -@@ -139,8 +140,8 @@ am_libmodplug_la_OBJECTS = sndmix.lo snd
  8.1309 - 	load_umx.lo load_ult.lo load_stm.lo load_s3m.lo load_ptm.lo \
  8.1310 - 	load_okt.lo load_mtm.lo load_mod.lo load_med.lo load_mdl.lo \
  8.1311 - 	load_it.lo load_far.lo load_dsm.lo load_dmf.lo load_dbm.lo \
  8.1312 --	load_ams.lo load_amf.lo load_669.lo load_j2b.lo load_mt2.lo \
  8.1313 --	load_psm.lo load_abc.lo load_mid.lo load_pat.lo modplug.lo
  8.1314 -+	load_ams.lo load_amf.lo load_669.lo load_mt2.lo load_psm.lo \
  8.1315 -+	load_abc.lo load_mid.lo load_pat.lo modplug.lo
  8.1316 - libmodplug_la_OBJECTS = $(am_libmodplug_la_OBJECTS)
  8.1317 - AM_V_lt = $(am__v_lt_@AM_V@)
  8.1318 - am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
  8.1319 -@@ -209,6 +210,8 @@ am__can_run_installinfo = \
  8.1320 -     n|no|NO) false;; \
  8.1321 -     *) (install-info --version) >/dev/null 2>&1;; \
  8.1322 -   esac
  8.1323 -+am__libmodpluginclude_HEADERS_DIST = modplug.h libmodplug/stdafx.h \
  8.1324 -+	libmodplug/sndfile.h libmodplug/it_defs.h
  8.1325 - HEADERS = $(libmodpluginclude_HEADERS) $(noinst_HEADERS)
  8.1326 - am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
  8.1327 - 	$(LISP)config.h.in
  8.1328 -@@ -392,7 +395,6 @@ libmodplug_la_SOURCES = tables.h        
  8.1329 -                         load_ams.cpp       \
  8.1330 -                         load_amf.cpp       \
  8.1331 -                         load_669.cpp       \
  8.1332 --                        load_j2b.cpp       \
  8.1333 -                         load_mt2.cpp       \
  8.1334 -                         load_psm.cpp       \
  8.1335 -                         load_abc.cpp       \
  8.1336 -@@ -401,7 +403,8 @@ libmodplug_la_SOURCES = tables.h        
  8.1337 -                         modplug.cpp
  8.1338 - 
  8.1339 - libmodplugincludedir = $(includedir)/libmodplug
  8.1340 --libmodpluginclude_HEADERS = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h modplug.h
  8.1341 -+@EXPORT_CXX_TRUE@HEADERS_CXX = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h
  8.1342 -+libmodpluginclude_HEADERS = modplug.h $(HEADERS_CXX)
  8.1343 - noinst_HEADERS = load_pat.h
  8.1344 - all: config.h
  8.1345 - 	$(MAKE) $(AM_MAKEFLAGS) all-am
  8.1346 -@@ -507,7 +510,6 @@ distclean-compile:
  8.1347 - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_dsm.Plo@am__quote@
  8.1348 - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_far.Plo@am__quote@
  8.1349 - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_it.Plo@am__quote@
  8.1350 --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_j2b.Plo@am__quote@
  8.1351 - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_mdl.Plo@am__quote@
  8.1352 - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_med.Plo@am__quote@
  8.1353 - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_mid.Plo@am__quote@
  8.1354 -diff -u libmodplug-0.8.9.0/src/mmcmp.cpp~ libmodplug-0.8.9.0/src/mmcmp.cpp
  8.1355 ---- libmodplug-0.8.9.0/src/mmcmp.cpp~
  8.1356 -+++ libmodplug-0.8.9.0/src/mmcmp.cpp
  8.1357 +diff --git a/src/mmcmp.cpp b/src/mmcmp.cpp
  8.1358 +index 890df2f..2ad7a7b 100644
  8.1359 +--- a/src/mmcmp.cpp
  8.1360 ++++ b/src/mmcmp.cpp
  8.1361  @@ -8,6 +8,7 @@
  8.1362   #include "stdafx.h"
  8.1363   #include "sndfile.h"
  8.1364 @@ -3806,15 +3718,41 @@
  8.1365   BOOL PP20_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength);
  8.1366   
  8.1367   #pragma pack(1)
  8.1368 -@@ -501,3 +502,4 @@ BOOL PP20_Unpack(LPCBYTE *ppMemFile, LPD
  8.1369 +@@ -175,7 +176,7 @@ BOOL MMCMP_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength)
  8.1370 + 	 || (!pmmh->nblocks) || (pmmh->filesize < 16) || (pmmh->filesize > 0x8000000)
  8.1371 + 	 || (pmmh->blktable >= dwMemLength) || (pmmh->blktable + 4*pmmh->nblocks > dwMemLength)) return FALSE;
  8.1372 + 	dwFileSize = pmmh->filesize;
  8.1373 +-	if ((pBuffer = (LPBYTE)GlobalAllocPtr(GHND, (dwFileSize + 31) & ~15)) == NULL) return FALSE;
  8.1374 ++	if ((pBuffer = (LPBYTE)calloc(1, (dwFileSize + 31) & ~15)) == NULL) return FALSE;
  8.1375 + 	pblk_table = (const DWORD *)(lpMemFile+pmmh->blktable);
  8.1376 + 	for (UINT nBlock=0; nBlock<pmmh->nblocks; nBlock++)
  8.1377 + 	{
  8.1378 +@@ -382,7 +383,7 @@ BOOL MMCMP_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength)
  8.1379 + 			}
  8.1380 + 		} else
  8.1381 + 		{
  8.1382 +-			GlobalFreePtr(pBuffer);
  8.1383 ++			free(pBuffer);
  8.1384 + 			return FALSE;
  8.1385 + 		}
  8.1386 + 	}
  8.1387 +@@ -495,9 +496,10 @@ BOOL PP20_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength)
  8.1388 + 	dwDstLen = (lpMemFile[dwMemLength-4]<<16) | (lpMemFile[dwMemLength-3]<<8) | (lpMemFile[dwMemLength-2]);
  8.1389 + 	//Log("PP20 detected: Packed length=%d, Unpacked length=%d\n", dwMemLength, dwDstLen);
  8.1390 + 	if ((dwDstLen < 512) || (dwDstLen > 0x400000) || (dwDstLen > 16*dwMemLength)) return FALSE;
  8.1391 +-	if ((pBuffer = (LPBYTE)GlobalAllocPtr(GHND, (dwDstLen + 31) & ~15)) == NULL) return FALSE;
  8.1392 ++	if ((pBuffer = (LPBYTE)calloc(1, (dwDstLen + 31) & ~15)) == NULL) return FALSE;
  8.1393 + 	PP20_DoUnpack(lpMemFile+4, dwMemLength-4, pBuffer, dwDstLen);
  8.1394 + 	*ppMemFile = pBuffer;
  8.1395   	*pdwMemLength = dwDstLen;
  8.1396   	return TRUE;
  8.1397   }
  8.1398  +#endif /* MMCMP_SUPPORT */
  8.1399 -diff -u libmodplug-0.8.9.0/src/modplug.cpp~ libmodplug-0.8.9.0/src/modplug.cpp
  8.1400 ---- libmodplug-0.8.9.0/src/modplug.cpp~
  8.1401 -+++ libmodplug-0.8.9.0/src/modplug.cpp
  8.1402 -@@ -187,28 +187,6 @@ char* ModPlug_GetMessage(ModPlugFile* fi
  8.1403 +diff --git a/src/modplug.cpp b/src/modplug.cpp
  8.1404 +index bb4ab62..eb00003 100644
  8.1405 +--- a/src/modplug.cpp
  8.1406 ++++ b/src/modplug.cpp
  8.1407 +@@ -187,28 +187,6 @@ char* ModPlug_GetMessage(ModPlugFile* file)
  8.1408   	return file->mSoundFile.m_lpszSongComments;
  8.1409   }
  8.1410   
  8.1411 @@ -3843,9 +3781,10 @@
  8.1412   unsigned int ModPlug_NumInstruments(ModPlugFile* file)
  8.1413   {
  8.1414   	return file->mSoundFile.m_nInstruments;
  8.1415 -diff -u libmodplug-0.8.9.0/src/modplug.h~ libmodplug-0.8.9.0/src/modplug.h
  8.1416 ---- libmodplug-0.8.9.0/src/modplug.h~
  8.1417 -+++ libmodplug-0.8.9.0/src/modplug.h
  8.1418 +diff --git a/src/modplug.h b/src/modplug.h
  8.1419 +index f7f78b7..64e157c 100644
  8.1420 +--- a/src/modplug.h
  8.1421 ++++ b/src/modplug.h
  8.1422  @@ -19,6 +19,12 @@ extern "C" {
  8.1423   # else
  8.1424   #   define MODPLUG_EXPORT __declspec(dllimport)			/* using libmodplug dll for windows */
  8.1425 @@ -3859,7 +3798,7 @@
  8.1426   #elif defined(MODPLUG_BUILD) && defined(SYM_VISIBILITY)
  8.1427   #   define MODPLUG_EXPORT __attribute__((visibility("default")))
  8.1428   #else
  8.1429 -@@ -130,24 +136,6 @@ MODPLUG_EXPORT void ModPlug_SeekOrder(Mo
  8.1430 +@@ -130,24 +136,6 @@ MODPLUG_EXPORT void ModPlug_SeekOrder(ModPlugFile* file,int order);
  8.1431   MODPLUG_EXPORT int ModPlug_GetModuleType(ModPlugFile* file);
  8.1432   MODPLUG_EXPORT char* ModPlug_GetMessage(ModPlugFile* file);
  8.1433   
  8.1434 @@ -3884,15 +3823,89 @@
  8.1435   MODPLUG_EXPORT unsigned int ModPlug_NumInstruments(ModPlugFile* file);
  8.1436   MODPLUG_EXPORT unsigned int ModPlug_NumSamples(ModPlugFile* file);
  8.1437   MODPLUG_EXPORT unsigned int ModPlug_NumPatterns(ModPlugFile* file);
  8.1438 -@@ -182,4 +170,4 @@ MODPLUG_EXPORT void ModPlug_UnloadMixerC
  8.1439 +@@ -182,4 +170,4 @@ MODPLUG_EXPORT void ModPlug_UnloadMixerCallback(ModPlugFile* file) ;
  8.1440   } /* extern "C" */
  8.1441   #endif
  8.1442   
  8.1443  -#endif
  8.1444  +#endif /* MODPLUG_H__INCLUDED */
  8.1445 -diff -u libmodplug-0.8.9.0/src/sndfile.cpp~ libmodplug-0.8.9.0/src/sndfile.cpp
  8.1446 ---- libmodplug-0.8.9.0/src/sndfile.cpp~
  8.1447 -+++ libmodplug-0.8.9.0/src/sndfile.cpp
  8.1448 +diff --git a/src/snd_flt.cpp b/src/snd_flt.cpp
  8.1449 +index f8a573c..510ef76 100644
  8.1450 +--- a/src/snd_flt.cpp
  8.1451 ++++ b/src/snd_flt.cpp
  8.1452 +@@ -13,12 +13,11 @@
  8.1453 + 
  8.1454 + #ifndef NO_FILTER
  8.1455 + 
  8.1456 +-#ifdef MSC_VER
  8.1457 ++#if defined(_MSC_VER) && defined(_M_IX86)
  8.1458 + #define _ASM_MATH
  8.1459 + #endif
  8.1460 + 
  8.1461 + #ifdef _ASM_MATH
  8.1462 +-
  8.1463 + // pow(a,b) returns a^^b -> 2^^(b.log2(a))
  8.1464 + static float pow(float a, float b)
  8.1465 + {
  8.1466 +@@ -42,7 +41,6 @@ static float pow(float a, float b)
  8.1467 + 	return result;
  8.1468 + }
  8.1469 + 
  8.1470 +-
  8.1471 + #else
  8.1472 + 
  8.1473 + #include <math.h>
  8.1474 +diff --git a/src/snd_fx.cpp b/src/snd_fx.cpp
  8.1475 +index 0ed4f88..845ecb3 100644
  8.1476 +--- a/src/snd_fx.cpp
  8.1477 ++++ b/src/snd_fx.cpp
  8.1478 +@@ -9,7 +9,7 @@
  8.1479 + #include "sndfile.h"
  8.1480 + #include "tables.h"
  8.1481 + 
  8.1482 +-#ifdef MSC_VER
  8.1483 ++#ifdef _MSC_VER
  8.1484 + #pragma warning(disable:4244)
  8.1485 + #endif
  8.1486 + 
  8.1487 +@@ -514,7 +514,6 @@ void CSoundFile::NoteChange(UINT nChn, int note, BOOL bPorta, BOOL bResetEnv)
  8.1488 + 	if (!bPorta)
  8.1489 + 	{
  8.1490 + 		pChn->nVUMeter = 0x100;
  8.1491 +-		pChn->nLeftVU = pChn->nRightVU = 0xFF;
  8.1492 + 		pChn->dwFlags &= ~CHN_FILTER;
  8.1493 + 		pChn->dwFlags |= CHN_FASTVOLRAMP;
  8.1494 + 		pChn->nRetrigCount = 0;
  8.1495 +@@ -1225,9 +1224,6 @@ BOOL CSoundFile::ProcessEffects()
  8.1496 + 						if (m_nRepeatCount > 0) m_nRepeatCount--;
  8.1497 + 					} else
  8.1498 + 					{
  8.1499 +-					#ifdef MODPLUG_TRACKER
  8.1500 +-						if (gdwSoundSetup & SNDMIX_NOBACKWARDJUMPS)
  8.1501 +-					#endif
  8.1502 + 						// Backward jump disabled
  8.1503 + 						bNoLoop = TRUE;
  8.1504 + 						//reset repeat count incase there are multiple loops.
  8.1505 +@@ -2074,7 +2070,6 @@ void CSoundFile::SetSpeed(UINT param)
  8.1506 + {
  8.1507 + 	UINT max = (m_nType == MOD_TYPE_IT) ? 256 : 128;
  8.1508 + 	// Modplug Tracker and Mod-Plugin don't do this check
  8.1509 +-#ifndef MODPLUG_TRACKER
  8.1510 + #ifndef MODPLUG_FASTSOUNDLIB
  8.1511 + 	// Big Hack!!!
  8.1512 + 	if ((!param) || (param >= 0x80) || ((m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM|MOD_TYPE_MT2)) && (param >= 0x1E)))
  8.1513 +@@ -2085,7 +2080,6 @@ void CSoundFile::SetSpeed(UINT param)
  8.1514 + 		}
  8.1515 + 	}
  8.1516 + #endif // MODPLUG_FASTSOUNDLIB
  8.1517 +-#endif // MODPLUG_TRACKER
  8.1518 + 	if ((m_nType & MOD_TYPE_S3M) && (param > 0x80)) param -= 0x80;
  8.1519 + 	if ((param) && (param <= max)) m_nMusicSpeed = param;
  8.1520 + }
  8.1521 +diff --git a/src/sndfile.cpp b/src/sndfile.cpp
  8.1522 +index 2dfc79e..c79e8fa 100644
  8.1523 +--- a/src/sndfile.cpp
  8.1524 ++++ b/src/sndfile.cpp
  8.1525  @@ -9,8 +9,6 @@
  8.1526   #include "libmodplug/stdafx.h"
  8.1527   #include "libmodplug/sndfile.h"
  8.1528 @@ -3902,7 +3915,7 @@
  8.1529   #ifdef MMCMP_SUPPORT
  8.1530   extern BOOL MMCMP_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength);
  8.1531   #endif
  8.1532 -@@ -24,24 +22,6 @@ extern void ITUnpack8Bit(signed char *pS
  8.1533 +@@ -24,24 +22,6 @@ extern void ITUnpack8Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DW
  8.1534   extern void ITUnpack16Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, BOOL b215);
  8.1535   
  8.1536   
  8.1537 @@ -3927,7 +3940,7 @@
  8.1538   //////////////////////////////////////////////////////////
  8.1539   // CSoundFile
  8.1540   
  8.1541 -@@ -140,12 +120,16 @@ BOOL CSoundFile::Create(LPCBYTE lpStream
  8.1542 +@@ -140,12 +120,16 @@ BOOL CSoundFile::Create(LPCBYTE lpStream, DWORD dwMemLength)
  8.1543   		if ((!ReadXM(lpStream, dwMemLength))
  8.1544   		 && (!ReadS3M(lpStream, dwMemLength))
  8.1545   		 && (!ReadIT(lpStream, dwMemLength))
  8.1546 @@ -3944,7 +3957,37 @@
  8.1547   		 && (!ReadSTM(lpStream, dwMemLength))
  8.1548   		 && (!ReadMed(lpStream, dwMemLength))
  8.1549   		 && (!ReadMTM(lpStream, dwMemLength))
  8.1550 -@@ -753,41 +737,6 @@ void CSoundFile::LoopPattern(int nPat, i
  8.1551 +@@ -168,7 +152,7 @@ BOOL CSoundFile::Create(LPCBYTE lpStream, DWORD dwMemLength)
  8.1552 + #ifdef MMCMP_SUPPORT
  8.1553 + 		if (bMMCmp)
  8.1554 + 		{
  8.1555 +-			GlobalFreePtr(lpStream);
  8.1556 ++			free((void*)lpStream);
  8.1557 + 			lpStream = NULL;
  8.1558 + 		}
  8.1559 + #endif
  8.1560 +@@ -355,7 +339,7 @@ void CSoundFile::FreePattern(LPVOID pat)
  8.1561 + signed char* CSoundFile::AllocateSample(UINT nbytes)
  8.1562 + //-------------------------------------------
  8.1563 + {
  8.1564 +-	signed char * p = (signed char *)GlobalAllocPtr(GHND, (nbytes+39) & ~7);
  8.1565 ++	signed char * p = (signed char *)calloc(1, (nbytes+39) & ~7);
  8.1566 + 	if (p) p += 16;
  8.1567 + 	return p;
  8.1568 + }
  8.1569 +@@ -364,9 +348,8 @@ signed char* CSoundFile::AllocateSample(UINT nbytes)
  8.1570 + void CSoundFile::FreeSample(LPVOID p)
  8.1571 + //-----------------------------------
  8.1572 + {
  8.1573 +-	if (p)
  8.1574 +-	{
  8.1575 +-		GlobalFreePtr(((LPSTR)p)-16);
  8.1576 ++	if (p) {
  8.1577 ++		free((char*)p - 16);
  8.1578 + 	}
  8.1579 + }
  8.1580 + 
  8.1581 +@@ -753,41 +736,6 @@ void CSoundFile::LoopPattern(int nPat, int nRow)
  8.1582   }
  8.1583   
  8.1584   
  8.1585 @@ -3986,7 +4029,7 @@
  8.1586   UINT CSoundFile::GetSampleName(UINT nSample,LPSTR s) const
  8.1587   //--------------------------------------------------------
  8.1588   {
  8.1589 -@@ -817,274 +766,6 @@ UINT CSoundFile::GetInstrumentName(UINT 
  8.1590 +@@ -817,274 +765,6 @@ UINT CSoundFile::GetInstrumentName(UINT nInstr,LPSTR s) const
  8.1591   }
  8.1592   
  8.1593   
  8.1594 @@ -4261,7 +4304,7 @@
  8.1595   // Flags:
  8.1596   //	0 = signed 8-bit PCM data (default)
  8.1597   //	1 = unsigned 8-bit PCM data
  8.1598 -@@ -1376,17 +1057,18 @@ UINT CSoundFile::ReadSample(MODINSTRUMEN
  8.1599 +@@ -1376,17 +1056,18 @@ UINT CSoundFile::ReadSample(MODINSTRUMENT *pIns, UINT nFlags, LPCSTR lpMemFile,
  8.1600   	// PTM 8bit delta to 16-bit sample
  8.1601   	case RS_PTM8DTO16:
  8.1602   		{
  8.1603 @@ -4282,7 +4325,7 @@
  8.1604   			{
  8.1605   				uint16_t rawSample = *pSampleW;
  8.1606   			        *pSampleW++ = bswapLE16(rawSample);
  8.1607 -@@ -1448,88 +1130,6 @@ UINT CSoundFile::ReadSample(MODINSTRUMEN
  8.1608 +@@ -1448,88 +1129,6 @@ UINT CSoundFile::ReadSample(MODINSTRUMENT *pIns, UINT nFlags, LPCSTR lpMemFile,
  8.1609   			len = DMFUnpack((LPBYTE)pIns->pSample, ibuf, ibufmax, maxlen);
  8.1610   		}
  8.1611   		break;
  8.1612 @@ -4371,7 +4414,7 @@
  8.1613   #endif // !MODPLUG_FASTSOUNDLIB
  8.1614   #endif // !MODPLUG_BASIC_SUPPORT
  8.1615   
  8.1616 -@@ -1654,8 +1254,7 @@ void CSoundFile::AdjustSampleLoop(MODINS
  8.1617 +@@ -1654,8 +1253,7 @@ void CSoundFile::AdjustSampleLoop(MODINSTRUMENT *pIns)
  8.1618   DWORD CSoundFile::TransposeToFrequency(int transp, int ftune)
  8.1619   //-----------------------------------------------------------
  8.1620   {
  8.1621 @@ -4381,7 +4424,7 @@
  8.1622   	const float _fbase = 8363;
  8.1623   	const float _factor = 1.0f/(12.0f*128.0f);
  8.1624   	int result;
  8.1625 -@@ -1695,8 +1294,7 @@ DWORD CSoundFile::TransposeToFrequency(i
  8.1626 +@@ -1695,8 +1293,7 @@ DWORD CSoundFile::TransposeToFrequency(int transp, int ftune)
  8.1627   int CSoundFile::FrequencyToTranspose(DWORD freq)
  8.1628   //----------------------------------------------
  8.1629   {
  8.1630 @@ -4391,80 +4434,10 @@
  8.1631   	const float _f1_8363 = 1.0f / 8363.0f;
  8.1632   	const float _factor = 128 * 12;
  8.1633   	LONG result;
  8.1634 -diff -u libmodplug-0.8.9.0/src/snd_flt.cpp~ libmodplug-0.8.9.0/src/snd_flt.cpp
  8.1635 ---- libmodplug-0.8.9.0/src/snd_flt.cpp~
  8.1636 -+++ libmodplug-0.8.9.0/src/snd_flt.cpp
  8.1637 -@@ -13,12 +13,11 @@
  8.1638 - 
  8.1639 - #ifndef NO_FILTER
  8.1640 - 
  8.1641 --#ifdef MSC_VER
  8.1642 -+#if defined(_MSC_VER) && defined(_M_IX86)
  8.1643 - #define _ASM_MATH
  8.1644 - #endif
  8.1645 - 
  8.1646 - #ifdef _ASM_MATH
  8.1647 --
  8.1648 - // pow(a,b) returns a^^b -> 2^^(b.log2(a))
  8.1649 - static float pow(float a, float b)
  8.1650 - {
  8.1651 -@@ -42,7 +41,6 @@ static float pow(float a, float b)
  8.1652 - 	return result;
  8.1653 - }
  8.1654 - 
  8.1655 --
  8.1656 - #else
  8.1657 - 
  8.1658 - #include <math.h>
  8.1659 -diff -u libmodplug-0.8.9.0/src/snd_fx.cpp~ libmodplug-0.8.9.0/src/snd_fx.cpp
  8.1660 ---- libmodplug-0.8.9.0/src/snd_fx.cpp~
  8.1661 -+++ libmodplug-0.8.9.0/src/snd_fx.cpp
  8.1662 -@@ -9,7 +9,7 @@
  8.1663 - #include "sndfile.h"
  8.1664 - #include "tables.h"
  8.1665 - 
  8.1666 --#ifdef MSC_VER
  8.1667 -+#ifdef _MSC_VER
  8.1668 - #pragma warning(disable:4244)
  8.1669 - #endif
  8.1670 - 
  8.1671 -@@ -514,7 +514,6 @@ void CSoundFile::NoteChange(UINT nChn, i
  8.1672 - 	if (!bPorta)
  8.1673 - 	{
  8.1674 - 		pChn->nVUMeter = 0x100;
  8.1675 --		pChn->nLeftVU = pChn->nRightVU = 0xFF;
  8.1676 - 		pChn->dwFlags &= ~CHN_FILTER;
  8.1677 - 		pChn->dwFlags |= CHN_FASTVOLRAMP;
  8.1678 - 		pChn->nRetrigCount = 0;
  8.1679 -@@ -1225,9 +1224,6 @@ BOOL CSoundFile::ProcessEffects()
  8.1680 - 						if (m_nRepeatCount > 0) m_nRepeatCount--;
  8.1681 - 					} else
  8.1682 - 					{
  8.1683 --					#ifdef MODPLUG_TRACKER
  8.1684 --						if (gdwSoundSetup & SNDMIX_NOBACKWARDJUMPS)
  8.1685 --					#endif
  8.1686 - 						// Backward jump disabled
  8.1687 - 						bNoLoop = TRUE;
  8.1688 - 						//reset repeat count incase there are multiple loops.
  8.1689 -@@ -2074,7 +2070,6 @@ void CSoundFile::SetSpeed(UINT param)
  8.1690 - {
  8.1691 - 	UINT max = (m_nType == MOD_TYPE_IT) ? 256 : 128;
  8.1692 - 	// Modplug Tracker and Mod-Plugin don't do this check
  8.1693 --#ifndef MODPLUG_TRACKER
  8.1694 - #ifndef MODPLUG_FASTSOUNDLIB
  8.1695 - 	// Big Hack!!!
  8.1696 - 	if ((!param) || (param >= 0x80) || ((m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM|MOD_TYPE_MT2)) && (param >= 0x1E)))
  8.1697 -@@ -2085,7 +2080,6 @@ void CSoundFile::SetSpeed(UINT param)
  8.1698 - 		}
  8.1699 - 	}
  8.1700 - #endif // MODPLUG_FASTSOUNDLIB
  8.1701 --#endif // MODPLUG_TRACKER
  8.1702 - 	if ((m_nType & MOD_TYPE_S3M) && (param > 0x80)) param -= 0x80;
  8.1703 - 	if ((param) && (param <= max)) m_nMusicSpeed = param;
  8.1704 - }
  8.1705 -diff -u libmodplug-0.8.9.0/src/sndmix.cpp~ libmodplug-0.8.9.0/src/sndmix.cpp
  8.1706 ---- libmodplug-0.8.9.0/src/sndmix.cpp~
  8.1707 -+++ libmodplug-0.8.9.0/src/sndmix.cpp
  8.1708 +diff --git a/src/sndmix.cpp b/src/sndmix.cpp
  8.1709 +index 20f722f..426f8ab 100644
  8.1710 +--- a/src/sndmix.cpp
  8.1711 ++++ b/src/sndmix.cpp
  8.1712  @@ -8,10 +8,6 @@
  8.1713   #include "libmodplug/sndfile.h"
  8.1714   #include "tables.h"
  8.1715 @@ -4604,3 +4577,208 @@
  8.1716   			pChn->nLeftVol = pChn->nRightVol = 0;
  8.1717   			pChn->nLength = 0;
  8.1718  
  8.1719 +diff -u libmodplug-0.8.9.0/configure~ libmodplug-0.8.9.0/configure
  8.1720 +--- libmodplug-0.8.9.0/configure~
  8.1721 ++++ libmodplug-0.8.9.0/configure
  8.1722 +@@ -634,6 +634,8 @@
  8.1723 + LTLIBOBJS
  8.1724 + LIBOBJS
  8.1725 + MODPLUG_LIBRARY_VERSION
  8.1726 ++EXPORT_CXX_FALSE
  8.1727 ++EXPORT_CXX_TRUE
  8.1728 + LT_LDFLAGS
  8.1729 + LT_SYS_LIBRARY_PATH
  8.1730 + OTOOL64
  8.1731 +@@ -772,6 +774,10 @@
  8.1732 + with_gnu_ld
  8.1733 + with_sysroot
  8.1734 + enable_libtool_lock
  8.1735 ++enable_cxx_interface
  8.1736 ++enable_midi
  8.1737 ++enable_wav
  8.1738 ++enable_mmcmp
  8.1739 + '
  8.1740 +       ac_precious_vars='build_alias
  8.1741 + host_alias
  8.1742 +@@ -1418,6 +1424,11 @@
  8.1743 +   --enable-fast-install[=PKGS]
  8.1744 +                           optimize for fast installation [default=yes]
  8.1745 +   --disable-libtool-lock  avoid locking (might break parallel builds)
  8.1746 ++  --enable-cxx-interface  export C++ interface from library [[default=yes]]
  8.1747 ++  --enable-midi           compile with midi formats support [[default=no]]
  8.1748 ++  --enable-wav            compile with wav formats support [[default=no]]
  8.1749 ++  --enable-mmcmp          compile with mmcmp and pp20 decompression support
  8.1750 ++                          [[default=no]]
  8.1751 + 
  8.1752 + Optional Packages:
  8.1753 +   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  8.1754 +@@ -16702,13 +16713,12 @@
  8.1755 + 
  8.1756 + done
  8.1757 + 
  8.1758 +-for ac_func in setenv sinf
  8.1759 ++for ac_func in sinf
  8.1760 + do :
  8.1761 +-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
  8.1762 +-ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
  8.1763 +-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
  8.1764 ++  ac_fn_cxx_check_func "$LINENO" "sinf" "ac_cv_func_sinf"
  8.1765 ++if test "x$ac_cv_func_sinf" = xyes; then :
  8.1766 +   cat >>confdefs.h <<_ACEOF
  8.1767 +-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
  8.1768 ++#define HAVE_SINF 1
  8.1769 + _ACEOF
  8.1770 + 
  8.1771 + fi
  8.1772 +@@ -16786,6 +16796,66 @@
  8.1773 + 		;;
  8.1774 + esac
  8.1775 + 
  8.1776 ++# Check whether --enable-cxx_interface was given.
  8.1777 ++if test "${enable_cxx_interface+set}" = set; then :
  8.1778 ++  enableval=$enable_cxx_interface;
  8.1779 ++else
  8.1780 ++  enable_cxx_interface=yes
  8.1781 ++fi
  8.1782 ++
  8.1783 ++if test x$enable_cxx_interface != xyes; then
  8.1784 ++
  8.1785 ++$as_echo "#define NO_CXX_EXPORTS 1" >>confdefs.h
  8.1786 ++
  8.1787 ++fi
  8.1788 ++ if test x$enable_cxx_interface = xyes; then
  8.1789 ++  EXPORT_CXX_TRUE=
  8.1790 ++  EXPORT_CXX_FALSE='#'
  8.1791 ++else
  8.1792 ++  EXPORT_CXX_TRUE='#'
  8.1793 ++  EXPORT_CXX_FALSE=
  8.1794 ++fi
  8.1795 ++
  8.1796 ++
  8.1797 ++# Check whether --enable-midi was given.
  8.1798 ++if test "${enable_midi+set}" = set; then :
  8.1799 ++  enableval=$enable_midi;
  8.1800 ++else
  8.1801 ++  enable_midi=no
  8.1802 ++fi
  8.1803 ++
  8.1804 ++if test x$enable_midi = xyes; then
  8.1805 ++
  8.1806 ++$as_echo "#define MIDIFMT_SUPPORT 1" >>confdefs.h
  8.1807 ++
  8.1808 ++fi
  8.1809 ++
  8.1810 ++# Check whether --enable-wav was given.
  8.1811 ++if test "${enable_wav+set}" = set; then :
  8.1812 ++  enableval=$enable_wav;
  8.1813 ++else
  8.1814 ++  enable_wav=no
  8.1815 ++fi
  8.1816 ++
  8.1817 ++if test x$enable_wav = xyes; then
  8.1818 ++
  8.1819 ++$as_echo "#define WAV_SUPPORT 1" >>confdefs.h
  8.1820 ++
  8.1821 ++fi
  8.1822 ++
  8.1823 ++# Check whether --enable-mmcmp was given.
  8.1824 ++if test "${enable_mmcmp+set}" = set; then :
  8.1825 ++  enableval=$enable_mmcmp;
  8.1826 ++else
  8.1827 ++  enable_mmcmp=no
  8.1828 ++fi
  8.1829 ++
  8.1830 ++if test x$enable_mmcmp = xyes; then
  8.1831 ++
  8.1832 ++$as_echo "#define MMCMP_SUPPORT 1" >>confdefs.h
  8.1833 ++
  8.1834 ++fi
  8.1835 ++
  8.1836 + # portable types. requires autoconf 2.60
  8.1837 + # `configure' will check if these are defined in system headers.
  8.1838 + # if not, it will auto-detect and define them in `config.h'
  8.1839 +@@ -17036,6 +17106,10 @@
  8.1840 + Usually this means the macro was only invoked conditionally." "$LINENO" 5
  8.1841 + fi
  8.1842 + 
  8.1843 ++if test -z "${EXPORT_CXX_TRUE}" && test -z "${EXPORT_CXX_FALSE}"; then
  8.1844 ++  as_fn_error $? "conditional \"EXPORT_CXX\" was never defined.
  8.1845 ++Usually this means the macro was only invoked conditionally." "$LINENO" 5
  8.1846 ++fi
  8.1847 + 
  8.1848 + : "${CONFIG_STATUS=./config.status}"
  8.1849 + ac_write_fail=0
  8.1850 +diff -u libmodplug-0.8.9.0/Makefile.in~ libmodplug-0.8.9.0b/Makefile.in
  8.1851 +--- libmodplug-0.8.9.0/Makefile.in~
  8.1852 ++++ libmodplug-0.8.9.0/Makefile.in
  8.1853 +@@ -359,7 +359,7 @@
  8.1854 + top_srcdir = @top_srcdir@
  8.1855 + ACLOCAL_AMFLAGS = -I m4
  8.1856 + SUBDIRS = src
  8.1857 +-EXTRA_DIST = \
  8.1858 ++EXTRA_DIST = CMakeLists.txt \
  8.1859 + 	AUTHORS COPYING ChangeLog \
  8.1860 + 	INSTALL README TODO
  8.1861 + 
  8.1862 +diff -u libmodplug-0.8.9.0/src/Makefile.in~ libmodplug-0.8.9.0/src/Makefile.in
  8.1863 +--- libmodplug-0.8.9.0/src/Makefile.in~
  8.1864 ++++ libmodplug-0.8.9.0/src/Makefile.in
  8.1865 +@@ -97,8 +97,9 @@
  8.1866 + 	$(top_srcdir)/configure.ac
  8.1867 + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
  8.1868 + 	$(ACLOCAL_M4)
  8.1869 +-DIST_COMMON = $(srcdir)/Makefile.am $(libmodpluginclude_HEADERS) \
  8.1870 +-	$(noinst_HEADERS) $(am__DIST_COMMON)
  8.1871 ++DIST_COMMON = $(srcdir)/Makefile.am \
  8.1872 ++	$(am__libmodpluginclude_HEADERS_DIST) $(noinst_HEADERS) \
  8.1873 ++	$(am__DIST_COMMON)
  8.1874 + mkinstalldirs = $(install_sh) -d
  8.1875 + CONFIG_HEADER = config.h
  8.1876 + CONFIG_CLEAN_FILES =
  8.1877 +@@ -139,8 +140,8 @@
  8.1878 + 	load_umx.lo load_ult.lo load_stm.lo load_s3m.lo load_ptm.lo \
  8.1879 + 	load_okt.lo load_mtm.lo load_mod.lo load_med.lo load_mdl.lo \
  8.1880 + 	load_it.lo load_far.lo load_dsm.lo load_dmf.lo load_dbm.lo \
  8.1881 +-	load_ams.lo load_amf.lo load_669.lo load_j2b.lo load_mt2.lo \
  8.1882 +-	load_psm.lo load_abc.lo load_mid.lo load_pat.lo modplug.lo
  8.1883 ++	load_ams.lo load_amf.lo load_669.lo load_mt2.lo load_psm.lo \
  8.1884 ++	load_abc.lo load_mid.lo load_pat.lo modplug.lo
  8.1885 + libmodplug_la_OBJECTS = $(am_libmodplug_la_OBJECTS)
  8.1886 + AM_V_lt = $(am__v_lt_@AM_V@)
  8.1887 + am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
  8.1888 +@@ -209,6 +210,8 @@
  8.1889 +     n|no|NO) false;; \
  8.1890 +     *) (install-info --version) >/dev/null 2>&1;; \
  8.1891 +   esac
  8.1892 ++am__libmodpluginclude_HEADERS_DIST = modplug.h libmodplug/stdafx.h \
  8.1893 ++	libmodplug/sndfile.h libmodplug/it_defs.h
  8.1894 + HEADERS = $(libmodpluginclude_HEADERS) $(noinst_HEADERS)
  8.1895 + am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
  8.1896 + 	$(LISP)config.h.in
  8.1897 +@@ -392,7 +395,6 @@
  8.1898 +                         load_ams.cpp       \
  8.1899 +                         load_amf.cpp       \
  8.1900 +                         load_669.cpp       \
  8.1901 +-                        load_j2b.cpp       \
  8.1902 +                         load_mt2.cpp       \
  8.1903 +                         load_psm.cpp       \
  8.1904 +                         load_abc.cpp       \
  8.1905 +@@ -401,7 +403,8 @@
  8.1906 +                         modplug.cpp
  8.1907 + 
  8.1908 + libmodplugincludedir = $(includedir)/libmodplug
  8.1909 +-libmodpluginclude_HEADERS = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h modplug.h
  8.1910 ++@EXPORT_CXX_TRUE@HEADERS_CXX = libmodplug/stdafx.h libmodplug/sndfile.h libmodplug/it_defs.h
  8.1911 ++libmodpluginclude_HEADERS = modplug.h $(HEADERS_CXX)
  8.1912 + noinst_HEADERS = load_pat.h
  8.1913 + all: config.h
  8.1914 + 	$(MAKE) $(AM_MAKEFLAGS) all-am
  8.1915 +@@ -507,7 +510,6 @@
  8.1916 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_dsm.Plo@am__quote@
  8.1917 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_far.Plo@am__quote@
  8.1918 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_it.Plo@am__quote@
  8.1919 +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_j2b.Plo@am__quote@
  8.1920 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_mdl.Plo@am__quote@
  8.1921 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_med.Plo@am__quote@
  8.1922 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_mid.Plo@am__quote@
  8.1923 +
     9.1 --- a/external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h	Wed Dec 04 18:50:02 2019 +0300
     9.2 +++ b/external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h	Thu Dec 05 01:41:50 2019 +0300
     9.3 @@ -34,8 +34,7 @@
     9.4  
     9.5  #define WIN32_LEAN_AND_MEAN
     9.6  #include <windows.h>
     9.7 -#include <windowsx.h>
     9.8 -#include <mmsystem.h>
     9.9 +#include <mmsystem.h> /* for WAVE_FORMAT_PCM */
    9.10  #include <stdio.h>
    9.11  #include <malloc.h>
    9.12  #if defined(_MSC_VER) && (_MSC_VER < 1600)
    9.13 @@ -49,11 +48,9 @@
    9.14  #include <stdint.h>
    9.15  #endif
    9.16  
    9.17 -#define srandom(_seed)  srand(_seed)
    9.18 -#define random()        rand()
    9.19 -#define sleep(_ms)      Sleep(_ms)
    9.20 +#define sleep(_ms)      Sleep(_ms * 1000)
    9.21  
    9.22 -inline void ProcessPlugins(int n) {}
    9.23 +inline void ProcessPlugins(int n) { (void)n; }
    9.24  
    9.25  #undef strcasecmp
    9.26  #undef strncasecmp
    9.27 @@ -77,11 +74,6 @@
    9.28  #include <malloc.h>
    9.29  #endif
    9.30  
    9.31 -#ifdef __WATCOMC__
    9.32 -#define srandom(_seed)  srand(_seed)
    9.33 -#define random()        rand()
    9.34 -#endif
    9.35 -
    9.36  typedef int8_t CHAR;
    9.37  typedef uint8_t UCHAR;
    9.38  typedef uint8_t* PUCHAR;
    9.39 @@ -96,7 +88,7 @@
    9.40  typedef uint16_t WORD;
    9.41  typedef uint8_t BYTE;
    9.42  typedef uint8_t* LPBYTE;
    9.43 -typedef bool BOOL;
    9.44 +typedef bool BOOL; /* FIXME: must be 'int' */
    9.45  typedef char* LPSTR;
    9.46  typedef void* LPVOID;
    9.47  typedef uint16_t* LPWORD;
    9.48 @@ -112,17 +104,7 @@
    9.49  
    9.50  #define WAVE_FORMAT_PCM 1
    9.51  
    9.52 -#define  GHND   0
    9.53 -#define GlobalFreePtr(p) free((void *)(p))
    9.54 -inline int8_t * GlobalAllocPtr(unsigned int, size_t size)
    9.55 -{
    9.56 -  int8_t * p = (int8_t *) malloc(size);
    9.57 -
    9.58 -  if (p != NULL) memset(p, 0, size);
    9.59 -  return p;
    9.60 -}
    9.61 -
    9.62 -inline void ProcessPlugins(int n) {}
    9.63 +inline void ProcessPlugins(int n) { (void)n; }
    9.64  
    9.65  #ifndef FALSE
    9.66  #define FALSE	false
    10.1 --- a/external/libmodplug-0.8.9.0/src/load_abc.cpp	Wed Dec 04 18:50:02 2019 +0300
    10.2 +++ b/external/libmodplug-0.8.9.0/src/load_abc.cpp	Thu Dec 05 01:41:50 2019 +0300
    10.3 @@ -31,8 +31,8 @@
    10.4  #include <math.h>
    10.5  #include <ctype.h>
    10.6  #ifndef _WIN32
    10.7 -#include <unistd.h> // for sleep
    10.8 -#endif // _WIN32
    10.9 +#include <unistd.h>  /* sleep() */
   10.10 +#endif
   10.11  
   10.12  #include "stdafx.h"
   10.13  #include "sndfile.h"
   10.14 @@ -2370,8 +2370,8 @@
   10.15  		}
   10.16  	}
   10.17  	else {
   10.18 -		srandom((uint32_t)time(0));	// initialize random generator with seed
   10.19 -		retval->pickrandom = 1+(int)(10000.0*random()/(RAND_MAX+1.0));
   10.20 +		srand((unsigned int)time(0));	// initialize random generator with seed
   10.21 +		retval->pickrandom = 1+(int)(10000.0*rand()/(RAND_MAX+1.0));
   10.22  		// can handle pickin' from songbooks with 10.000 songs
   10.23  		sprintf(buf,"%s=-%ld",ABC_ENV_NORANDOMPICK,retval->pickrandom); // xmms preloads the file
   10.24  		putenv(buf);
    11.1 --- a/external/libmodplug-0.8.9.0/src/load_mid.cpp	Wed Dec 04 18:50:02 2019 +0300
    11.2 +++ b/external/libmodplug-0.8.9.0/src/load_mid.cpp	Thu Dec 05 01:41:50 2019 +0300
    11.3 @@ -30,7 +30,7 @@
    11.4  #include <math.h>
    11.5  #include <ctype.h>
    11.6  #ifndef _WIN32
    11.7 -#include <unistd.h> // for sleep
    11.8 +#include <unistd.h> /* sleep() */
    11.9  #endif
   11.10  
   11.11  #include "stdafx.h"
    12.1 --- a/external/libmodplug-0.8.9.0/src/load_pat.cpp	Wed Dec 04 18:50:02 2019 +0300
    12.2 +++ b/external/libmodplug-0.8.9.0/src/load_pat.cpp	Thu Dec 05 01:41:50 2019 +0300
    12.3 @@ -33,9 +33,9 @@
    12.4  #include <string.h>
    12.5  #include <math.h>
    12.6  #include <ctype.h>
    12.7 -#include <limits.h> // for PATH_MAX
    12.8 +#include <limits.h> /* PATH_MAX */
    12.9  #ifndef _WIN32
   12.10 -#include <unistd.h> // for sleep
   12.11 +#include <unistd.h>  /* sleep() */
   12.12  #endif
   12.13  
   12.14  #include "stdafx.h"
    13.1 --- a/external/libmodplug-0.8.9.0/src/mmcmp.cpp	Wed Dec 04 18:50:02 2019 +0300
    13.2 +++ b/external/libmodplug-0.8.9.0/src/mmcmp.cpp	Thu Dec 05 01:41:50 2019 +0300
    13.3 @@ -176,7 +176,7 @@
    13.4  	 || (!pmmh->nblocks) || (pmmh->filesize < 16) || (pmmh->filesize > 0x8000000)
    13.5  	 || (pmmh->blktable >= dwMemLength) || (pmmh->blktable + 4*pmmh->nblocks > dwMemLength)) return FALSE;
    13.6  	dwFileSize = pmmh->filesize;
    13.7 -	if ((pBuffer = (LPBYTE)GlobalAllocPtr(GHND, (dwFileSize + 31) & ~15)) == NULL) return FALSE;
    13.8 +	if ((pBuffer = (LPBYTE)calloc(1, (dwFileSize + 31) & ~15)) == NULL) return FALSE;
    13.9  	pblk_table = (const DWORD *)(lpMemFile+pmmh->blktable);
   13.10  	for (UINT nBlock=0; nBlock<pmmh->nblocks; nBlock++)
   13.11  	{
   13.12 @@ -383,7 +383,7 @@
   13.13  			}
   13.14  		} else
   13.15  		{
   13.16 -			GlobalFreePtr(pBuffer);
   13.17 +			free(pBuffer);
   13.18  			return FALSE;
   13.19  		}
   13.20  	}
   13.21 @@ -496,7 +496,7 @@
   13.22  	dwDstLen = (lpMemFile[dwMemLength-4]<<16) | (lpMemFile[dwMemLength-3]<<8) | (lpMemFile[dwMemLength-2]);
   13.23  	//Log("PP20 detected: Packed length=%d, Unpacked length=%d\n", dwMemLength, dwDstLen);
   13.24  	if ((dwDstLen < 512) || (dwDstLen > 0x400000) || (dwDstLen > 16*dwMemLength)) return FALSE;
   13.25 -	if ((pBuffer = (LPBYTE)GlobalAllocPtr(GHND, (dwDstLen + 31) & ~15)) == NULL) return FALSE;
   13.26 +	if ((pBuffer = (LPBYTE)calloc(1, (dwDstLen + 31) & ~15)) == NULL) return FALSE;
   13.27  	PP20_DoUnpack(lpMemFile+4, dwMemLength-4, pBuffer, dwDstLen);
   13.28  	*ppMemFile = pBuffer;
   13.29  	*pdwMemLength = dwDstLen;
    14.1 --- a/external/libmodplug-0.8.9.0/src/sndfile.cpp	Wed Dec 04 18:50:02 2019 +0300
    14.2 +++ b/external/libmodplug-0.8.9.0/src/sndfile.cpp	Thu Dec 05 01:41:50 2019 +0300
    14.3 @@ -152,7 +152,7 @@
    14.4  #ifdef MMCMP_SUPPORT
    14.5  		if (bMMCmp)
    14.6  		{
    14.7 -			GlobalFreePtr(lpStream);
    14.8 +			free((void*)lpStream);
    14.9  			lpStream = NULL;
   14.10  		}
   14.11  #endif
   14.12 @@ -339,7 +339,7 @@
   14.13  signed char* CSoundFile::AllocateSample(UINT nbytes)
   14.14  //-------------------------------------------
   14.15  {
   14.16 -	signed char * p = (signed char *)GlobalAllocPtr(GHND, (nbytes+39) & ~7);
   14.17 +	signed char * p = (signed char *)calloc(1, (nbytes+39) & ~7);
   14.18  	if (p) p += 16;
   14.19  	return p;
   14.20  }
   14.21 @@ -348,9 +348,8 @@
   14.22  void CSoundFile::FreeSample(LPVOID p)
   14.23  //-----------------------------------
   14.24  {
   14.25 -	if (p)
   14.26 -	{
   14.27 -		GlobalFreePtr(((LPSTR)p)-16);
   14.28 +	if (p) {
   14.29 +		free((char*)p - 16);
   14.30  	}
   14.31  }
   14.32  
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/external/opus-1.3.1/0004-opus.git-8493bf50.patch	Thu Dec 05 01:41:50 2019 +0300
    15.3 @@ -0,0 +1,28 @@
    15.4 +From: Felicia Lim <flim@google.com>
    15.5 +Date: Tue, 3 Dec 2019 00:37:14 +0000 (-0800)
    15.6 +Subject: Don't update null data pointer after each multistream decoder
    15.7 +X-Git-Url: http://git.xiph.org/?p=opus.git;a=commitdiff_plain;h=8493bf50892be0e902a354444747e6d14f2a6a10
    15.8 +
    15.9 +Don't update null data pointer after each multistream decoder
   15.10 +
   15.11 +The data pointer could be null in the case of DTX or packet loss.
   15.12 +---
   15.13 +
   15.14 +diff --git a/src/opus_multistream_decoder.c b/src/opus_multistream_decoder.c
   15.15 +index 0018517a..a2837c35 100644
   15.16 +--- a/src/opus_multistream_decoder.c
   15.17 ++++ b/src/opus_multistream_decoder.c
   15.18 +@@ -251,8 +251,11 @@ int opus_multistream_decode_native(
   15.19 +       }
   15.20 +       packet_offset = 0;
   15.21 +       ret = opus_decode_native(dec, data, len, buf, frame_size, decode_fec, s!=st->layout.nb_streams-1, &packet_offset, soft_clip);
   15.22 +-      data += packet_offset;
   15.23 +-      len -= packet_offset;
   15.24 ++      if (!do_plc)
   15.25 ++      {
   15.26 ++        data += packet_offset;
   15.27 ++        len -= packet_offset;
   15.28 ++      }
   15.29 +       if (ret <= 0)
   15.30 +       {
   15.31 +          RESTORE_STACK;
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/external/opus-1.3.1/celt/arm/celt_pitch_xcorr_arm-gnu.S	Thu Dec 05 01:41:50 2019 +0300
    16.3 @@ -0,0 +1,555 @@
    16.4 +    .syntax unified
    16.5 +@ Copyright (c) 2007-2008 CSIRO
    16.6 +@ Copyright (c) 2007-2009 Xiph.Org Foundation
    16.7 +@ Copyright (c) 2013      Parrot
    16.8 +@ Written by Aurélien Zanelli
    16.9 +@
   16.10 +@ Redistribution and use in source and binary forms, with or without
   16.11 +@ modification, are permitted provided that the following conditions
   16.12 +@ are met:
   16.13 +@
   16.14 +@ - Redistributions of source code must retain the above copyright
   16.15 +@ notice, this list of conditions and the following disclaimer.
   16.16 +@
   16.17 +@ - Redistributions in binary form must reproduce the above copyright
   16.18 +@ notice, this list of conditions and the following disclaimer in the
   16.19 +@ documentation and/or other materials provided with the distribution.
   16.20 +@
   16.21 +@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   16.22 +@ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   16.23 +@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   16.24 +@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
   16.25 +@ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   16.26 +@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   16.27 +@ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   16.28 +@ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   16.29 +@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   16.30 +@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   16.31 +@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   16.32 +
   16.33 +    .text;   .p2align 2;   .arch armv7-a
   16.34 +   .fpu neon
   16.35 +   .object_arch armv4t
   16.36 +
   16.37 +  .include "celt/arm/armopts-gnu.S"
   16.38 +
   16.39 + .if OPUS_ARM_MAY_HAVE_EDSP
   16.40 +  .global celt_pitch_xcorr_edsp
   16.41 + .endif
   16.42 +
   16.43 + .if OPUS_ARM_MAY_HAVE_NEON
   16.44 +  .global celt_pitch_xcorr_neon
   16.45 + .endif
   16.46 +
   16.47 + .if OPUS_ARM_MAY_HAVE_NEON
   16.48 +
   16.49 +@ Compute sum[k]=sum(x[j]*y[j+k],j=0...len-1), k=0...3
   16.50 +	.type	xcorr_kernel_neon, %function; xcorr_kernel_neon: @ PROC
   16.51 +xcorr_kernel_neon_start:
   16.52 +  @ input:
   16.53 +  @   r3     = int         len
   16.54 +  @   r4     = opus_val16 *x
   16.55 +  @   r5     = opus_val16 *y
   16.56 +  @   q0     = opus_val32  sum[4]
   16.57 +  @ output:
   16.58 +  @   q0     = opus_val32  sum[4]
   16.59 +  @ preserved: r0-r3, r6-r11, d2, q4-q7, q9-q15
   16.60 +  @ internal usage:
   16.61 +  @   r12 = int j
   16.62 +  @   d3  = y_3|y_2|y_1|y_0
   16.63 +  @   q2  = y_B|y_A|y_9|y_8|y_7|y_6|y_5|y_4
   16.64 +  @   q3  = x_7|x_6|x_5|x_4|x_3|x_2|x_1|x_0
   16.65 +  @   q8  = scratch
   16.66 +  @
   16.67 +  @ Load y[0...3]
   16.68 +  @ This requires len>0 to always be valid (which we assert in the C code).
   16.69 +  VLD1.16      {d5}, [r5]!
   16.70 +  SUBS         r12, r3, #8
   16.71 +  BLE xcorr_kernel_neon_process4
   16.72 +@ Process 8 samples at a time.
   16.73 +@ This loop loads one y value more than we actually need. Therefore we have to
   16.74 +@ stop as soon as there are 8 or fewer samples left (instead of 7), to avoid
   16.75 +@ reading past the end of the array.
   16.76 +xcorr_kernel_neon_process8:
   16.77 +  @ This loop has 19 total instructions (10 cycles to issue, minimum), with
   16.78 +  @ - 2 cycles of ARM insrtuctions,
   16.79 +  @ - 10 cycles of load/store/byte permute instructions, and
   16.80 +  @ - 9 cycles of data processing instructions.
   16.81 +  @ On a Cortex A8, we dual-issue the maximum amount (9 cycles) between the
   16.82 +  @ latter two categories, meaning the whole loop should run in 10 cycles per
   16.83 +  @ iteration, barring cache misses.
   16.84 +  @
   16.85 +  @ Load x[0...7]
   16.86 +  VLD1.16      {d6, d7}, [r4]!
   16.87 +  @ Unlike VMOV, VAND is a data processsing instruction (and doesn't get
   16.88 +  @ assembled to VMOV, like VORR would), so it dual-issues with the prior VLD1.
   16.89 +  VAND         d3, d5, d5
   16.90 +  SUBS         r12, r12, #8
   16.91 +  @ Load y[4...11]
   16.92 +  VLD1.16      {d4, d5}, [r5]!
   16.93 +  VMLAL.S16    q0, d3, d6[0]
   16.94 +  VEXT.16      d16, d3, d4, #1
   16.95 +  VMLAL.S16    q0, d4, d7[0]
   16.96 +  VEXT.16      d17, d4, d5, #1
   16.97 +  VMLAL.S16    q0, d16, d6[1]
   16.98 +  VEXT.16      d16, d3, d4, #2
   16.99 +  VMLAL.S16    q0, d17, d7[1]
  16.100 +  VEXT.16      d17, d4, d5, #2
  16.101 +  VMLAL.S16    q0, d16, d6[2]
  16.102 +  VEXT.16      d16, d3, d4, #3
  16.103 +  VMLAL.S16    q0, d17, d7[2]
  16.104 +  VEXT.16      d17, d4, d5, #3
  16.105 +  VMLAL.S16    q0, d16, d6[3]
  16.106 +  VMLAL.S16    q0, d17, d7[3]
  16.107 +  BGT xcorr_kernel_neon_process8
  16.108 +@ Process 4 samples here if we have > 4 left (still reading one extra y value).
  16.109 +xcorr_kernel_neon_process4:
  16.110 +  ADDS         r12, r12, #4
  16.111 +  BLE xcorr_kernel_neon_process2
  16.112 +  @ Load x[0...3]
  16.113 +  VLD1.16      d6, [r4]!
  16.114 +  @ Use VAND since it's a data processing instruction again.
  16.115 +  VAND         d4, d5, d5
  16.116 +  SUB          r12, r12, #4
  16.117 +  @ Load y[4...7]
  16.118 +  VLD1.16      d5, [r5]!
  16.119 +  VMLAL.S16    q0, d4, d6[0]
  16.120 +  VEXT.16      d16, d4, d5, #1
  16.121 +  VMLAL.S16    q0, d16, d6[1]
  16.122 +  VEXT.16      d16, d4, d5, #2
  16.123 +  VMLAL.S16    q0, d16, d6[2]
  16.124 +  VEXT.16      d16, d4, d5, #3
  16.125 +  VMLAL.S16    q0, d16, d6[3]
  16.126 +@ Process 2 samples here if we have > 2 left (still reading one extra y value).
  16.127 +xcorr_kernel_neon_process2:
  16.128 +  ADDS         r12, r12, #2
  16.129 +  BLE xcorr_kernel_neon_process1
  16.130 +  @ Load x[0...1]
  16.131 +  VLD2.16      {d6[],d7[]}, [r4]!
  16.132 +  @ Use VAND since it's a data processing instruction again.
  16.133 +  VAND         d4, d5, d5
  16.134 +  SUB          r12, r12, #2
  16.135 +  @ Load y[4...5]
  16.136 +  VLD1.32      {d5[]}, [r5]!
  16.137 +  VMLAL.S16    q0, d4, d6
  16.138 +  VEXT.16      d16, d4, d5, #1
  16.139 +  @ Replace bottom copy of {y5,y4} in d5 with {y3,y2} from d4, using VSRI
  16.140 +  @ instead of VEXT, since it's a data-processing instruction.
  16.141 +  VSRI.64      d5, d4, #32
  16.142 +  VMLAL.S16    q0, d16, d7
  16.143 +@ Process 1 sample using the extra y value we loaded above.
  16.144 +xcorr_kernel_neon_process1:
  16.145 +  @ Load next *x
  16.146 +  VLD1.16      {d6[]}, [r4]!
  16.147 +  ADDS         r12, r12, #1
  16.148 +  @ y[0...3] are left in d5 from prior iteration(s) (if any)
  16.149 +  VMLAL.S16    q0, d5, d6
  16.150 +  MOVLE        pc, lr
  16.151 +@ Now process 1 last sample, not reading ahead.
  16.152 +  @ Load last *y
  16.153 +  VLD1.16      {d4[]}, [r5]!
  16.154 +  VSRI.64      d4, d5, #16
  16.155 +  @ Load last *x
  16.156 +  VLD1.16      {d6[]}, [r4]!
  16.157 +  VMLAL.S16    q0, d4, d6
  16.158 +  MOV          pc, lr
  16.159 +	.size xcorr_kernel_neon, .-xcorr_kernel_neon  @ ENDP
  16.160 +
  16.161 +@ opus_val32 celt_pitch_xcorr_neon(opus_val16 *_x, opus_val16 *_y,
  16.162 +@  opus_val32 *xcorr, int len, int max_pitch, int arch)
  16.163 +	.type	celt_pitch_xcorr_neon, %function; celt_pitch_xcorr_neon: @ PROC
  16.164 +  @ input:
  16.165 +  @   r0  = opus_val16 *_x
  16.166 +  @   r1  = opus_val16 *_y
  16.167 +  @   r2  = opus_val32 *xcorr
  16.168 +  @   r3  = int         len
  16.169 +  @ output:
  16.170 +  @   r0  = int         maxcorr
  16.171 +  @ internal usage:
  16.172 +  @   r4  = opus_val16 *x (for xcorr_kernel_neon())
  16.173 +  @   r5  = opus_val16 *y (for xcorr_kernel_neon())
  16.174 +  @   r6  = int         max_pitch
  16.175 +  @   r12 = int         j
  16.176 +  @   q15 = int         maxcorr[4] (q15 is not used by xcorr_kernel_neon())
  16.177 +  @ ignored:
  16.178 +  @         int         arch
  16.179 +  STMFD        sp!, {r4-r6, lr}
  16.180 +  LDR          r6, [sp, #16]
  16.181 +  VMOV.S32     q15, #1
  16.182 +  @ if (max_pitch < 4) goto celt_pitch_xcorr_neon_process4_done
  16.183 +  SUBS         r6, r6, #4
  16.184 +  BLT celt_pitch_xcorr_neon_process4_done
  16.185 +celt_pitch_xcorr_neon_process4:
  16.186 +  @ xcorr_kernel_neon parameters:
  16.187 +  @ r3 = len, r4 = _x, r5 = _y, q0 = {0, 0, 0, 0}
  16.188 +  MOV          r4, r0
  16.189 +  MOV          r5, r1
  16.190 +  VEOR         q0, q0, q0
  16.191 +  @ xcorr_kernel_neon only modifies r4, r5, r12, and q0...q3.
  16.192 +  @ So we don't save/restore any other registers.
  16.193 +  BL xcorr_kernel_neon_start
  16.194 +  SUBS         r6, r6, #4
  16.195 +  VST1.32      {q0}, [r2]!
  16.196 +  @ _y += 4
  16.197 +  ADD          r1, r1, #8
  16.198 +  VMAX.S32     q15, q15, q0
  16.199 +  @ if (max_pitch < 4) goto celt_pitch_xcorr_neon_process4_done
  16.200 +  BGE celt_pitch_xcorr_neon_process4
  16.201 +@ We have less than 4 sums left to compute.
  16.202 +celt_pitch_xcorr_neon_process4_done:
  16.203 +  ADDS         r6, r6, #4
  16.204 +  @ Reduce maxcorr to a single value
  16.205 +  VMAX.S32     d30, d30, d31
  16.206 +  VPMAX.S32    d30, d30, d30
  16.207 +  @ if (max_pitch <= 0) goto celt_pitch_xcorr_neon_done
  16.208 +  BLE celt_pitch_xcorr_neon_done
  16.209 +@ Now compute each remaining sum one at a time.
  16.210 +celt_pitch_xcorr_neon_process_remaining:
  16.211 +  MOV          r4, r0
  16.212 +  MOV          r5, r1
  16.213 +  VMOV.I32     q0, #0
  16.214 +  SUBS         r12, r3, #8
  16.215 +  BLT celt_pitch_xcorr_neon_process_remaining4
  16.216 +@ Sum terms 8 at a time.
  16.217 +celt_pitch_xcorr_neon_process_remaining_loop8:
  16.218 +  @ Load x[0...7]
  16.219 +  VLD1.16      {q1}, [r4]!
  16.220 +  @ Load y[0...7]
  16.221 +  VLD1.16      {q2}, [r5]!
  16.222 +  SUBS         r12, r12, #8
  16.223 +  VMLAL.S16    q0, d4, d2
  16.224 +  VMLAL.S16    q0, d5, d3
  16.225 +  BGE celt_pitch_xcorr_neon_process_remaining_loop8
  16.226 +@ Sum terms 4 at a time.
  16.227 +celt_pitch_xcorr_neon_process_remaining4:
  16.228 +  ADDS         r12, r12, #4
  16.229 +  BLT celt_pitch_xcorr_neon_process_remaining4_done
  16.230 +  @ Load x[0...3]
  16.231 +  VLD1.16      {d2}, [r4]!
  16.232 +  @ Load y[0...3]
  16.233 +  VLD1.16      {d3}, [r5]!
  16.234 +  SUB          r12, r12, #4
  16.235 +  VMLAL.S16    q0, d3, d2
  16.236 +celt_pitch_xcorr_neon_process_remaining4_done:
  16.237 +  @ Reduce the sum to a single value.
  16.238 +  VADD.S32     d0, d0, d1
  16.239 +  VPADDL.S32   d0, d0
  16.240 +  ADDS         r12, r12, #4
  16.241 +  BLE celt_pitch_xcorr_neon_process_remaining_loop_done
  16.242 +@ Sum terms 1 at a time.
  16.243 +celt_pitch_xcorr_neon_process_remaining_loop1:
  16.244 +  VLD1.16      {d2[]}, [r4]!
  16.245 +  VLD1.16      {d3[]}, [r5]!
  16.246 +  SUBS         r12, r12, #1
  16.247 +  VMLAL.S16    q0, d2, d3
  16.248 +  BGT celt_pitch_xcorr_neon_process_remaining_loop1
  16.249 +celt_pitch_xcorr_neon_process_remaining_loop_done:
  16.250 +  VST1.32      {d0[0]}, [r2]!
  16.251 +  VMAX.S32     d30, d30, d0
  16.252 +  SUBS         r6, r6, #1
  16.253 +  @ _y++
  16.254 +  ADD          r1, r1, #2
  16.255 +  @ if (--max_pitch > 0) goto celt_pitch_xcorr_neon_process_remaining
  16.256 +  BGT celt_pitch_xcorr_neon_process_remaining
  16.257 +celt_pitch_xcorr_neon_done:
  16.258 +  VMOV.32      r0, d30[0]
  16.259 +  LDMFD        sp!, {r4-r6, pc}
  16.260 +	.size celt_pitch_xcorr_neon, .-celt_pitch_xcorr_neon  @ ENDP
  16.261 +
  16.262 + .endif
  16.263 +
  16.264 + .if OPUS_ARM_MAY_HAVE_EDSP
  16.265 +
  16.266 +@ This will get used on ARMv7 devices without NEON, so it has been optimized
  16.267 +@ to take advantage of dual-issuing where possible.
  16.268 +	.type	xcorr_kernel_edsp, %function; xcorr_kernel_edsp: @ PROC
  16.269 +xcorr_kernel_edsp_start:
  16.270 +  @ input:
  16.271 +  @   r3      = int         len
  16.272 +  @   r4      = opus_val16 *_x (must be 32-bit aligned)
  16.273 +  @   r5      = opus_val16 *_y (must be 32-bit aligned)
  16.274 +  @   r6...r9 = opus_val32  sum[4]
  16.275 +  @ output:
  16.276 +  @   r6...r9 = opus_val32  sum[4]
  16.277 +  @ preserved: r0-r5
  16.278 +  @ internal usage
  16.279 +  @   r2      = int         j
  16.280 +  @   r12,r14 = opus_val16  x[4]
  16.281 +  @   r10,r11 = opus_val16  y[4]
  16.282 +  STMFD        sp!, {r2,r4,r5,lr}
  16.283 +  LDR          r10, [r5], #4      @ Load y[0...1]
  16.284 +  SUBS         r2, r3, #4         @ j = len-4
  16.285 +  LDR          r11, [r5], #4      @ Load y[2...3]
  16.286 +  BLE xcorr_kernel_edsp_process4_done
  16.287 +  LDR          r12, [r4], #4      @ Load x[0...1]
  16.288 +  @ Stall
  16.289 +xcorr_kernel_edsp_process4:
  16.290 +  @ The multiplies must issue from pipeline 0, and can't dual-issue with each
  16.291 +  @ other. Every other instruction here dual-issues with a multiply, and is
  16.292 +  @ thus "free". There should be no stalls in the body of the loop.
  16.293 +  SMLABB       r6, r12, r10, r6   @ sum[0] = MAC16_16(sum[0],x_0,y_0)
  16.294 +  LDR          r14, [r4], #4      @ Load x[2...3]
  16.295 +  SMLABT       r7, r12, r10, r7   @ sum[1] = MAC16_16(sum[1],x_0,y_1)
  16.296 +  SUBS         r2, r2, #4         @ j-=4
  16.297 +  SMLABB       r8, r12, r11, r8   @ sum[2] = MAC16_16(sum[2],x_0,y_2)
  16.298 +  SMLABT       r9, r12, r11, r9   @ sum[3] = MAC16_16(sum[3],x_0,y_3)
  16.299 +  SMLATT       r6, r12, r10, r6   @ sum[0] = MAC16_16(sum[0],x_1,y_1)
  16.300 +  LDR          r10, [r5], #4      @ Load y[4...5]
  16.301 +  SMLATB       r7, r12, r11, r7   @ sum[1] = MAC16_16(sum[1],x_1,y_2)
  16.302 +  SMLATT       r8, r12, r11, r8   @ sum[2] = MAC16_16(sum[2],x_1,y_3)
  16.303 +  SMLATB       r9, r12, r10, r9   @ sum[3] = MAC16_16(sum[3],x_1,y_4)
  16.304 +  LDRGT        r12, [r4], #4      @ Load x[0...1]
  16.305 +  SMLABB       r6, r14, r11, r6   @ sum[0] = MAC16_16(sum[0],x_2,y_2)
  16.306 +  SMLABT       r7, r14, r11, r7   @ sum[1] = MAC16_16(sum[1],x_2,y_3)
  16.307 +  SMLABB       r8, r14, r10, r8   @ sum[2] = MAC16_16(sum[2],x_2,y_4)
  16.308 +  SMLABT       r9, r14, r10, r9   @ sum[3] = MAC16_16(sum[3],x_2,y_5)
  16.309 +  SMLATT       r6, r14, r11, r6   @ sum[0] = MAC16_16(sum[0],x_3,y_3)
  16.310 +  LDR          r11, [r5], #4      @ Load y[6...7]
  16.311 +  SMLATB       r7, r14, r10, r7   @ sum[1] = MAC16_16(sum[1],x_3,y_4)
  16.312 +  SMLATT       r8, r14, r10, r8   @ sum[2] = MAC16_16(sum[2],x_3,y_5)
  16.313 +  SMLATB       r9, r14, r11, r9   @ sum[3] = MAC16_16(sum[3],x_3,y_6)
  16.314 +  BGT xcorr_kernel_edsp_process4
  16.315 +xcorr_kernel_edsp_process4_done:
  16.316 +  ADDS         r2, r2, #4
  16.317 +  BLE xcorr_kernel_edsp_done
  16.318 +  LDRH         r12, [r4], #2      @ r12 = *x++
  16.319 +  SUBS         r2, r2, #1         @ j--
  16.320 +  @ Stall
  16.321 +  SMLABB       r6, r12, r10, r6   @ sum[0] = MAC16_16(sum[0],x,y_0)
  16.322 +  LDRHGT       r14, [r4], #2      @ r14 = *x++
  16.323 +  SMLABT       r7, r12, r10, r7   @ sum[1] = MAC16_16(sum[1],x,y_1)
  16.324 +  SMLABB       r8, r12, r11, r8   @ sum[2] = MAC16_16(sum[2],x,y_2)
  16.325 +  SMLABT       r9, r12, r11, r9   @ sum[3] = MAC16_16(sum[3],x,y_3)
  16.326 +  BLE xcorr_kernel_edsp_done
  16.327 +  SMLABT       r6, r14, r10, r6   @ sum[0] = MAC16_16(sum[0],x,y_1)
  16.328 +  SUBS         r2, r2, #1         @ j--
  16.329 +  SMLABB       r7, r14, r11, r7   @ sum[1] = MAC16_16(sum[1],x,y_2)
  16.330 +  LDRH         r10, [r5], #2      @ r10 = y_4 = *y++
  16.331 +  SMLABT       r8, r14, r11, r8   @ sum[2] = MAC16_16(sum[2],x,y_3)
  16.332 +  LDRHGT       r12, [r4], #2      @ r12 = *x++
  16.333 +  SMLABB       r9, r14, r10, r9   @ sum[3] = MAC16_16(sum[3],x,y_4)
  16.334 +  BLE xcorr_kernel_edsp_done
  16.335 +  SMLABB       r6, r12, r11, r6   @ sum[0] = MAC16_16(sum[0],tmp,y_2)
  16.336 +  CMP          r2, #1             @ j--
  16.337 +  SMLABT       r7, r12, r11, r7   @ sum[1] = MAC16_16(sum[1],tmp,y_3)
  16.338 +  LDRH         r2, [r5], #2       @ r2 = y_5 = *y++
  16.339 +  SMLABB       r8, r12, r10, r8   @ sum[2] = MAC16_16(sum[2],tmp,y_4)
  16.340 +  LDRHGT       r14, [r4]          @ r14 = *x
  16.341 +  SMLABB       r9, r12, r2, r9    @ sum[3] = MAC16_16(sum[3],tmp,y_5)
  16.342 +  BLE xcorr_kernel_edsp_done
  16.343 +  SMLABT       r6, r14, r11, r6   @ sum[0] = MAC16_16(sum[0],tmp,y_3)
  16.344 +  LDRH         r11, [r5]          @ r11 = y_6 = *y
  16.345 +  SMLABB       r7, r14, r10, r7   @ sum[1] = MAC16_16(sum[1],tmp,y_4)
  16.346 +  SMLABB       r8, r14, r2, r8    @ sum[2] = MAC16_16(sum[2],tmp,y_5)
  16.347 +  SMLABB       r9, r14, r11, r9   @ sum[3] = MAC16_16(sum[3],tmp,y_6)
  16.348 +xcorr_kernel_edsp_done:
  16.349 +  LDMFD        sp!, {r2,r4,r5,pc}
  16.350 +	.size xcorr_kernel_edsp, .-xcorr_kernel_edsp  @ ENDP
  16.351 +
  16.352 +	.type	celt_pitch_xcorr_edsp, %function; celt_pitch_xcorr_edsp: @ PROC
  16.353 +  @ input:
  16.354 +  @   r0  = opus_val16 *_x (must be 32-bit aligned)
  16.355 +  @   r1  = opus_val16 *_y (only needs to be 16-bit aligned)
  16.356 +  @   r2  = opus_val32 *xcorr
  16.357 +  @   r3  = int         len
  16.358 +  @ output:
  16.359 +  @   r0  = maxcorr
  16.360 +  @ internal usage
  16.361 +  @   r4  = opus_val16 *x
  16.362 +  @   r5  = opus_val16 *y
  16.363 +  @   r6  = opus_val32  sum0
  16.364 +  @   r7  = opus_val32  sum1
  16.365 +  @   r8  = opus_val32  sum2
  16.366 +  @   r9  = opus_val32  sum3
  16.367 +  @   r1  = int         max_pitch
  16.368 +  @   r12 = int         j
  16.369 +  @ ignored:
  16.370 +  @         int         arch
  16.371 +  STMFD        sp!, {r4-r11, lr}
  16.372 +  MOV          r5, r1
  16.373 +  LDR          r1, [sp, #36]
  16.374 +  MOV          r4, r0
  16.375 +  TST          r5, #3
  16.376 +  @ maxcorr = 1
  16.377 +  MOV          r0, #1
  16.378 +  BEQ          celt_pitch_xcorr_edsp_process1u_done
  16.379 +@ Compute one sum at the start to make y 32-bit aligned.
  16.380 +  SUBS         r12, r3, #4
  16.381 +  @ r14 = sum = 0
  16.382 +  MOV          r14, #0
  16.383 +  LDRH         r8, [r5], #2
  16.384 +  BLE celt_pitch_xcorr_edsp_process1u_loop4_done
  16.385 +  LDR          r6, [r4], #4
  16.386 +  MOV          r8, r8, LSL #16
  16.387 +celt_pitch_xcorr_edsp_process1u_loop4:
  16.388 +  LDR          r9, [r5], #4
  16.389 +  SMLABT       r14, r6, r8, r14     @ sum = MAC16_16(sum, x_0, y_0)
  16.390 +  LDR          r7, [r4], #4
  16.391 +  SMLATB       r14, r6, r9, r14     @ sum = MAC16_16(sum, x_1, y_1)
  16.392 +  LDR          r8, [r5], #4
  16.393 +  SMLABT       r14, r7, r9, r14     @ sum = MAC16_16(sum, x_2, y_2)
  16.394 +  SUBS         r12, r12, #4         @ j-=4
  16.395 +  SMLATB       r14, r7, r8, r14     @ sum = MAC16_16(sum, x_3, y_3)
  16.396 +  LDRGT        r6, [r4], #4
  16.397 +  BGT celt_pitch_xcorr_edsp_process1u_loop4
  16.398 +  MOV          r8, r8, LSR #16
  16.399 +celt_pitch_xcorr_edsp_process1u_loop4_done:
  16.400 +  ADDS         r12, r12, #4
  16.401 +celt_pitch_xcorr_edsp_process1u_loop1:
  16.402 +  LDRHGE       r6, [r4], #2
  16.403 +  @ Stall
  16.404 +  SMLABBGE     r14, r6, r8, r14    @ sum = MAC16_16(sum, *x, *y)
  16.405 +  SUBSGE       r12, r12, #1
  16.406 +  LDRHGT       r8, [r5], #2
  16.407 +  BGT celt_pitch_xcorr_edsp_process1u_loop1
  16.408 +  @ Restore _x
  16.409 +  SUB          r4, r4, r3, LSL #1
  16.410 +  @ Restore and advance _y
  16.411 +  SUB          r5, r5, r3, LSL #1
  16.412 +  @ maxcorr = max(maxcorr, sum)
  16.413 +  CMP          r0, r14
  16.414 +  ADD          r5, r5, #2
  16.415 +  MOVLT        r0, r14
  16.416 +  SUBS         r1, r1, #1
  16.417 +  @ xcorr[i] = sum
  16.418 +  STR          r14, [r2], #4
  16.419 +  BLE celt_pitch_xcorr_edsp_done
  16.420 +celt_pitch_xcorr_edsp_process1u_done:
  16.421 +  @ if (max_pitch < 4) goto celt_pitch_xcorr_edsp_process2
  16.422 +  SUBS         r1, r1, #4
  16.423 +  BLT celt_pitch_xcorr_edsp_process2
  16.424 +celt_pitch_xcorr_edsp_process4:
  16.425 +  @ xcorr_kernel_edsp parameters:
  16.426 +  @ r3 = len, r4 = _x, r5 = _y, r6...r9 = sum[4] = {0, 0, 0, 0}
  16.427 +  MOV          r6, #0
  16.428 +  MOV          r7, #0
  16.429 +  MOV          r8, #0
  16.430 +  MOV          r9, #0
  16.431 +  BL xcorr_kernel_edsp_start  @ xcorr_kernel_edsp(_x, _y+i, xcorr+i, len)
  16.432 +  @ maxcorr = max(maxcorr, sum0, sum1, sum2, sum3)
  16.433 +  CMP          r0, r6
  16.434 +  @ _y+=4
  16.435 +  ADD          r5, r5, #8
  16.436 +  MOVLT        r0, r6
  16.437 +  CMP          r0, r7
  16.438 +  MOVLT        r0, r7
  16.439 +  CMP          r0, r8
  16.440 +  MOVLT        r0, r8
  16.441 +  CMP          r0, r9
  16.442 +  MOVLT        r0, r9
  16.443 +  STMIA        r2!, {r6-r9}
  16.444 +  SUBS         r1, r1, #4
  16.445 +  BGE celt_pitch_xcorr_edsp_process4
  16.446 +celt_pitch_xcorr_edsp_process2:
  16.447 +  ADDS         r1, r1, #2
  16.448 +  BLT celt_pitch_xcorr_edsp_process1a
  16.449 +  SUBS         r12, r3, #4
  16.450 +  @ {r10, r11} = {sum0, sum1} = {0, 0}
  16.451 +  MOV          r10, #0
  16.452 +  MOV          r11, #0
  16.453 +  LDR          r8, [r5], #4
  16.454 +  BLE celt_pitch_xcorr_edsp_process2_loop_done
  16.455 +  LDR          r6, [r4], #4
  16.456 +  LDR          r9, [r5], #4
  16.457 +celt_pitch_xcorr_edsp_process2_loop4:
  16.458 +  SMLABB       r10, r6, r8, r10     @ sum0 = MAC16_16(sum0, x_0, y_0)
  16.459 +  LDR          r7, [r4], #4
  16.460 +  SMLABT       r11, r6, r8, r11     @ sum1 = MAC16_16(sum1, x_0, y_1)
  16.461 +  SUBS         r12, r12, #4         @ j-=4
  16.462 +  SMLATT       r10, r6, r8, r10     @ sum0 = MAC16_16(sum0, x_1, y_1)
  16.463 +  LDR          r8, [r5], #4
  16.464 +  SMLATB       r11, r6, r9, r11     @ sum1 = MAC16_16(sum1, x_1, y_2)
  16.465 +  LDRGT        r6, [r4], #4
  16.466 +  SMLABB       r10, r7, r9, r10     @ sum0 = MAC16_16(sum0, x_2, y_2)
  16.467 +  SMLABT       r11, r7, r9, r11     @ sum1 = MAC16_16(sum1, x_2, y_3)
  16.468 +  SMLATT       r10, r7, r9, r10     @ sum0 = MAC16_16(sum0, x_3, y_3)
  16.469 +  LDRGT        r9, [r5], #4
  16.470 +  SMLATB       r11, r7, r8, r11     @ sum1 = MAC16_16(sum1, x_3, y_4)
  16.471 +  BGT celt_pitch_xcorr_edsp_process2_loop4
  16.472 +celt_pitch_xcorr_edsp_process2_loop_done:
  16.473 +  ADDS         r12, r12, #2
  16.474 +  BLE  celt_pitch_xcorr_edsp_process2_1
  16.475 +  LDR          r6, [r4], #4
  16.476 +  @ Stall
  16.477 +  SMLABB       r10, r6, r8, r10     @ sum0 = MAC16_16(sum0, x_0, y_0)
  16.478 +  LDR          r9, [r5], #4
  16.479 +  SMLABT       r11, r6, r8, r11     @ sum1 = MAC16_16(sum1, x_0, y_1)
  16.480 +  SUB          r12, r12, #2
  16.481 +  SMLATT       r10, r6, r8, r10     @ sum0 = MAC16_16(sum0, x_1, y_1)
  16.482 +  MOV          r8, r9
  16.483 +  SMLATB       r11, r6, r9, r11     @ sum1 = MAC16_16(sum1, x_1, y_2)
  16.484 +celt_pitch_xcorr_edsp_process2_1:
  16.485 +  LDRH         r6, [r4], #2
  16.486 +  ADDS         r12, r12, #1
  16.487 +  @ Stall
  16.488 +  SMLABB       r10, r6, r8, r10     @ sum0 = MAC16_16(sum0, x_0, y_0)
  16.489 +  LDRHGT       r7, [r4], #2
  16.490 +  SMLABT       r11, r6, r8, r11     @ sum1 = MAC16_16(sum1, x_0, y_1)
  16.491 +  BLE celt_pitch_xcorr_edsp_process2_done
  16.492 +  LDRH         r9, [r5], #2
  16.493 +  SMLABT       r10, r7, r8, r10     @ sum0 = MAC16_16(sum0, x_0, y_1)
  16.494 +  SMLABB       r11, r7, r9, r11     @ sum1 = MAC16_16(sum1, x_0, y_2)
  16.495 +celt_pitch_xcorr_edsp_process2_done:
  16.496 +  @ Restore _x
  16.497 +  SUB          r4, r4, r3, LSL #1
  16.498 +  @ Restore and advance _y
  16.499 +  SUB          r5, r5, r3, LSL #1
  16.500 +  @ maxcorr = max(maxcorr, sum0)
  16.501 +  CMP          r0, r10
  16.502 +  ADD          r5, r5, #2
  16.503 +  MOVLT        r0, r10
  16.504 +  SUB          r1, r1, #2
  16.505 +  @ maxcorr = max(maxcorr, sum1)
  16.506 +  CMP          r0, r11
  16.507 +  @ xcorr[i] = sum
  16.508 +  STR          r10, [r2], #4
  16.509 +  MOVLT        r0, r11
  16.510 +  STR          r11, [r2], #4
  16.511 +celt_pitch_xcorr_edsp_process1a:
  16.512 +  ADDS         r1, r1, #1
  16.513 +  BLT celt_pitch_xcorr_edsp_done
  16.514 +  SUBS         r12, r3, #4
  16.515 +  @ r14 = sum = 0
  16.516 +  MOV          r14, #0
  16.517 +  BLT celt_pitch_xcorr_edsp_process1a_loop_done
  16.518 +  LDR          r6, [r4], #4
  16.519 +  LDR          r8, [r5], #4
  16.520 +  LDR          r7, [r4], #4
  16.521 +  LDR          r9, [r5], #4
  16.522 +celt_pitch_xcorr_edsp_process1a_loop4:
  16.523 +  SMLABB       r14, r6, r8, r14     @ sum = MAC16_16(sum, x_0, y_0)
  16.524 +  SUBS         r12, r12, #4         @ j-=4
  16.525 +  SMLATT       r14, r6, r8, r14     @ sum = MAC16_16(sum, x_1, y_1)
  16.526 +  LDRGE        r6, [r4], #4
  16.527 +  SMLABB       r14, r7, r9, r14     @ sum = MAC16_16(sum, x_2, y_2)
  16.528 +  LDRGE        r8, [r5], #4
  16.529 +  SMLATT       r14, r7, r9, r14     @ sum = MAC16_16(sum, x_3, y_3)
  16.530 +  LDRGE        r7, [r4], #4
  16.531 +  LDRGE        r9, [r5], #4
  16.532 +  BGE celt_pitch_xcorr_edsp_process1a_loop4
  16.533 +celt_pitch_xcorr_edsp_process1a_loop_done:
  16.534 +  ADDS         r12, r12, #2
  16.535 +  LDRGE        r6, [r4], #4
  16.536 +  LDRGE        r8, [r5], #4
  16.537 +  @ Stall
  16.538 +  SMLABBGE     r14, r6, r8, r14     @ sum = MAC16_16(sum, x_0, y_0)
  16.539 +  SUBGE        r12, r12, #2
  16.540 +  SMLATTGE     r14, r6, r8, r14     @ sum = MAC16_16(sum, x_1, y_1)
  16.541 +  ADDS         r12, r12, #1
  16.542 +  LDRHGE       r6, [r4], #2
  16.543 +  LDRHGE       r8, [r5], #2
  16.544 +  @ Stall
  16.545 +  SMLABBGE     r14, r6, r8, r14     @ sum = MAC16_16(sum, *x, *y)
  16.546 +  @ maxcorr = max(maxcorr, sum)
  16.547 +  CMP          r0, r14
  16.548 +  @ xcorr[i] = sum
  16.549 +  STR          r14, [r2], #4
  16.550 +  MOVLT        r0, r14
  16.551 +celt_pitch_xcorr_edsp_done:
  16.552 +  LDMFD        sp!, {r4-r11, pc}
  16.553 +	.size celt_pitch_xcorr_edsp, .-celt_pitch_xcorr_edsp  @ ENDP
  16.554 +
  16.555 + .endif
  16.556 +
  16.557 +@ END:
  16.558 +    .section	.note.GNU-stack,"",%progbits
    17.1 --- a/external/opus-1.3.1/src/opus_multistream_decoder.c	Wed Dec 04 18:50:02 2019 +0300
    17.2 +++ b/external/opus-1.3.1/src/opus_multistream_decoder.c	Thu Dec 05 01:41:50 2019 +0300
    17.3 @@ -251,8 +251,11 @@
    17.4        }
    17.5        packet_offset = 0;
    17.6        ret = opus_decode_native(dec, data, len, buf, frame_size, decode_fec, s!=st->layout.nb_streams-1, &packet_offset, soft_clip);
    17.7 -      data += packet_offset;
    17.8 -      len -= packet_offset;
    17.9 +      if (!do_plc)
   17.10 +      {
   17.11 +        data += packet_offset;
   17.12 +        len -= packet_offset;
   17.13 +      }
   17.14        if (ret <= 0)
   17.15        {
   17.16           RESTORE_STACK;