Quellcode durchsuchen

update libsndfile to fix linux build

marauder2k7 vor 2 Monaten
Ursprung
Commit
574ca023d9
87 geänderte Dateien mit 1021 neuen und 817 gelöschten Zeilen
  1. 1 1
      Engine/lib/CMakeLists.txt
  2. 0 6
      Engine/lib/libsndfile/CHANGELOG.md
  3. 16 13
      Engine/lib/libsndfile/CMakeLists.txt
  4. 4 5
      Engine/lib/libsndfile/Makefile.am
  5. 6 2
      Engine/lib/libsndfile/README.md
  6. 36 36
      Engine/lib/libsndfile/Scripts/cstyle.py
  7. 1 1
      Engine/lib/libsndfile/Scripts/git-pre-commit-hook
  8. 1 1
      Engine/lib/libsndfile/cmake/CMakeAutoGenScript.cmake
  9. 92 0
      Engine/lib/libsndfile/cmake/ClipMode.cmake
  10. 1 1
      Engine/lib/libsndfile/cmake/FindFLAC.cmake
  11. 1 1
      Engine/lib/libsndfile/cmake/Findmp3lame.cmake
  12. 7 4
      Engine/lib/libsndfile/cmake/SndFileChecks.cmake
  13. 42 28
      Engine/lib/libsndfile/configure.ac
  14. 2 2
      Engine/lib/libsndfile/docs/api.md
  15. 3 3
      Engine/lib/libsndfile/examples/sfprocess.c
  16. 1 1
      Engine/lib/libsndfile/examples/sndfilehandle.cc
  17. 0 1
      Engine/lib/libsndfile/include/sndfile.hh
  18. 6 45
      Engine/lib/libsndfile/m4/ax_add_fortify_source.m4
  19. 26 5
      Engine/lib/libsndfile/m4/ax_append_compile_flags.m4
  20. 26 5
      Engine/lib/libsndfile/m4/ax_append_flag.m4
  21. 26 5
      Engine/lib/libsndfile/m4/ax_append_link_flags.m4
  22. 28 17
      Engine/lib/libsndfile/m4/ax_check_compile_flag.m4
  23. 26 5
      Engine/lib/libsndfile/m4/ax_check_link_flag.m4
  24. 44 76
      Engine/lib/libsndfile/m4/ax_compiler_vendor.m4
  25. 1 53
      Engine/lib/libsndfile/m4/ax_compiler_version.m4
  26. 124 0
      Engine/lib/libsndfile/m4/clip_mode.m4
  27. 1 1
      Engine/lib/libsndfile/m4/flexible_array.m4
  28. 2 2
      Engine/lib/libsndfile/man/sndfile-play.1
  29. 2 6
      Engine/lib/libsndfile/ossfuzz/sndfile_fuzz_header.h
  30. 1 1
      Engine/lib/libsndfile/programs/sndfile-concat.c
  31. 1 1
      Engine/lib/libsndfile/programs/sndfile-convert.c
  32. 1 1
      Engine/lib/libsndfile/programs/sndfile-metadata-set.c
  33. 96 93
      Engine/lib/libsndfile/programs/sndfile-play.c
  34. 1 1
      Engine/lib/libsndfile/regtest/Readme.txt
  35. 1 1
      Engine/lib/libsndfile/regtest/database.c
  36. 0 2
      Engine/lib/libsndfile/src/ALAC/ag_dec.c
  37. 0 2
      Engine/lib/libsndfile/src/ALAC/ag_enc.c
  38. 5 3
      Engine/lib/libsndfile/src/ALAC/alac_decoder.c
  39. 6 3
      Engine/lib/libsndfile/src/ALAC/alac_encoder.c
  40. 0 2
      Engine/lib/libsndfile/src/ALAC/matrix_dec.c
  41. 0 2
      Engine/lib/libsndfile/src/ALAC/matrix_enc.c
  42. 1 1
      Engine/lib/libsndfile/src/G72x/g72x_test.c
  43. 2 2
      Engine/lib/libsndfile/src/aiff.c
  44. 1 1
      Engine/lib/libsndfile/src/alac.c
  45. 4 6
      Engine/lib/libsndfile/src/au.c
  46. 1 1
      Engine/lib/libsndfile/src/avr.c
  47. 41 53
      Engine/lib/libsndfile/src/binheader_writef_check.py
  48. 21 25
      Engine/lib/libsndfile/src/common.c
  49. 7 7
      Engine/lib/libsndfile/src/common.h
  50. 6 0
      Engine/lib/libsndfile/src/config.h.cmake
  51. 3 3
      Engine/lib/libsndfile/src/double64.c
  52. 2 2
      Engine/lib/libsndfile/src/dwvw.c
  53. 1 1
      Engine/lib/libsndfile/src/file_io.c
  54. 3 3
      Engine/lib/libsndfile/src/float32.c
  55. 7 3
      Engine/lib/libsndfile/src/ima_adpcm.c
  56. 5 5
      Engine/lib/libsndfile/src/ircam.c
  57. 2 2
      Engine/lib/libsndfile/src/mat4.c
  58. 1 1
      Engine/lib/libsndfile/src/mat5.c
  59. 46 45
      Engine/lib/libsndfile/src/nms_adpcm.c
  60. 6 10
      Engine/lib/libsndfile/src/ogg.c
  61. 1 1
      Engine/lib/libsndfile/src/ogg.h
  62. 12 15
      Engine/lib/libsndfile/src/ogg_opus.c
  63. 1 1
      Engine/lib/libsndfile/src/ogg_vcomment.c
  64. 75 97
      Engine/lib/libsndfile/src/ogg_vorbis.c
  65. 1 1
      Engine/lib/libsndfile/src/paf.c
  66. 93 61
      Engine/lib/libsndfile/src/pcm.c
  67. 1 1
      Engine/lib/libsndfile/src/rf64.c
  68. 3 3
      Engine/lib/libsndfile/src/sds.c
  69. 0 4
      Engine/lib/libsndfile/src/sfconfig.h
  70. 4 4
      Engine/lib/libsndfile/src/sndfile.c
  71. 1 1
      Engine/lib/libsndfile/src/voc.c
  72. 1 1
      Engine/lib/libsndfile/src/w64.c
  73. 2 2
      Engine/lib/libsndfile/src/wav.c
  74. 2 2
      Engine/lib/libsndfile/src/wavlike.c
  75. 1 1
      Engine/lib/libsndfile/tests/alaw_test.c
  76. 1 1
      Engine/lib/libsndfile/tests/benchmark.tpl
  77. 2 2
      Engine/lib/libsndfile/tests/command_test.c
  78. 5 1
      Engine/lib/libsndfile/tests/compression_size_test.c
  79. 1 1
      Engine/lib/libsndfile/tests/misc_test.c
  80. 5 0
      Engine/lib/libsndfile/tests/multi_file_test.c
  81. 1 1
      Engine/lib/libsndfile/tests/peak_chunk_test.c
  82. 1 1
      Engine/lib/libsndfile/tests/sftest.c
  83. 1 1
      Engine/lib/libsndfile/tests/ulaw_test.c
  84. 3 3
      Engine/lib/libsndfile/tests/utils.tpl
  85. 1 1
      Engine/lib/libsndfile/tests/win32_test.c
  86. 1 1
      Engine/lib/libsndfile/tests/write_read_test.tpl
  87. 3 0
      Tools/CMake/finders/FindVorbis.cmake

+ 1 - 1
Engine/lib/CMakeLists.txt

@@ -359,7 +359,7 @@ if(NOT Python3_FOUND)
             message(FATAL_ERROR "Failed to extract ${python_zip}")
         endif()
 
-        file(GLOB embedded_python_exe "${python_dir}/python*.exe")
+        file(GLOB embedded_python_exe "${python_dir}/python.exe")
         if(embedded_python_exe)
             set(Python_EXECUTABLE "${embedded_python_exe}" CACHE FILEPATH "Path to embedded Python" FORCE)
             message(STATUS "Using embedded Python: ${Python_EXECUTABLE}")

+ 0 - 6
Engine/lib/libsndfile/CHANGELOG.md

@@ -5,12 +5,6 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
-## [Unreleased]
-
-### Fixed
-
-* Disable autogen rules when autogen cannot be found
-
 ## [1.2.2] - 2023-08-13
 
 ### Fixed

+ 16 - 13
Engine/lib/libsndfile/CMakeLists.txt

@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.5...4.0)
+cmake_minimum_required (VERSION 3.5..3.18)
 
 # MSVC runtime library flags are selected by an abstraction, CMake >= 3.15
 # This policy still need to be set even with cmake_minimum_required() command above.
@@ -8,12 +8,10 @@ if (POLICY CMP0091)
 		return ()
 	endif ()
 
-	if (CMAKE_VERSION VERSION_LESS 3.18)
-		if (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
-			cmake_policy (SET CMP0091 NEW)
-		else ()
-			cmake_policy (SET CMP0091 OLD)
-		endif ()
+	if (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
+		cmake_policy (SET CMP0091 NEW)
+	else ()
+		cmake_policy (SET CMP0091 OLD)
 	endif ()
 endif ()
 
@@ -106,6 +104,11 @@ if (BUILD_REGTEST AND (NOT SQLITE3_FOUND))
 	set (BUILD_REGTEST OFF)
 endif()
 
+cmake_dependent_option (ENABLE_CPU_CLIP "Enable tricky cpu specific clipper" ON "CPU_CLIPS_POSITIVE;CPU_CLIPS_NEGATIVE" OFF)
+if (NOT ENABLE_CPU_CLIP)
+	set (CPU_CLIPS_POSITIVE FALSE)
+	set (CPU_CLIPS_NEGATIVE FALSE)
+endif ()
 cmake_dependent_option (ENABLE_COMPATIBLE_LIBSNDFILE_NAME "Set DLL name to libsndfile-1.dll (canonical name), sndfile.dll otherwise" OFF "WIN32;BUILD_SHARED_LIBS" OFF)
 cmake_dependent_option (INSTALL_MANPAGES "Install man pages for programs" ON "BUILD_PROGRAMS" OFF)
 
@@ -137,6 +140,7 @@ add_feature_info (ENABLE_EXPERIMENTAL ENABLE_EXPERIMENTAL "enable experimental c
 add_feature_info (BUILD_TESTING BUILD_TESTING "build tests")
 add_feature_info (BUILD_REGTEST BUILD_REGTEST "build regtest")
 add_feature_info (ENABLE_CPACK ENABLE_CPACK "enable CPack support")
+add_feature_info (ENABLE_CPU_CLIP ENABLE_CPU_CLIP "Enable tricky cpu specific clipper")
 add_feature_info (ENABLE_BOW_DOCS ENABLE_BOW_DOCS "enable black-on-white html docs")
 add_feature_info (ENABLE_PACKAGE_CONFIG ENABLE_PACKAGE_CONFIG "generate and install package config file")
 add_feature_info (INSTALL_PKGCONFIG_MODULE INSTALL_PKGCONFIG_MODULE "generate and install pkg-config module")
@@ -191,7 +195,7 @@ set_package_properties(Opus PROPERTIES
 set_package_properties(Speex PROPERTIES TYPE OPTIONAL
 	URL "www.speex.org/"
 	DESCRIPTION "an audio codec tuned for speech"
-	PURPOSE "Enables experimental Speex support"
+	PURPOSE "Enables experemental Speex support"
 	)
 set_package_properties (SQLite3 PROPERTIES
 	TYPE OPTIONAL
@@ -388,7 +392,7 @@ target_link_libraries (sndfile
 	PRIVATE
 		$<$<BOOL:${LIBM_REQUIRED}>:m>
 		$<$<BOOL:${HAVE_EXTERNAL_XIPH_LIBS}>:Ogg::ogg>
-		$<$<BOOL:${HAVE_EXTERNAL_XIPH_LIBS}>:vorbisenc>
+		$<$<BOOL:${HAVE_EXTERNAL_XIPH_LIBS}>:Vorbis::vorbisenc>
 		$<$<BOOL:${HAVE_EXTERNAL_XIPH_LIBS}>:FLAC::FLAC>
 		$<$<AND:$<BOOL:${ENABLE_EXPERIMENTAL}>,$<BOOL:${HAVE_EXTERNAL_XIPH_LIBS}>,$<BOOL:${HAVE_SPEEX}>>:Speex::Speex>
 		$<$<BOOL:${HAVE_EXTERNAL_XIPH_LIBS}>:Opus::opus>
@@ -483,7 +487,7 @@ if (BUILD_SHARED_LIBS)
 	if (DEFINED SYMBOL_OS)
 		add_custom_command (
 			OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
-			COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/create_symbols_file.py ${SYMBOL_OS} ${SNDFILE_ABI_VERSION} > ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
+			COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/create_symbols_file.py ${SYMBOL_OS} ${SNDFILE_ABI_VERSION} > ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
 			COMMENT "Generating ${SYMBOL_FILENAME}..."
 			)
 
@@ -566,9 +570,8 @@ if (BUILD_PROGRAMS)
 	elseif ((NOT BEOS) AND ALSA_FOUND)
 		target_include_directories (sndfile-play PRIVATE ${ALSA_INCLUDE_DIRS})
 		target_link_libraries (sndfile-play PRIVATE ${ALSA_LIBRARIES})
-	elseif ((NOT BEOS) AND SNDIO_FOUND)
-		target_include_directories (sndfile-play PRIVATE ${SNDIO_INCLUDE_DIRS})
-		target_link_libraries (sndfile-play PRIVATE ${SNDIO_LIBRARIES})
+	elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+		target_link_libraries (sndfile-play PRIVATE Sndio::Sndio)
 	endif ()
 
 # sndfile-convert

+ 4 - 5
Engine/lib/libsndfile/Makefile.am

@@ -16,7 +16,8 @@ EXTRA_DIST = sndfile.pc.in Scripts/android-configure.sh \
 	NEWS.OLD CHANGELOG.md Scripts/linux-to-win-cross-configure.sh \
 	CMakeLists.txt $(cmake_files) Win32 SECURITY.md
 
-cmake_files = cmake/CMakeAutoGen.cmake cmake/CMakeAutoGenScript.cmake \
+cmake_files = cmake/ClipMode.cmake cmake/FindFLAC.cmake \
+	cmake/CMakeAutoGen.cmake cmake/CMakeAutoGenScript.cmake \
 	cmake/FindOgg.cmake cmake/FindVorbis.cmake cmake/FindSndio.cmake \
 	cmake/FindSpeex.cmake cmake/sqlite/FindSQLite3.cmake \
 	cmake/SndFileChecks.cmake cmake/TestInline.cmake \
@@ -24,7 +25,7 @@ cmake_files = cmake/CMakeAutoGen.cmake cmake/CMakeAutoGenScript.cmake \
 	cmake/FindOpus.cmake cmake/SndFileConfig.cmake.in \
 	cmake/CheckCPUArch.cmake cmake/CheckCPUArch.c.in \
 	cmake/Findmp3lame.cmake cmake/Findmpg123.cmake \
-	cmake/FindFLAC.cmake cmake/SetupABIVersions.cmake
+	cmake/SetupABIVersions.cmake
 
 pkgconfig_DATA = sndfile.pc
 
@@ -402,7 +403,6 @@ tests_scale_clip_test_LDADD = src/libsndfile.la
 # Yes, this sucks, but GNU make patterns aren't portable,
 # see also https://github.com/libsndfile/libsndfile/issues/369
 
-if HAVE_AUTOGEN
 SUFFIXES = .tpl .def
 
 .tpl.def:
@@ -424,7 +424,6 @@ tests/utils.h : tests/utils.c
 	  rm -f tests/utils.c && \
 	  $(MAKE) $(AM_MAKEFLAGS) tests/utils.c; \
 	fi
-endif
 
 ########
 # man/ #
@@ -456,7 +455,7 @@ if USE_OSSFUZZ_STATIC
 FUZZ_LDADD = $(LIB_FUZZING_ENGINE)
 FUZZ_FLAG =
 else
-FUZZ_LDADD = ossfuzz/libstandaloneengine.la
+FUZZ_LDADD = libstandaloneengine.la
 FUZZ_FLAG =
 endif
 endif

+ 6 - 2
Engine/lib/libsndfile/README.md

@@ -127,7 +127,7 @@ You can pass additional options with `/D<parameter>=<value>` when you run
  Useful libsndfile options:
 
 * `BUILD_SHARED_LIBS` - build shared library (DLL under Windows) when `ON`,
-  build static library otherwise. This option is `OFF` by default.
+  build static library othervise. This option is `OFF` by default.
 * `BUILD_PROGRAMS` - build libsndfile's utilities from `programs/` directory,
   `ON` by default.
 * `BUILD_EXAMPLES` - build examples, `ON` by default.
@@ -137,6 +137,8 @@ You can pass additional options with `/D<parameter>=<value>` when you run
   option is available and set to `ON` if all dependency libraries were found.
 * `ENABLE_MPEG` - MP3 support. This option is available and set to `ON` if all
   dependency libraries were found.
+* `ENABLE_CPU_CLIP` - enable tricky cpu specific clipper. Enabled and set to
+  `ON` when CPU clips negative\positive. Don't touch it if you are not sure
 * `ENABLE_BOW_DOCS` - enable black-on-white documentation theme, `OFF` by
   default.
 * `ENABLE_EXPERIMENTAL` - enable experimental code. Don't use it if you are
@@ -163,7 +165,7 @@ You can pass additional options with `/D<parameter>=<value>` when you run
   is native for MinGW ecosystem, Autotools constructs it using MinGW platform
   rules from `sndfile` target. But when you build with CMake using native
   Windows compiler, the name is `sndfile.dll`. This is name for native Windows
-  platform, because Windows has no library naming rules. It is preferred
+  platform, because Windows has no library naming rules. It is preffered
   because you can search library using package manager or CMake's
   `find_library` command on any platform using the same `sndfile` name.
 
@@ -181,6 +183,8 @@ Deprecated options:
 
 * `DISABLE_EXTERNAL_LIBS` - disable Ogg, Vorbis and FLAC support. Replaced by
   `ENABLE_EXTERNAL_LIBS`
+* `DISABLE_CPU_CLIP` - disable tricky cpu specific clipper. Replaced by
+  `ENABLE_CPU_CLIP`
 * `BUILD_STATIC_LIBS` - build static library. Use `BUILD_SHARED_LIBS` instead
 
 ### Linking from CMake projects

+ 36 - 36
Engine/lib/libsndfile/Scripts/cstyle.py

@@ -31,13 +31,13 @@ class Preprocessor:
 	"""
 	def __init__ (self):
 		self.comment_nest = 0
-		self.leading_space_re = re.compile (r'^(\t+| )')
-		self.trailing_space_re = re.compile (r'(\t+| )$')
-		self.define_hack_re = re.compile (r"(#\s*define\s+[a-zA-Z0-9_]+)\(")
+		self.leading_space_re = re.compile ('^(\t+| )')
+		self.trailing_space_re = re.compile ('(\t+| )$')
+		self.define_hack_re = re.compile ("(#\s*define\s+[a-zA-Z0-9_]+)\(")
 
 	def comment_nesting (self):
 		"""
-		Return the current comment nesting. At the start and end of the file,
+		Return the currect comment nesting. At the start and end of the file,
 		this value should be zero. Inside C comments it should be 1 or
 		(possibly) more.
 		"""
@@ -55,7 +55,7 @@ class Preprocessor:
 
 		# Strip C++ style comments.
 		if self.comment_nest == 0:
-			line = re.sub (r"( |\t*)//.*", '', line)
+			line = re.sub ("( |\t*)//.*", '', line)
 
 		# Strip C style comments.
 		open_comment = line.find ('/*')
@@ -108,51 +108,51 @@ class CStyleChecker:
 		self.error_count = 0
 		self.line_num = 1
 		self.orig_line = ''
-		self.trailing_newline_re = re.compile (r'[\r\n]+$')
-		self.indent_re = re.compile (r"^\s*")
+		self.trailing_newline_re = re.compile ('[\r\n]+$')
+		self.indent_re = re.compile ("^\s*")
 		self.last_line_indent = ""
 		self.last_line_indent_curly = False
 		self.re_checks = \
-			[ ( re.compile (r"  "),		"multiple space instead of tab" )
-			, ( re.compile (r"\t "), 	"space after tab" )
-			, ( re.compile (r"[^ ];"),	"missing space before semi-colon" )
-			, ( re.compile (r"{[^\s}]"),	"missing space after open brace" )
-			, ( re.compile (r"[^{\s]}"),	"missing space before close brace" )
-			, ( re.compile (r"[ \t]+$"),	"contains trailing whitespace" )
+			[ ( re.compile ("  "),		"multiple space instead of tab" )
+			, ( re.compile ("\t "), 	"space after tab" )
+			, ( re.compile ("[^ ];"),	"missing space before semi-colon" )
+			, ( re.compile ("{[^\s}]"),	"missing space after open brace" )
+			, ( re.compile ("[^{\s]}"),	"missing space before close brace" )
+			, ( re.compile ("[ \t]+$"),	"contains trailing whitespace" )
 
-			, ( re.compile (r",[^\s\n]"),		"missing space after comma" )
-			, ( re.compile (r";[^\s]"), 	"missing space after semi-colon" )
-			, ( re.compile (r"=[^\s\"'=]"),		"missing space after assignment" )
+			, ( re.compile (",[^\s\n]"),		"missing space after comma" )
+			, ( re.compile (";[^\s]"), 	"missing space after semi-colon" )
+			, ( re.compile ("=[^\s\"'=]"),		"missing space after assignment" )
 
 			# Open and close parenthesis.
-			, ( re.compile (r"[^\s\(\[\*&']\("),				"missing space before open parenthesis" )
-			, ( re.compile (r"\)(-[^>]|[^,'\s\n\)\]-])"),	"missing space after close parenthesis" )
-			, ( re.compile (r"\s(do|for|if|when)\s.*{$"),	"trailing open parenthesis at end of line" )
-			, ( re.compile (r"\( [^;]"),						"space after open parenthesis" )
-			, ( re.compile (r"[^;] \)"),						"space before close parenthesis" )
+			, ( re.compile ("[^\s\(\[\*&']\("),				"missing space before open parenthesis" )
+			, ( re.compile ("\)(-[^>]|[^,'\s\n\)\]-])"),	"missing space after close parenthesis" )
+			, ( re.compile ("\s(do|for|if|when)\s.*{$"),	"trailing open parenthesis at end of line" )
+			, ( re.compile ("\( [^;]"),						"space after open parenthesis" )
+			, ( re.compile ("[^;] \)"),						"space before close parenthesis" )
 
 			# Open and close square brace.
-			, ( re.compile (r"[^\s\(\]]\["),			"missing space before open square brace" )
-			, ( re.compile (r"\][^,\)\]\[\s\.-]"),	"missing space after close square brace" )
-			, ( re.compile (r"\[ "),					"space after open square brace" )
-			, ( re.compile (r" \]"),					"space before close square brace" )
+			, ( re.compile ("[^\s\(\]]\["),			"missing space before open square brace" )
+			, ( re.compile ("\][^,\)\]\[\s\.-]"),	"missing space after close square brace" )
+			, ( re.compile ("\[ "),					"space after open square brace" )
+			, ( re.compile (" \]"),					"space before close square brace" )
 
 			# Space around operators.
-			, ( re.compile (r"[^\s][\*/%+-][=][^\s]"),		"missing space around opassign" )
-			, ( re.compile (r"[^\s][<>!=^/][=]{1,2}[^\s]"),	"missing space around comparison" )
+			, ( re.compile ("[^\s][\*/%+-][=][^\s]"),		"missing space around opassign" )
+			, ( re.compile ("[^\s][<>!=^/][=]{1,2}[^\s]"),	"missing space around comparison" )
 
 			# Parens around single argument to return.
-			, ( re.compile (r"\s+return\s+\([a-zA-Z0-9_]+\)\s+;"),	"parens around return value" )
+			, ( re.compile ("\s+return\s+\([a-zA-Z0-9_]+\)\s+;"),	"parens around return value" )
 
 			# Parens around single case argument.
-			, ( re.compile (r"\s+case\s+\([a-zA-Z0-9_]+\)\s+:"),	"parens around single case argument" )
+			, ( re.compile ("\s+case\s+\([a-zA-Z0-9_]+\)\s+:"),	"parens around single case argument" )
 
 			# Open curly at end of line.
-			, ( re.compile (r"\)\s*{\s*$"),	"open curly brace at end of line" )
+			, ( re.compile ("\)\s*{\s*$"),	"open curly brace at end of line" )
 
-			# Pre and post increment/decrement.
-			, ( re.compile (r"[^\(\[][+-]{2}[a-zA-Z0-9_]"),       "space after pre increment/decrement" )
-			, ( re.compile (r"[a-zA-Z0-9_][+-]{2}[^\)\,]]"),       "space before post increment/decrement" )
+			# Pre and post increment/decrment.
+			, ( re.compile ("[^\(\[][+-]{2}[a-zA-Z0-9_]"),       "space after pre increment/decrement" )
+			, ( re.compile ("[a-zA-Z0-9_][+-]{2}[^\)\,]]"),       "space before post increment/decrement" )
 			]
 
 	def get_error_count (self):
@@ -207,7 +207,7 @@ class CStyleChecker:
 		"""
 
 		indent = len (self.indent_re.search (line).group ())
-		if re.search (r"^\s+}", line):
+		if re.search ("^\s+}", line):
 			if not self.last_line_indent_curly and indent != self.last_line_indent:
 				None	# self.error ("bad indent on close curly brace")
 			self.last_line_indent_curly = True
@@ -219,8 +219,8 @@ class CStyleChecker:
 			if check_re.search (line):
 				self.error (msg)
 
-		if re.search (r"[a-zA-Z0-9][<>!=^/&\|]{1,2}[a-zA-Z0-9]", line):
-			if not re.search (r".*#include.*[a-zA-Z0-9]/[a-zA-Z]", line):
+		if re.search ("[a-zA-Z0-9][<>!=^/&\|]{1,2}[a-zA-Z0-9]", line):
+			if not re.search (".*#include.*[a-zA-Z0-9]/[a-zA-Z]", line):
 				self.error ("missing space around operator")
 
 		self.last_line_indent = indent

+ 1 - 1
Engine/lib/libsndfile/Scripts/git-pre-commit-hook

@@ -55,7 +55,7 @@ if test -n "$cfiles" ; then
 	fi
 
 #-------------------------------------------------------------------------------
-# Check the copyright notice of all files to be committed.
+# Check the copyright notice of all files to be commited.
 
 user=`git config --global user.email`
 year=`date +"%Y"`

+ 1 - 1
Engine/lib/libsndfile/cmake/CMakeAutoGenScript.cmake

@@ -22,7 +22,7 @@ function(read_definition DEFINITION_FILENAME TEMPLATE_FILENAME DATA)
 
     string(REGEX MATCH "autogen definitions ([a-zA-Z\\._-]+);[${WS}]*" TEMPLATE_MATCH "${DEFINITION_CONTENTS}")
     if (NOT TEMPLATE_MATCH)
-        message(FATAL_ERROR "${DEFINITION_FILENAME} does not contain an AutoGen definition.")
+        message(FATAL_ERROR "${DEFINITION_FILENAME} doest not contain an AutoGen definition.")
     endif()
 
     get_filename_component(DEFINITION_DIR "${DEFINITION_FILENAME}" PATH)

+ 92 - 0
Engine/lib/libsndfile/cmake/ClipMode.cmake

@@ -0,0 +1,92 @@
+include (CheckCSourceRuns)
+include (CMakePushCheckState)
+
+macro (CLIP_MODE)
+	if ((NOT DEFINED CPU_CLIPS_NEGATIVE) AND (NOT DEFINED CPU_CLIPS_POSITIVE))
+		set (CLIP_MODE_POSITIVE_MESSAGE "Target processor clips on positive float to int conversion")
+		set (CLIP_MODE_NEGATIVE_MESSAGE "Target processor clips on negative float to int conversion")
+
+		message (STATUS "Checking processor clipping capabilities...")
+
+		if (CMAKE_CROSSCOMPILING)
+
+			set (CLIP_MSG "disabled")
+			set (CPU_CLIPS_POSITIVE FALSE CACHE BOOL ${CLIP_MODE_POSITIVE_MESSAGE})
+			set (CPU_CLIPS_NEGATIVE FALSE CACHE BOOL ${CLIP_MODE_NEGATIVE_MESSAGE})
+
+		else (NOT CMAKE_CROSSCOMPILING)
+
+			cmake_push_check_state ()
+			
+			set (CMAKE_REQUIRED_QUIET TRUE)
+			if (LIBM_REQUIRED)
+				set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${M_LIBRARY})
+			endif ()
+			
+			check_c_source_runs (
+			"
+			#define	_ISOC9X_SOURCE	1
+			#define _ISOC99_SOURCE	1
+			#define	__USE_ISOC99	1
+			#define __USE_ISOC9X	1
+			#include <math.h>
+			int main (void)
+			{	double	fval ;
+				int k, ival ;
+
+				fval = 1.0 * 0x7FFFFFFF ;
+				for (k = 0 ; k < 100 ; k++)
+				{	ival = (lrint (fval)) >> 24 ;
+					if (ival != 127)
+						return 1 ;
+				
+					fval *= 1.2499999 ;
+					} ;
+				
+					return 0 ;
+				}
+			"
+			CPU_CLIPS_POSITIVE)
+			
+			check_c_source_runs (
+			"
+			#define	_ISOC9X_SOURCE	1
+			#define _ISOC99_SOURCE	1
+			#define	__USE_ISOC99	1
+			#define __USE_ISOC9X	1
+			#include <math.h>
+			int main (void)
+			{	double	fval ;
+				int k, ival ;
+
+				fval = -8.0 * 0x10000000 ;
+				for (k = 0 ; k < 100 ; k++)
+				{	ival = (lrint (fval)) >> 24 ;
+					if (ival != -128)
+						return 1 ;
+				
+					fval *= 1.2499999 ;
+					} ;
+				
+					return 0 ;
+				}
+			"
+			CPU_CLIPS_NEGATIVE)
+
+			cmake_pop_check_state ()
+
+			if (CPU_CLIPS_POSITIVE AND (NOT CPU_CLIPS_NEGATIVE))
+				set (CLIP_MSG "positive")
+			elseif (CPU_CLIPS_NEGATIVE AND (NOT CPU_CLIPS_POSITIVE))
+				set (CLIP_MSG "negative")
+			elseif (CPU_CLIPS_POSITIVE AND CPU_CLIPS_NEGATIVE)
+				set (CLIP_MSG "both")
+			else ()
+				set (CLIP_MSG "none")
+			endif ()
+
+		endif (CMAKE_CROSSCOMPILING)
+
+		message (STATUS "Checking processor clipping capabilities... ${CLIP_MSG}")
+	endif ()
+endmacro (CLIP_MODE)

+ 1 - 1
Engine/lib/libsndfile/cmake/FindFLAC.cmake

@@ -4,7 +4,7 @@
 #  FLAC_INCLUDE_DIRS - where to find FLAC headers.
 #  FLAC_LIBRARIES    - List of libraries when using libFLAC.
 #  FLAC_FOUND        - True if libFLAC found.
-#  FLAC_DEFINITIONS  - FLAC compile definitions 
+#  FLAC_DEFINITIONS  - FLAC compile definitons 
 
 if (FLAC_INCLUDE_DIR)
     # Already in cache, be silent

+ 1 - 1
Engine/lib/libsndfile/cmake/Findmp3lame.cmake

@@ -58,7 +58,7 @@ if (MP3LAME_FOUND)
 		)
 		if (MP3LAME_HIP_LIBRARY AND (NOT TARGET mp3lame::mpghip))
 			add_library (mp3lame::mpghip STATIC IMPORTED)
-			set_property (TARGET mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}")
+			set_property (mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}")
 			set_property (TARGET mp3lame::mp3lame PROPERTY INTERFACE_LINK_LIBRARIES "mp3lame::mpghip")
 		endif ()
 	endif ()

+ 7 - 4
Engine/lib/libsndfile/cmake/SndFileChecks.cmake

@@ -6,6 +6,7 @@ include (CheckTypeSize)
 include (TestBigEndian)
 
 include (TestInline)
+include (ClipMode)
 include (TestLargeFiles)
 include (CheckCPUArch)
 
@@ -15,9 +16,10 @@ if (LARGE_FILES_DEFINITIONS)
 	add_definitions(${LARGE_FILES_DEFINITIONS})
 endif ()
 
-if (NOT WIN32)
-	find_package (ALSA)
+if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
 	find_package (Sndio)
+elseif (NOT WIN32)
+	find_package (ALSA)
 endif ()
 
 if (VCPKG_TOOLCHAIN AND (NOT CMAKE_VERSION VERSION_LESS 3.15))
@@ -102,7 +104,7 @@ check_type_size (wchar_t			SIZEOF_WCHAR_T)
 # Never checked
 # check_type_size (size_t			SIZEOF_SIZE_T)
 
-# Used in configure.ac
+# Used in configre.ac
 # check_type_size (double			SIZEOF_DOUBLE)
 # check_type_size (float			SIZEOF_FLOAT)
 # check_type_size (int				SIZEOF_INT)
@@ -194,6 +196,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
 endif ()
 
 test_inline ()
+clip_mode ()
 
 if (MSVC)
 	add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
@@ -249,5 +252,5 @@ if (DEFINED ENABLE_STATIC_RUNTIME)
 endif ()
 
 if (BUILD_SHARED_LIBS)
-	find_package (Python REQUIRED)
+	find_package (PythonInterp REQUIRED)
 endif()

+ 42 - 28
Engine/lib/libsndfile/configure.ac

@@ -141,6 +141,9 @@ AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE], [${EXPERIMENTAL_CODE}], [Set to 1
 AC_ARG_ENABLE([werror],
 	[AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])])
 
+AC_ARG_ENABLE([cpu-clip],
+	[AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])])
+
 AC_ARG_ENABLE([bow-docs],
 	[AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs])])
 
@@ -150,9 +153,6 @@ AC_ARG_ENABLE([sqlite],
 AC_ARG_ENABLE([alsa],
 	[AS_HELP_STRING([--disable-alsa], [disable ALSA support (default=autodetect)])], [], [enable_alsa=auto])
 
-AC_ARG_ENABLE([sndio],
-	[AS_HELP_STRING([--disable-sndio], [disable Sndio support (default=autodetect)])], [], [enable_sndio=auto])
-
 AC_ARG_ENABLE([external-libs],
 	[AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]])])
 
@@ -264,7 +264,7 @@ AC_SEARCH_LIBS([floor], [m], [], [
 AC_CHECK_FUNCS([floor ceil fmod lrint lrintf])
 
 dnl ====================================================================================
-dnl  Check for requirements for building plugins for other languages/environments.
+dnl  Check for requirements for building plugins for other languages/enviroments.
 
 dnl Octave maths environment http://www.octave.org/
 AS_IF([test "x$cross_compiling" = "xno"], [
@@ -345,7 +345,7 @@ AS_IF([test -n "$PKG_CONFIG"], [
 AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_XIPH_LIBS], [$HAVE_EXTERNAL_XIPH_LIBS], [Will be set to 1 if flac, ogg, vorbis, and opus are available.])
 
 dnl ====================================================================================
-dnl  Check for MPEG libraries liblame
+dnl  Check for MPEG libraris liblame
 
 ac_cv_lame="no"
 ac_cv_mpg123="no"
@@ -402,6 +402,22 @@ AS_IF([test "x$enable_sqlite" != "xno"], [
 AC_DEFINE_UNQUOTED([HAVE_SQLITE3], [${ac_cv_sqlite3}], [Set to 1 if you have libsqlite3.])
 AM_CONDITIONAL([HAVE_SQLITE3], [test "x$ac_cv_sqlite3" = "x1"])
 
+dnl ====================================================================================
+dnl  Determine if the processor can do clipping on float to int conversions.
+
+AS_IF([test "x$enable_cpu_clip" != "xno"], [
+		MN_C_CLIP_MODE
+	], [
+		AS_ECHO(["checking processor clipping capabilities... disabled"])
+		ac_cv_c_clip_positive=0
+		ac_cv_c_clip_negative=0
+	])
+
+AC_DEFINE_UNQUOTED([CPU_CLIPS_POSITIVE], [${ac_cv_c_clip_positive}],
+	[Host processor clips on positive float to int conversion.])
+AC_DEFINE_UNQUOTED([CPU_CLIPS_NEGATIVE], [${ac_cv_c_clip_negative}],
+	[Host processor clips on negative float to int conversion.])
+
 dnl ====================================================================================
 dnl  Host OS specific stuff.
 
@@ -474,30 +490,17 @@ AS_IF([test "x$enable_alsa" != "xno"], [
 	])
 
 dnl ====================================================================================
-dnl  Check for Sndio.
+dnl  Check for OpenBSD's sndio.
 
+SNDIO_LIBS=""
 HAVE_SNDIO_H=0
-AS_IF([test "x$alsa_works" != "xyes"], [
-		AS_IF([test "x$enable_sndio" != "xno"], [
-				PKG_CHECK_MODULES([SNDIO], [sndio], [
-						HAVE_SNDIO_H=1
-						ac_cv_sndio="yes"
-					], [
-						ac_cv_sndio="no"
-					])
-		
-				AS_IF([test "x$ac_cv_sndio" = "xno"], [
-						AS_IF([test "x$enable_sndio" = "xyes"], [
-								dnl explicitly passed --enable-sndio, hence error out loud and clearly
-								AC_MSG_ERROR([You explicitly requested sndio support, but sndio could not be found!])
-							], [
-								dnl did not explicitly pass --enable-sndio, relying on default automagic on
-								enable_sndio="no (auto)"
-							])
-					])
+AS_CASE([$host_os],
+	[openbsd*], [
+		AC_CHECK_HEADERS(sndio.h)
+		AS_IF([test "x$ac_cv_header_sndio_h" = "xyes"], [
+				SNDIO_LIBS="-lsndio"
+				HAVE_SNDIO_H=1
 			])
-	], [
-		AC_MSG_WARN([You have requested ALSA already, disable ALSA if you want to use Sndio.])
 	])
 
 AC_DEFINE_UNQUOTED([HAVE_SNDIO_H], [${HAVE_SNDIO_H}], [Set to 1 if <sndio.h> is available.])
@@ -529,7 +532,10 @@ AS_IF([test "x$ac_cv_sizeof_double" != "x8"], [
 		AC_MSG_WARN([[******************************************************************]])
 	])
 
-AM_CONDITIONAL([HAVE_AUTOGEN], [test "x$ac_cv_prog_HAVE_AUTOGEN" = "xyes"])
+AS_IF([test "x$ac_cv_prog_HAVE_AUTOGEN" = "xno"], [
+		AC_MSG_WARN([[Touching files in directory tests/.]])
+		touch tests/*.c tests/*.h
+	])
 
 dnl ====================================================================================
 dnl  Settings for the HTML documentation.
@@ -572,9 +578,17 @@ AS_IF([test "x$enable_werror" = "xyes"], [
 		AC_LANG_POP([C++])
 	])
 
-common_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self -Wno-format-truncation"
+common_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self"
 common_cflags="${common_flags}"
+dnl Clang doesn't know about -Wno-format-truncation
+dnl and would spew tons of warnings otherwise.
+AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
+		common_cflags+=" -Wno-format-truncation"
+	])
 common_cxxflags="${common_flags}"
+AS_IF([test "x$ax_cv_cxx_compiler_vendor" = "xgnu"], [
+		common_cxxflags+=" -Wno-format-truncation"
+	])
 
 AX_APPEND_COMPILE_FLAGS([${common_cflags} -Wvla -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return], [CFLAGS])
 

+ 2 - 2
Engine/lib/libsndfile/docs/api.md

@@ -26,8 +26,8 @@ documented) [here](command.md).**
 ## Synopsis
 
 ```c
-#include <stdio.h>
-#include <sndfile.h>
+#include <stdio.h>;
+#include <sndfile.h>;
 ```
 
 | Name                                                                                                        | Description                                    |

+ 3 - 3
Engine/lib/libsndfile/examples/sfprocess.c

@@ -56,7 +56,7 @@ main (void)
 	static double data [BUFFER_LEN] ;
 
 	/* A SNDFILE is very much like a FILE in the Standard C library. The
-	** sf_open function return an SNDFILE* pointer when they successfully
+	** sf_open function return an SNDFILE* pointer when they sucessfully
 	** open the specified file.
 	*/
 	SNDFILE	*infile, *outfile ;
@@ -131,8 +131,8 @@ process_data (double *data, int count, int channels)
 
 	/* Process the data here.
 	** If the soundfile contains more then 1 channel you need to take care of
-	** the data interleaving yourself.
-	** Current we just apply a channel dependent gain.
+	** the data interleaving youself.
+	** Current we just apply a channel dependant gain.
 	*/
 
 	for (chan = 0 ; chan < channels ; chan ++)

+ 1 - 1
Engine/lib/libsndfile/examples/sndfilehandle.cc

@@ -43,7 +43,7 @@ create_file (const char * fname, int format)
 	/*
 	**	The SndfileHandle object will automatically close the file and
 	**	release all allocated memory when the object goes out of scope.
-	**	This is the Resource Acquisition Is Initialization idom.
+	**	This is the Resource Acquisition Is Initailization idom.
 	**	See : http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
 	*/
 } /* create_file */

+ 0 - 1
Engine/lib/libsndfile/include/sndfile.hh

@@ -111,7 +111,6 @@ class SndfileHandle
 		operator bool () const { return (p != SF_NULL) ; }
 
 		bool operator == (const SndfileHandle &rhs) const { return (p == rhs.p) ; }
-		bool operator != (const SndfileHandle &rhs) const { return !(*this == rhs); }
 
 		sf_count_t	frames (void) const		{ return p ? p->sfinfo.frames : 0 ; }
 		int			format (void) const		{ return p ? p->sfinfo.format : 0 ; }

+ 6 - 45
Engine/lib/libsndfile/m4/ax_add_fortify_source.m4

@@ -10,8 +10,8 @@
 #
 #   Check whether -D_FORTIFY_SOURCE=2 can be added to CPPFLAGS without macro
 #   redefinition warnings, other cpp warnings or linker. Some distributions
-#   (such as Ubuntu or Gentoo Linux) enable _FORTIFY_SOURCE globally in
-#   their compilers, leading to unnecessary warnings in the form of
+#   (such as Gentoo Linux) enable _FORTIFY_SOURCE globally in their
+#   compilers, leading to unnecessary warnings in the form of
 #
 #     <command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
 #     <built-in>: note: this is the location of the previous definition
@@ -29,57 +29,19 @@
 # LICENSE
 #
 #   Copyright (c) 2017 David Seifert <[email protected]>
-#   Copyright (c) 2019, 2023 Reini Urban <[email protected]>
+#   Copyright (c) 2019 Reini Urban <[email protected]>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved.  This file is offered as-is, without any
 #   warranty.
 
-#serial 10
+#serial 4
 
 AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
     ac_save_cflags=$CFLAGS
     ac_cwerror_flag=yes
     AX_CHECK_COMPILE_FLAG([-Werror],[CFLAGS="$CFLAGS -Werror"])
-    ax_add_fortify_3_failed=
-    AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=3 to CPPFLAGS])
-    AC_LINK_IFELSE([
-        AC_LANG_PROGRAM([],
-            [[
-                #ifndef _FORTIFY_SOURCE
-                    return 0;
-                #else
-                    _FORTIFY_SOURCE_already_defined;
-                #endif
-            ]]
-        )],
-        AC_LINK_IFELSE([
-            AC_LANG_SOURCE([[
-                #define _FORTIFY_SOURCE 3
-                #include <string.h>
-                int main(void) {
-                    char *s = " ";
-                    strcpy(s, "x");
-                    return strlen(s)-1;
-                }
-              ]]
-            )],
-            [
-              AC_MSG_RESULT([yes])
-              CFLAGS=$ac_save_cflags
-              CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=3"
-            ], [
-              AC_MSG_RESULT([no])
-              ax_add_fortify_3_failed=1
-            ],
-        ),
-        [
-          AC_MSG_RESULT([no])
-          ax_add_fortify_3_failed=1
-        ])
-    if test -n "$ax_add_fortify_3_failed"
-    then
     AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS])
     AC_LINK_IFELSE([
         AC_LANG_PROGRAM([],
@@ -87,7 +49,7 @@ AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
                 #ifndef _FORTIFY_SOURCE
                     return 0;
                 #else
-                    _FORTIFY_SOURCE_already_defined;
+                    this_is_an_error;
                 #endif
             ]]
         )],
@@ -95,7 +57,7 @@ AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
             AC_LANG_SOURCE([[
                 #define _FORTIFY_SOURCE 2
                 #include <string.h>
-                int main(void) {
+                int main() {
                     char *s = " ";
                     strcpy(s, "x");
                     return strlen(s)-1;
@@ -115,5 +77,4 @@ AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
           AC_MSG_RESULT([no])
           CFLAGS=$ac_save_cflags
         ])
-    fi
 ])

+ 26 - 5
Engine/lib/libsndfile/m4/ax_append_compile_flags.m4

@@ -30,12 +30,33 @@
 #
 #   Copyright (c) 2011 Maarten Bosmans <[email protected]>
 #
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.  This file is offered as-is, without any
-#   warranty.
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
 
-#serial 7
+#serial 6
 
 AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
 [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])

+ 26 - 5
Engine/lib/libsndfile/m4/ax_append_flag.m4

@@ -23,12 +23,33 @@
 #   Copyright (c) 2008 Guido U. Draheim <[email protected]>
 #   Copyright (c) 2011 Maarten Bosmans <[email protected]>
 #
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.  This file is offered as-is, without any
-#   warranty.
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
 
-#serial 8
+#serial 7
 
 AC_DEFUN([AX_APPEND_FLAG],
 [dnl

+ 26 - 5
Engine/lib/libsndfile/m4/ax_append_link_flags.m4

@@ -28,12 +28,33 @@
 #
 #   Copyright (c) 2011 Maarten Bosmans <[email protected]>
 #
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.  This file is offered as-is, without any
-#   warranty.
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
 
-#serial 7
+#serial 6
 
 AC_DEFUN([AX_APPEND_LINK_FLAGS],
 [AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])

+ 28 - 17
Engine/lib/libsndfile/m4/ax_check_compile_flag.m4

@@ -29,29 +29,40 @@
 #   Copyright (c) 2008 Guido U. Draheim <[email protected]>
 #   Copyright (c) 2011 Maarten Bosmans <[email protected]>
 #
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.  This file is offered as-is, without any
-#   warranty.
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
 
-#serial 11
+#serial 5
 
 AC_DEFUN([AX_CHECK_COMPILE_FLAG],
 [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
 AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
-AC_CACHE_CHECK([whether the _AC_LANG compiler accepts $1], CACHEVAR, [
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
   ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
-  if test x"m4_case(_AC_LANG,
-                     [C], [$GCC],
-                     [C++], [$GXX],
-                     [Fortran], [$GFC],
-                     [Fortran 77], [$G77],
-                     [Objective C], [$GOBJC],
-                     [Objective C++], [$GOBJCXX],
-                     [no])" = xyes ; then
-    add_gnu_werror="-Werror"
-  fi
-  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 $add_gnu_werror"
+  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
   AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
     [AS_VAR_SET(CACHEVAR,[yes])],
     [AS_VAR_SET(CACHEVAR,[no])])

+ 26 - 5
Engine/lib/libsndfile/m4/ax_check_link_flag.m4

@@ -29,12 +29,33 @@
 #   Copyright (c) 2008 Guido U. Draheim <[email protected]>
 #   Copyright (c) 2011 Maarten Bosmans <[email protected]>
 #
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.  This file is offered as-is, without any
-#   warranty.
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
 
-#serial 6
+#serial 5
 
 AC_DEFUN([AX_CHECK_LINK_FLAG],
 [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF

+ 44 - 76
Engine/lib/libsndfile/m4/ax_compiler_vendor.m4

@@ -8,30 +8,15 @@
 #
 # DESCRIPTION
 #
-#   Determine the vendor of the C, C++ or Fortran compiler.  The vendor is
-#   returned in the cache variable $ax_cv_c_compiler_vendor for C,
-#   $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
-#   (modern) Fortran.  The value is one of "intel", "ibm", "pathscale",
-#   "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC
-#   Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer
-#   Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi",
-#   "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if
-#   the compiler cannot be determined).
-#
-#   To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
-#   with an appropriate preprocessor-enabled extension.  For example:
-#
-#     AC_LANG_PUSH([Fortran])
-#     AC_PROG_FC
-#     AC_FC_PP_SRCEXT([F])
-#     AX_COMPILER_VENDOR
-#     AC_LANG_POP([Fortran])
+#   Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
+#   hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
+#   watcom, etc. The vendor is returned in the cache variable
+#   $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
 #
 # LICENSE
 #
 #   Copyright (c) 2008 Steven G. Johnson <[email protected]>
 #   Copyright (c) 2008 Matteo Frigo
-#   Copyright (c) 2018-19 John Zaitseff <[email protected]>
 #
 #   This program is free software: you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License as published by the
@@ -59,61 +44,44 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 32
-
-AC_DEFUN([AX_COMPILER_VENDOR], [dnl
-    AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
-	dnl  If you modify this list of vendors, please add similar support
-	dnl  to ax_compiler_version.m4 if at all possible.
-	dnl
-	dnl  Note: Do NOT check for GCC first since some other compilers
-	dnl  define __GNUC__ to remain compatible with it.  Compilers that
-	dnl  are very slow to start (such as Intel) are listed first.
-
-	vendors="
-		intel:		__ICC,__ECC,__INTEL_COMPILER
-		ibm:		__xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
-		pathscale:	__PATHCC__,__PATHSCALE__
-		clang:		__clang__
-		cray:		_CRAYC
-		fujitsu:	__FUJITSU
-		sdcc:		SDCC,__SDCC
-		sx:		_SX
-		nvhpc:		__NVCOMPILER
-		portland:	__PGI
-		gnu:		__GNUC__
-		sun:		__SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
-		hp:		__HP_cc,__HP_aCC
-		dec:		__DECC,__DECCXX,__DECC_VER,__DECCXX_VER
-		borland:	__BORLANDC__,__CODEGEARC__,__TURBOC__
-		comeau:		__COMO__
-		kai:		__KCC
-		lcc:		__LCC__
-		sgi:		__sgi,sgi
-		microsoft:	_MSC_VER
-		metrowerks:	__MWERKS__
-		watcom:		__WATCOMC__
-		tcc:		__TINYC__
-		unknown:	UNKNOWN
-	"
-	for ventest in $vendors; do
-	    case $ventest in
-		*:)
-		    vendor=$ventest
-		    continue
-		    ;;
-		*)
-		    vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
-		    ;;
-	    esac
-
-	    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
-#if !($vencpp)
-      thisisanerror;
-#endif
-	    ]])], [break])
-	done
+#serial 16
 
-	ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
-    ])
-])dnl
+AC_DEFUN([AX_COMPILER_VENDOR],
+[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
+  dnl Please add if possible support to ax_compiler_version.m4
+  [# note: don't check for gcc first since some other compilers define __GNUC__
+  vendors="intel:     __ICC,__ECC,__INTEL_COMPILER
+           ibm:       __xlc__,__xlC__,__IBMC__,__IBMCPP__
+           pathscale: __PATHCC__,__PATHSCALE__
+           clang:     __clang__
+           cray:      _CRAYC
+           fujitsu:   __FUJITSU
+           gnu:       __GNUC__
+           sun:       __SUNPRO_C,__SUNPRO_CC
+           hp:        __HP_cc,__HP_aCC
+           dec:       __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
+           borland:   __BORLANDC__,__CODEGEARC__,__TURBOC__
+           comeau:    __COMO__
+           kai:       __KCC
+           lcc:       __LCC__
+           sgi:       __sgi,sgi
+           microsoft: _MSC_VER
+           metrowerks: __MWERKS__
+           watcom:    __WATCOMC__
+           portland:  __PGI
+	   tcc:       __TINYC__
+           unknown:   UNKNOWN"
+  for ventest in $vendors; do
+    case $ventest in
+      *:) vendor=$ventest; continue ;;
+      *)  vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
+    esac
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
+      #if !($vencpp)
+        thisisanerror;
+      #endif
+    ])], [break])
+  done
+  ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
+ ])
+])

+ 1 - 53
Engine/lib/libsndfile/m4/ax_compiler_version.m4

@@ -36,7 +36,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 14
+#serial 9
 
 # for intel
 AC_DEFUN([_AX_COMPILER_VERSION_INTEL],
@@ -442,20 +442,6 @@ AC_DEFUN([_AX_COMPILER_VERSION_WATCOM],[dnl
   ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
   ])
 
-# for NVHPC
-AC_DEFUN([_AX_COMPILER_VERSION_NVHPC],[
-  AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
-    __NVCOMPILER_MAJOR__,,
-    AC_MSG_FAILURE([[[$0]] unknown nvhpc major]))
-  AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
-    __NVCOMPILER_MINOR__,,
-    AC_MSG_FAILURE([[[$0]] unknown nvhpc minor]))
-  AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
-    [__NVCOMPILER_PATCHLEVEL__],,
-    AC_MSG_FAILURE([[[$0]] unknown nvhpc patch level]))
-  ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
-  ])
-
 # for PGI
 AC_DEFUN([_AX_COMPILER_VERSION_PORTLAND],[
   AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
@@ -474,42 +460,6 @@ AC_DEFUN([_AX_COMPILER_VERSION_PORTLAND],[
 AC_DEFUN([_AX_COMPILER_VERSION_TCC],[
   ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=[`tcc -v | $SED 's/^[ ]*tcc[ ]\+version[ ]\+\([0-9.]\+\).*/\1/g'`]
   ])
-
-# for GNU
-AC_DEFUN([_AX_COMPILER_VERSION_SDCC],[
-  AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
-    /* avoid parse error with comments */
-    #if(defined(__SDCC_VERSION_MAJOR))
-	__SDCC_VERSION_MAJOR
-    #else
-	SDCC/100
-    #endif
-    ,,
-    AC_MSG_FAILURE([[[$0]] unknown sdcc major]))
-  AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
-    /* avoid parse error with comments */
-    #if(defined(__SDCC_VERSION_MINOR))
-	__SDCC_VERSION_MINOR
-    #else
-	(SDCC%100)/10
-    #endif
-    ,,
-    AC_MSG_FAILURE([[[$0]] unknown sdcc minor]))
-  AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
-    [
-    /* avoid parse error with comments */
-    #if(defined(__SDCC_VERSION_PATCH))
-	__SDCC_VERSION_PATCH
-    #elsif(defined(_SDCC_VERSION_PATCHLEVEL))
-	__SDCC_VERSION_PATCHLEVEL
-    #else
-	SDCC%10
-    #endif
-    ],,
-    AC_MSG_FAILURE([[[$0]] unknown sdcc patch level]))
-  ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
-  ])
-
 # main entry point
 AC_DEFUN([AX_COMPILER_VERSION],[dnl
   AC_REQUIRE([AX_COMPILER_VENDOR])
@@ -535,10 +485,8 @@ AC_DEFUN([AX_COMPILER_VERSION],[dnl
 	[microsoft],[_AX_COMPILER_VERSION_MICROSOFT],
 	[metrowerks],[_AX_COMPILER_VERSION_METROWERKS],
 	[watcom],[_AX_COMPILER_VERSION_WATCOM],
-	[nvhpc],[_AX_COMPILER_VERSION_NVHPC],
 	[portland],[_AX_COMPILER_VERSION_PORTLAND],
 	[tcc],[_AX_COMPILER_VERSION_TCC],
-	[sdcc],[_AX_COMPILER_VERSION_SDCC],
   	[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=""])
     ])
 ])

+ 124 - 0
Engine/lib/libsndfile/m4/clip_mode.m4

@@ -0,0 +1,124 @@
+dnl @synopsis MN_C_CLIP_MODE
+dnl
+dnl Determine the clipping mode when converting float to int.
+dnl @version 1.0	May 17 2003
+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this file for any 
+dnl purpose is hereby granted without fee, provided that the above copyright 
+dnl and this permission notice appear in all copies.  No representations are
+dnl made about the suitability of this software for any purpose.  It is 
+dnl provided "as is" without express or implied warranty.
+
+
+
+
+
+
+
+dnl Find the clipping mode in the following way:
+dnl    1) If we are not cross compiling test it.
+dnl    2) IF we are cross compiling, assume that clipping isn't done correctly.
+
+AC_DEFUN([MN_C_CLIP_MODE],
+[AC_CACHE_CHECK(processor clipping capabilities, 
+	ac_cv_c_clip_type,
+
+# Initialize to unknown
+ac_cv_c_clip_positive=unknown
+ac_cv_c_clip_negative=unknown
+
+
+if test $ac_cv_c_clip_positive = unknown ; then
+	AC_TRY_RUN(
+	[[
+	#define	_ISOC9X_SOURCE	1
+	#define _ISOC99_SOURCE	1
+	#define	__USE_ISOC99	1
+	#define __USE_ISOC9X	1
+	#include <math.h>
+	int main (void)
+	{	double	fval ;
+		int k, ival ;
+
+		fval = 1.0 * 0x7FFFFFFF ;
+		for (k = 0 ; k < 100 ; k++)
+		{	ival = (lrint (fval)) >> 24 ;
+			if (ival != 127)
+				return 1 ;
+		
+			fval *= 1.2499999 ;
+			} ;
+		
+			return 0 ;
+		}
+		]],
+		ac_cv_c_clip_positive=yes,
+		ac_cv_c_clip_positive=no,
+		ac_cv_c_clip_positive=unknown
+		)
+
+	AC_TRY_RUN(
+	[[
+	#define	_ISOC9X_SOURCE	1
+	#define _ISOC99_SOURCE	1
+	#define	__USE_ISOC99	1
+	#define __USE_ISOC9X	1
+	#include <math.h>
+	int main (void)
+	{	double	fval ;
+		int k, ival ;
+
+		fval = -8.0 * 0x10000000 ;
+		for (k = 0 ; k < 100 ; k++)
+		{	ival = (lrint (fval)) >> 24 ;
+			if (ival != -128)
+				return 1 ;
+		
+			fval *= 1.2499999 ;
+			} ;
+		
+			return 0 ;
+		}
+		]],
+		ac_cv_c_clip_negative=yes,
+		ac_cv_c_clip_negative=no,
+		ac_cv_c_clip_negative=unknown
+		)
+	fi
+
+if test $ac_cv_c_clip_positive = yes ; then
+	ac_cv_c_clip_positive=1
+else
+	ac_cv_c_clip_positive=0
+	fi
+
+if test $ac_cv_c_clip_negative = yes ; then
+	ac_cv_c_clip_negative=1
+else
+	ac_cv_c_clip_negative=0
+	fi
+
+[[
+case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
+	"00")
+		ac_cv_c_clip_type="none"
+		;;
+	"10")
+		ac_cv_c_clip_type="positive"
+		;;
+	"01")
+		ac_cv_c_clip_type="negative"
+		;;
+	"11")
+		ac_cv_c_clip_type="both"
+		;;
+	esac
+	]]
+
+)
+]
+
+)# MN_C_CLIP_MODE
+
+

+ 1 - 1
Engine/lib/libsndfile/m4/flexible_array.m4

@@ -1,6 +1,6 @@
 dnl @synopsis MN_C99_FLEXIBLE_ARRAY
 dnl
-dnl Does the compiler support the 1999 ISO C Standard "struct hack".
+dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
 dnl @version 1.1	Mar 15 2004
 dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
 dnl

+ 2 - 2
Engine/lib/libsndfile/man/sndfile-play.1

@@ -14,11 +14,11 @@ output APIs. The following table summarizes which audio API is used where:
 .Pp
 .Bl -tag -width MacOSX10XXX -compact
 .It Linux
-ALSA, OSS or sndio
+ALSA or OSS
 .It OpenBSD
 sndio
 .It FreeBSD
-/dev/dsp (OSS) or sndio
+/dev/dsp (OSS)
 .It NetBSD
 /dev/audio
 .It Solaris

+ 2 - 6
Engine/lib/libsndfile/ossfuzz/sndfile_fuzz_header.h

@@ -1,8 +1,6 @@
 #ifndef SNDFILE_FUZZ_HEADER_H
 #define SNDFILE_FUZZ_HEADER_H
 
-#include <errno.h>
-
 typedef struct
 {
   sf_count_t offset ;
@@ -34,9 +32,6 @@ static sf_count_t vfseek (sf_count_t offset, int whence, void *user_data)
         break ;
 
     default :
-        // SEEK_DATA and SEEK_HOLE are not supported by this function.
-        errno = EINVAL ;
-        return -1 ;
         break ;
   }
 
@@ -93,7 +88,8 @@ int sf_init_file(const uint8_t *data,
                 SNDFILE **sndfile, 
                 VIO_DATA *vio_data, 
                 SF_VIRTUAL_IO *vio, SF_INFO *sndfile_info)
-{
+{  float* read_buffer = NULL ;
+
    // Initialize the virtual IO structure.
    vio->get_filelen = vfget_filelen ;
    vio->seek = vfseek ;

+ 1 - 1
Engine/lib/libsndfile/programs/sndfile-concat.c

@@ -51,7 +51,7 @@ usage_exit (const char *progname)
 	printf ("\nUsage : %s <infile1> <infile2>  ... <outfile>\n\n", progname) ;
 	puts (
 		"    Create a new output file <outfile> containing the concatenated\n"
-		"    audio data from <infile1> <infile2> ....\n"
+		"    audio data from froms <infile1> <infile2> ....\n"
 		"\n"
 		"    The joined file will be encoded in the same format as the data\n"
 		"    in infile1, with all the data in subsequent files automatically\n"

+ 1 - 1
Engine/lib/libsndfile/programs/sndfile-convert.c

@@ -336,7 +336,7 @@ main (int argc, char * argv [])
 	if ((sfinfo.format & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 && sfinfo.samplerate != 8000)
 	{	printf (
 			"WARNING: GSM 6.10 data format only supports 8kHz sample rate. The converted\n"
-			"output file will contain the input data converted to the GSM 6.10 data format\n"
+			"ouput file will contain the input data converted to the GSM 6.10 data format\n"
 			"but not re-sampled.\n"
 			) ;
 		} ;

+ 1 - 1
Engine/lib/libsndfile/programs/sndfile-metadata-set.c

@@ -161,7 +161,7 @@ main (int argc, char *argv [])
 	info.has_bext_fields = has_bext_fields_set (&info) ;
 
 	if (filenames [0] == NULL)
-	{	printf ("Error : No input file specified.\n\n") ;
+	{	printf ("Error : No input file specificed.\n\n") ;
 		exit (1) ;
 		} ;
 

+ 96 - 93
Engine/lib/libsndfile/programs/sndfile-play.c

@@ -52,26 +52,27 @@
 	#define ALSA_PCM_NEW_SW_PARAMS_API
 	#include <alsa/asoundlib.h>
 	#include <sys/time.h>
+#endif
+
+#if defined (__ANDROID__)
+
+#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__) || defined (__riscos__)
+	#include 	<fcntl.h>
+	#include 	<sys/ioctl.h>
+	#include 	<sys/soundcard.h>
 
 #elif HAVE_SNDIO_H
 	#include <sndio.h>
 
-#elif defined (__ANDROID__)
-
-#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__) || defined (__riscos__)
+#elif (defined (sun) && defined (unix)) || defined(__NetBSD__)
 	#include <fcntl.h>
 	#include <sys/ioctl.h>
-	#include <sys/soundcard.h>
+	#include <sys/audioio.h>
 
 #elif (OS_IS_WIN32 == 1)
 	#include <windows.h>
 	#include <mmsystem.h>
 
-#elif (defined (sun) && defined (unix)) || defined(__NetBSD__)
-	#include <fcntl.h>
-	#include <sys/ioctl.h>
-	#include <sys/audioio.h>
-
 #endif
 
 #define	SIGNED_SIZEOF(x)	((int) sizeof (x))
@@ -348,71 +349,13 @@ alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels)
 	return total ;
 } /* alsa_write_float */
 
-/*------------------------------------------------------------------------------
-**	Sndio.
-*/
-
-#elif HAVE_SNDIO_H
-
-static void
-sndio_play (int argc, char *argv [])
-{	struct sio_hdl	*hdl ;
-	struct sio_par	par ;
-	short buffer [BUFFER_LEN] ;
-	SNDFILE	*sndfile ;
-	SF_INFO	sfinfo ;
-	int		k, readcount ;
-
-	for (k = 1 ; k < argc ; k++)
-	{	printf ("Playing %s\n", argv [k]) ;
-		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
-		{	puts (sf_strerror (NULL)) ;
-			continue ;
-			} ;
-
-		if (sfinfo.channels < 1 || sfinfo.channels > 2)
-		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
-			continue ;
-			} ;
-
-		if ((hdl = sio_open (NULL, SIO_PLAY, 0)) == NULL)
-		{	fprintf (stderr, "open sndio device failed") ;
-			return ;
-			} ;
-
-		sio_initpar (&par) ;
-		par.rate = sfinfo.samplerate ;
-		par.pchan = sfinfo.channels ;
-		par.bits = 16 ;
-		par.sig = 1 ;
-		par.le = SIO_LE_NATIVE ;
-
-		if (! sio_setpar (hdl, &par) || ! sio_getpar (hdl, &par))
-		{	fprintf (stderr, "set sndio params failed") ;
-			return ;
-			} ;
-
-		if (! sio_start (hdl))
-		{	fprintf (stderr, "sndio start failed") ;
-			return ;
-			} ;
-
-		while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
-			sio_write (hdl, buffer, readcount * sizeof (short)) ;
-
-		sio_close (hdl) ;
-		} ;
-
-	return ;
-} /* sndio_play */
-
-#elif defined (__ANDROID__)
+#endif /* HAVE_ALSA_ASOUNDLIB_H */
 
 /*------------------------------------------------------------------------------
 **	Linux/OSS functions for playing a sound.
 */
 
-#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__) || defined (__riscos__)
+#if !defined (__ANDROID__) && (defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__) || defined (__riscos__))
 
 static	int	opensoundsys_open_device (int channels, int srate) ;
 
@@ -523,6 +466,8 @@ opensoundsys_open_device (int channels, int srate)
 	return 	fd ;
 } /* opensoundsys_open_device */
 
+#endif /* __linux__ */
+
 /*------------------------------------------------------------------------------
 **	Mac OS X functions for playing a sound.
 */
@@ -537,7 +482,7 @@ opensoundsys_open_device (int channels, int srate)
 **  point to data instead of short*. It plain sucks!
 */
 
-#elif (OS_IS_WIN32 == 1)
+#if (OS_IS_WIN32 == 1)
 
 #define	WIN32_BUFFER_LEN	(1 << 15)
 
@@ -563,7 +508,7 @@ static void
 win32_play_data (Win32_Audio_Data *audio_data)
 {	int thisread, readcount ;
 
-	/* fill a buffer if there is more data and we can read it successfully */
+	/* fill a buffer if there is more data and we can read it sucessfully */
 	readcount = (audio_data->remaining > audio_data->bufferlen) ? audio_data->bufferlen : (int) audio_data->remaining ;
 
 	short *lpData = (short *) (void *) audio_data->whdr [audio_data->current].lpData ;
@@ -718,11 +663,73 @@ win32_play (int argc, char *argv [])
 
 } /* win32_play */
 
+#endif /* Win32 */
+
+/*------------------------------------------------------------------------------
+**	OpenBSD's sndio.
+*/
+
+#if HAVE_SNDIO_H
+
+static void
+sndio_play (int argc, char *argv [])
+{	struct sio_hdl	*hdl ;
+	struct sio_par	par ;
+	short buffer [BUFFER_LEN] ;
+	SNDFILE	*sndfile ;
+	SF_INFO	sfinfo ;
+	int		k, readcount ;
+
+	for (k = 1 ; k < argc ; k++)
+	{	printf ("Playing %s\n", argv [k]) ;
+		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
+		{	puts (sf_strerror (NULL)) ;
+			continue ;
+			} ;
+
+		if (sfinfo.channels < 1 || sfinfo.channels > 2)
+		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
+			continue ;
+			} ;
+
+		if ((hdl = sio_open (NULL, SIO_PLAY, 0)) == NULL)
+		{	fprintf (stderr, "open sndio device failed") ;
+			return ;
+			} ;
+
+		sio_initpar (&par) ;
+		par.rate = sfinfo.samplerate ;
+		par.pchan = sfinfo.channels ;
+		par.bits = 16 ;
+		par.sig = 1 ;
+		par.le = SIO_LE_NATIVE ;
+
+		if (! sio_setpar (hdl, &par) || ! sio_getpar (hdl, &par))
+		{	fprintf (stderr, "set sndio params failed") ;
+			return ;
+			} ;
+
+		if (! sio_start (hdl))
+		{	fprintf (stderr, "sndio start failed") ;
+			return ;
+			} ;
+
+		while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
+			sio_write (hdl, buffer, readcount * sizeof (short)) ;
+
+		sio_close (hdl) ;
+		} ;
+
+	return ;
+} /* sndio_play */
+
+#endif /* sndio */
+
 /*------------------------------------------------------------------------------
 **	Solaris.
 */
 
-#elif (defined (sun) && defined (unix)) || defined(__NetBSD__)
+#if (defined (sun) && defined (unix)) || defined(__NetBSD__)
 
 static void
 solaris_play (int argc, char *argv [])
@@ -752,7 +759,7 @@ solaris_play (int argc, char *argv [])
 			return ;
 			} ;
 
-		/*	Retrieve standard values. */
+		/*	Retrive standard values. */
 		AUDIO_INITINFO (&audio_info) ;
 
 		audio_info.play.sample_rate = sfinfo.samplerate ;
@@ -823,35 +830,31 @@ main (int argc, char *argv [])
 		return 1 ;
 		} ;
 
-#if HAVE_ALSA_ASOUNDLIB_H
-	if (access ("/proc/asound/cards", R_OK) == 0)
-		alsa_play (argc, argv) ;
-	else
-		return EXIT_FAILURE ;
-
-#elif HAVE_SNDIO_H
-	sndio_play (argc, argv) ;
-
-#elif defined (__ANDROID__)
+#if defined (__ANDROID__)
 	puts ("*** Playing sound not yet supported on Android.") ;
 	puts ("*** Please feel free to submit a patch.") ;
-	return EXIT_FAILURE ;
-
-#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__) || defined (__riscos__)
+	return 1 ;
+#elif defined (__linux__)
+	#if HAVE_ALSA_ASOUNDLIB_H
+		if (access ("/proc/asound/cards", R_OK) == 0)
+			alsa_play (argc, argv) ;
+		else
+	#endif
+		opensoundsys_play (argc, argv) ;
+#elif defined (__FreeBSD_kernel__) || defined (__FreeBSD__) || defined (__riscos__)
 	opensoundsys_play (argc, argv) ;
-
-#elif (OS_IS_WIN32 == 1)
-	win32_play (argc, argv) ;
-
+#elif HAVE_SNDIO_H
+	sndio_play (argc, argv) ;
 #elif (defined (sun) && defined (unix)) || defined(__NetBSD__)
 	solaris_play (argc, argv) ;
-
+#elif (OS_IS_WIN32 == 1)
+	win32_play (argc, argv) ;
 #else
 	puts ("*** Playing sound not supported on this platform.") ;
 	puts ("*** Please feel free to submit a patch.") ;
-	return EXIT_FAILURE ;
+	return 1 ;
 #endif
 
-	return EXIT_SUCCESS ;
+	return 0 ;
 } /* main */
 

+ 1 - 1
Engine/lib/libsndfile/regtest/Readme.txt

@@ -45,7 +45,7 @@ with the libsndfile source code distribution.
 
 Organization of Files
 ---------------------
-The regression test program keeps its database file in the directory it
+The regession test program keeps its database file in the directory it
 is run from. In addition, the database only contains information about
 the files, not the files themselves.
 

+ 1 - 1
Engine/lib/libsndfile/regtest/database.c

@@ -533,7 +533,7 @@ int dummy (void) ;
 int
 dummy (void)
 {	/*
-	**	Empty dummy function so the compiler doesn't whine about an
+	**	Empty dummy fnction so tha compiler doesn't winge about an
 	**	empty file.
 	*/
 	return 0 ;

+ 0 - 2
Engine/lib/libsndfile/src/ALAC/ag_dec.c

@@ -26,8 +26,6 @@
 	Copyright:	(c) 2001-2011 Apple, Inc.
 */
 
-#include "config.h"
-
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>

+ 0 - 2
Engine/lib/libsndfile/src/ALAC/ag_enc.c

@@ -27,8 +27,6 @@
 	Copyright:	(c) 2001-2011 Apple, Inc.
 */
 
-#include "config.h"
-
 #include "aglib.h"
 #include "ALACBitUtilities.h"
 #include "EndianPortable.h"

+ 5 - 3
Engine/lib/libsndfile/src/ALAC/alac_decoder.c

@@ -23,12 +23,9 @@
 	File:		ALACDecoder.cpp
 */
 
-#include "config.h"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
-#include <stdbool.h>
 #include <string.h>
 
 #include "alac_codec.h"
@@ -41,6 +38,11 @@
 #include "ALACBitUtilities.h"
 #include "EndianPortable.h"
 
+typedef enum
+{	false = 0,
+	true = 1
+} bool ;
+
 // constants/data
 const uint32_t kMaxBitDepth = 32 ;			// max allowed bit depth is 32
 

+ 6 - 3
Engine/lib/libsndfile/src/ALAC/alac_encoder.c

@@ -28,11 +28,8 @@
 #define DebugMsg			printf
 
 // headers
-#include "config.h"
-
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdbool.h>
 #include <string.h>
 
 #include "sfendian.h"
@@ -47,6 +44,12 @@
 #include "ALACAudioTypes.h"
 #include "EndianPortable.h"
 
+typedef enum
+{
+	false = 0,
+	true = 1
+} bool ;
+
 static void	GetConfig (ALAC_ENCODER *p, ALACSpecificConfig * config) ;
 
 static int32_t	EncodeStereo (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;

+ 0 - 2
Engine/lib/libsndfile/src/ALAC/matrix_dec.c

@@ -27,8 +27,6 @@
 	Copyright:	(c) 2004-2011 Apple, Inc.
 */
 
-#include "config.h"
-
 #include "matrixlib.h"
 #include "ALACAudioTypes.h"
 #include "shift.h"

+ 0 - 2
Engine/lib/libsndfile/src/ALAC/matrix_enc.c

@@ -27,8 +27,6 @@
 	Copyright:	(c) 2004-2011 Apple, Inc.
 */
 
-#include "config.h"
-
 #include "matrixlib.h"
 #include "ALACAudioTypes.h"
 

+ 1 - 1
Engine/lib/libsndfile/src/G72x/g72x_test.c

@@ -130,7 +130,7 @@ g723_test	(double margin)
 			} ;
 		} ;
 
-	printf ("\n\nMax error of %d at position %d.\n", max_err, position) ;
+	printf ("\n\nMax error of %d at postion %d.\n", max_err, position) ;
 
 	for (k = 0 ; k < BUFFER_SIZE ; k++)
 	{	if (error_function (data [k], orig [k], margin))

+ 2 - 2
Engine/lib/libsndfile/src/aiff.c

@@ -94,7 +94,7 @@
 #define MAC6_MARKER		(MAKE_MARKER ('M', 'A', 'C', '6'))
 #define ADP4_MARKER		(MAKE_MARKER ('A', 'D', 'P', '4'))
 
-/* Predefined chunk sizes. */
+/* Predfined chunk sizes. */
 #define SIZEOF_AIFF_COMM		18
 #define SIZEOF_AIFC_COMM_MIN	22
 #define SIZEOF_AIFC_COMM		24
@@ -1702,7 +1702,7 @@ static int
 aiff_read_basc_chunk (SF_PRIVATE * psf, int datasize)
 {	const char * type_str ;
 	basc_CHUNK bc ;
-	sf_count_t count ;
+	int count ;
 
 	count = psf_binheader_readf (psf, "E442", &bc.version, &bc.numBeats, &bc.rootNote) ;
 	count += psf_binheader_readf (psf, "E222", &bc.scaleType, &bc.sigNumerator, &bc.sigDenominator) ;

+ 1 - 1
Engine/lib/libsndfile/src/alac.c

@@ -885,7 +885,7 @@ alac_pakt_encode (const SF_PRIVATE *psf, uint32_t * pakt_size_out)
 	plac = psf->codec_data ;
 	info = plac->pakt_info ;
 
-	allocated = 100 + 4 * info->count ;
+	allocated = 100 + 2 * info->count ;
 	if ((data = calloc (1, allocated)) == NULL)
 		return NULL ;
 

+ 4 - 6
Engine/lib/libsndfile/src/au.c

@@ -291,7 +291,6 @@ static int
 au_read_header (SF_PRIVATE *psf)
 {	AU_FMT	au_fmt ;
 	int		marker, dword ;
-	sf_count_t data_end ;
 
 	memset (&au_fmt, 0, sizeof (au_fmt)) ;
 	psf_binheader_readf (psf, "pm", 0, &marker) ;
@@ -318,15 +317,14 @@ au_read_header (SF_PRIVATE *psf)
 		return SFE_AU_EMBED_BAD_LEN ;
 		} ;
 
-	data_end = (sf_count_t) au_fmt.dataoffset + (sf_count_t) au_fmt.datasize ;
 	if (psf->fileoffset > 0)
-	{	psf->filelength = data_end ;
+	{	psf->filelength = au_fmt.dataoffset + au_fmt.datasize ;
 		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
 		}
-	else if (au_fmt.datasize == -1 || data_end == psf->filelength)
+	else if (au_fmt.datasize == -1 || au_fmt.dataoffset + au_fmt.datasize == psf->filelength)
 		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
-	else if (data_end < psf->filelength)
-	{	psf->filelength = data_end ;
+	else if (au_fmt.dataoffset + au_fmt.datasize < psf->filelength)
+	{	psf->filelength = au_fmt.dataoffset + au_fmt.datasize ;
 		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
 		}
 	else

+ 1 - 1
Engine/lib/libsndfile/src/avr.c

@@ -162,7 +162,7 @@ avr_read_header (SF_PRIVATE *psf)
 	psf->endian = SF_ENDIAN_BIG ;
 
  	psf->dataoffset = AVR_HDR_SIZE ;
-	psf->datalength = (sf_count_t) hdr.frames * (hdr.rez / 8) ;
+	psf->datalength = hdr.frames * (hdr.rez / 8) ;
 
 	if (psf->fileoffset > 0)
 		psf->filelength = AVR_HDR_SIZE + psf->datalength ;

+ 41 - 53
Engine/lib/libsndfile/src/binheader_writef_check.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python
 
 # Copyright (C) 2006-2017 Erik de Castro Lopo <[email protected]>
 #
@@ -36,91 +36,79 @@
 # correct.
 
 
-import re
-import sys
 
-_whitespace_re = re.compile(r"\s+", re.MULTILINE)
+import re, string, sys
 
+_whitespace_re = re.compile ("\s+", re.MULTILINE)
 
-def find_binheader_writefs(data):
-    lst = re.findall(
-        r'psf_binheader_writef\s*\(\s*[a-zA-Z_]+\s*,\s*"[^;]+;', data, re.MULTILINE
-    )
-    return [_whitespace_re.sub(" ", x) for x in lst]
+def find_binheader_writefs (data):
+    lst = re.findall ('psf_binheader_writef\s*\(\s*[a-zA-Z_]+\s*,\s*\"[^;]+;', data, re.MULTILINE)
+    return [_whitespace_re.sub (" ", x) for x in lst]
 
-
-def find_format_string(s):
-    fmt = re.search('"([^"]+)"', s)
+def find_format_string (s):
+    fmt = re.search ('"([^"]+)"', s)
     if not fmt:
-        print(f"Bad format in :\n\n\t{s}\n\n")
-        sys.exit(1)
-    fmt = fmt.groups()
-    if len(fmt) != 1:
-        print(f"Bad format in :\n\n\t{s}\n\n")
-        sys.exit(1)
-    return _whitespace_re.sub("", fmt[0])
-
-
-def get_param_list(data):
-    dlist = re.search(r"\((.+)\)\s*;", data)
-    dlist = dlist.groups()[0]
+        print ("Bad format in :\n\n\t%s\n\n" % s)
+        sys.exit (1)
+    fmt = fmt.groups ()
+    if len (fmt) != 1:
+        print ("Bad format in :\n\n\t%s\n\n" % s)
+        sys.exit (1)
+    return _whitespace_re.sub ("", fmt [0])
+
+def get_param_list (data):
+    dlist = re.search ("\((.+)\)\s*;", data)
+    dlist = dlist.groups ()[0]
     dlist = dlist.split(",")
     dlist = [x.strip() for x in dlist]
-    return dlist[2:]
-
+    return dlist [2:]
 
-def handle_file(fname):
+def handle_file (fname):
     errors = 0
-    data = open(fname, "r").read()
+    data = open (fname, "r").read ()
 
     # return errors
 
-    writefs = find_binheader_writefs(data)
+    writefs = find_binheader_writefs (data)
     for item in writefs:
-        fmt = find_format_string(item)
-        params = get_param_list(item)
+        fmt = find_format_string (item)
+        params = get_param_list (item)
         param_index = 0
 
         # print item
 
         for ch in fmt:
-            if ch in "Eet ":
+            if ch in 'Eet ':
                 continue
 
-            if ch == "b":
-                if (
-                    params[param_index][:4] == "BHWv"
-                    and params[param_index + 1][:4] == "BHWz"
-                ):
+            if ch == 'b':
+                if params [param_index][:4] == "BHWv" and params [param_index + 1][:4] == "BHWz":
                     param_index += 2
                     continue
 
-            if "BHW" + ch == params[param_index][:4]:
+            if "BHW" + ch == params [param_index][:4]:
                 param_index += 1
                 continue
 
-            if errors == 0:
-                sys.stdout.write("\n")
-            print(
-                f"\n{fname}: error for format specifier '{ch}' (index {param_index}) in:\n    {item}\n"
-            )
+            if errors == 0: sys.stdout.write ("\n")
+            print ("\n%s: error for format specifier '%c' (index %d) in:\n    %s\n" % (fname, ch, param_index, item))
             errors += 1
             # Break out of 'for ch in fmt' loop
             break
 
     return errors
 
+#===============================================================================
 
-# ===============================================================================
-
-if len(sys.argv) > 1:
-    sys.stdout.write("\n    binheader_writef_check                   : ")
-    sys.stdout.flush()
+if len (sys.argv) > 1:
+    sys.stdout.write ("\n    binheader_writef_check                   : ")
+    sys.stdout.flush ()
     errors = 0
-    for fname in sys.argv[1:]:
-        errors += handle_file(fname)
+    for fname in sys.argv [1:]:
+        errors += handle_file (fname)
     if errors > 0:
-        print(f"\nErrors : {errors}\n")
-        sys.exit(1)
+        print ("\nErrors : %d\n" % errors)
+        sys.exit (1)
+
+print ("ok\n")
 
-print("ok\n")

+ 21 - 25
Engine/lib/libsndfile/src/common.c

@@ -18,7 +18,6 @@
 
 #include <config.h>
 
-#include <limits.h>
 #include <stdarg.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -991,7 +990,6 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 	double			*doubleptr ;
 	char			c ;
 	int				byte_count = 0, count = 0 ;
-	int				read_bytes = 0 ;
 
 	if (! format)
 		return psf_ftell (psf) ;
@@ -1000,7 +998,6 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 
 	while ((c = *format++))
 	{
-		read_bytes = 0 ;
 		if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
 			break ;
 
@@ -1017,7 +1014,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 					intptr = va_arg (argptr, unsigned int*) ;
 					*intptr = 0 ;
 					ucptr = (unsigned char*) intptr ;
-					read_bytes = header_read (psf, ucptr, sizeof (int)) ;
+					byte_count += header_read (psf, ucptr, sizeof (int)) ;
 					*intptr = GET_MARKER (ucptr) ;
 					break ;
 
@@ -1025,7 +1022,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 					intptr = va_arg (argptr, unsigned int*) ;
 					*intptr = 0 ;
 					ucptr = (unsigned char*) intptr ;
-					read_bytes = header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
+					byte_count += header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
 					{	int k ;
 						intdata = 0 ;
 						for (k = 0 ; k < 16 ; k++)
@@ -1037,14 +1034,14 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 			case '1' :
 					charptr = va_arg (argptr, char*) ;
 					*charptr = 0 ;
-					read_bytes = header_read (psf, charptr, sizeof (char)) ;
+					byte_count += header_read (psf, charptr, sizeof (char)) ;
 					break ;
 
 			case '2' : /* 2 byte value with the current endian-ness */
 					shortptr = va_arg (argptr, unsigned short*) ;
 					*shortptr = 0 ;
 					ucptr = (unsigned char*) shortptr ;
-					read_bytes = header_read (psf, ucptr, sizeof (short)) ;
+					byte_count += header_read (psf, ucptr, sizeof (short)) ;
 					if (psf->rwf_endian == SF_ENDIAN_BIG)
 						*shortptr = GET_BE_SHORT (ucptr) ;
 					else
@@ -1054,7 +1051,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 			case '3' : /* 3 byte value with the current endian-ness */
 					intptr = va_arg (argptr, unsigned int*) ;
 					*intptr = 0 ;
-					read_bytes = header_read (psf, sixteen_bytes, 3) ;
+					byte_count += header_read (psf, sixteen_bytes, 3) ;
 					if (psf->rwf_endian == SF_ENDIAN_BIG)
 						*intptr = GET_BE_3BYTE (sixteen_bytes) ;
 					else
@@ -1065,7 +1062,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 					intptr = va_arg (argptr, unsigned int*) ;
 					*intptr = 0 ;
 					ucptr = (unsigned char*) intptr ;
-					read_bytes = header_read (psf, ucptr, sizeof (int)) ;
+					byte_count += header_read (psf, ucptr, sizeof (int)) ;
 					if (psf->rwf_endian == SF_ENDIAN_BIG)
 						*intptr = psf_get_be32 (ucptr, 0) ;
 					else
@@ -1075,7 +1072,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 			case '8' : /* 8 byte value with the current endian-ness */
 					countptr = va_arg (argptr, sf_count_t *) ;
 					*countptr = 0 ;
-					read_bytes = header_read (psf, sixteen_bytes, 8) ;
+					byte_count += header_read (psf, sixteen_bytes, 8) ;
 					if (psf->rwf_endian == SF_ENDIAN_BIG)
 						countdata = psf_get_be64 (sixteen_bytes, 0) ;
 					else
@@ -1086,7 +1083,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 			case 'f' : /* Float conversion */
 					floatptr = va_arg (argptr, float *) ;
 					*floatptr = 0.0 ;
-					read_bytes = header_read (psf, floatptr, sizeof (float)) ;
+					byte_count += header_read (psf, floatptr, sizeof (float)) ;
 					if (psf->rwf_endian == SF_ENDIAN_BIG)
 						*floatptr = float32_be_read ((unsigned char*) floatptr) ;
 					else
@@ -1096,7 +1093,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 			case 'd' : /* double conversion */
 					doubleptr = va_arg (argptr, double *) ;
 					*doubleptr = 0.0 ;
-					read_bytes = header_read (psf, doubleptr, sizeof (double)) ;
+					byte_count += header_read (psf, doubleptr, sizeof (double)) ;
 					if (psf->rwf_endian == SF_ENDIAN_BIG)
 						*doubleptr = double64_be_read ((unsigned char*) doubleptr) ;
 					else
@@ -1120,7 +1117,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 					charptr = va_arg (argptr, char*) ;
 					count = va_arg (argptr, size_t) ;
 					memset (charptr, 0, count) ;
-					read_bytes = header_read (psf, charptr, count) ;
+					byte_count += header_read (psf, charptr, count) ;
 					break ;
 
 			case 'G' :
@@ -1131,7 +1128,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 					if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
 						break ;
 
-					read_bytes = header_gets (psf, charptr, count) ;
+					byte_count += header_gets (psf, charptr, count) ;
 					break ;
 
 			case 'z' :
@@ -1155,7 +1152,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 			case 'j' :	/* Seek to position from current position. */
 					count = va_arg (argptr, size_t) ;
 					header_seek (psf, count, SEEK_CUR) ;
-					read_bytes = count ;
+					byte_count += count ;
 					break ;
 
 			case '!' : /* Clear buffer, forcing re-read. */
@@ -1167,17 +1164,8 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
 				psf->error = SFE_INTERNAL ;
 				break ;
 			} ;
-
-		if (read_bytes > 0 && byte_count > (INT_MAX - read_bytes))
-		{	psf_log_printf (psf, "Header size exceeds INT_MAX. Aborting.", c) ;
-			psf->error = SFE_INTERNAL ;
-			break ;
-		} else
-		{	byte_count += read_bytes ;
 		} ;
 
-		} ;	/*end while*/
-
 	va_end (argptr) ;
 
 	return byte_count ;
@@ -1773,14 +1761,18 @@ psf_f2i_clip_array (const float *src, int *dest, int count, int normalize)
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
+#if CPU_CLIPS_POSITIVE == 0
 		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i] = 0x7FFFFFFF ;
 			continue ;
 			} ;
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
 		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i] = 0x80000000 ;
 			continue ;
 			} ;
+#endif
 
 		dest [i] = psf_lrintf (scaled_value) ;
 		} ;
@@ -1790,7 +1782,7 @@ psf_f2i_clip_array (const float *src, int *dest, int count, int normalize)
 
 void
 psf_d2i_array (const double *src, int *dest, int count, int normalize)
-{	double			normfact ;
+{	double 			normfact ;
 
 	normfact = normalize ? (1.0 * 0x7FFFFFFF) : 1.0 ;
 	for (int i = 0 ; i < count ; i++)
@@ -1807,14 +1799,18 @@ psf_d2i_clip_array (const double *src, int *dest, int count, int normalize)
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
+#if CPU_CLIPS_POSITIVE == 0
 		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i] = 0x7FFFFFFF ;
 			continue ;
 			} ;
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
 		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i] = 0x80000000 ;
 			continue ;
 			} ;
+#endif
 
 		dest [i] = psf_lrint (scaled_value) ;
 		} ;

+ 7 - 7
Engine/lib/libsndfile/src/common.h

@@ -102,7 +102,7 @@
 #define		SF_MAX_CHANNELS		1024
 
 /*
-*	Macros for splitting the format file of SF_INFO into container type,
+*	Macros for spliting the format file of SF_INFO into container type,
 **	codec type and endian-ness.
 */
 #define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
@@ -305,7 +305,7 @@ void *psf_memdup (const void *src, size_t n) ;
 int psf_isprint (int ch) ;
 
 /*=======================================================================================
-**	SF_PRIVATE struct - a pointer to this struct is passed back to the caller of the
+**	SF_PRIVATE stuct - a pointer to this struct is passed back to the caller of the
 **	sf_open_XXXX functions. The caller however has no knowledge of the struct's
 **	contents.
 */
@@ -402,7 +402,7 @@ typedef struct sf_private_tag
 
 	int				scale_int_float ;
 
-	/* Variables for handling pipes. */
+	/* Vairables for handling pipes. */
 	int				is_pipe ;		/* True if file is a pipe. */
 	sf_count_t		pipeoffset ;	/* Number of bytes read from a pipe. */
 
@@ -439,7 +439,7 @@ typedef struct sf_private_tag
 	sf_count_t		datalength ;	/* Length in bytes of the audio data. */
 	sf_count_t		dataend ;		/* Offset to file tailer. */
 
-	sf_count_t		blockwidth ;	/* Size in bytes of one set of interleaved samples. */
+	int				blockwidth ;	/* Size in bytes of one set of interleaved samples. */
 	int				bytewidth ;		/* Size in bytes of one sample (one channel). */
 
 	void			*dither ;
@@ -947,7 +947,7 @@ int		psf_find_write_chunk (WRITE_CHUNKS * pchk, const char * marker) ;
 **
 ** See : http://www.gratisoft.us/todd/papers/strlcpy.html
 **
-** These functions are available on *BSD, but are not available everywhere so we
+** These functions are available on *BSD, but are not avaialble everywhere so we
 ** implement them here.
 **
 ** The argument order has been changed to that of strncpy/strncat to cause
@@ -964,7 +964,7 @@ void psf_strlcpy (char *dest, size_t n, const char *src) ;
 static inline int psf_lrintf (float x)
 {
 	#ifdef USE_SSE2
-		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
+ 		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
 	#else
 		return lrintf (x) ;
 	#endif
@@ -973,7 +973,7 @@ static inline int psf_lrintf (float x)
 static inline int psf_lrint (double x)
 {
 	#ifdef USE_SSE2
-		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
+ 		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
 	#else
 		return lrint (x) ;
 	#endif

+ 6 - 0
Engine/lib/libsndfile/src/config.h.cmake

@@ -1,6 +1,12 @@
 /* Set to 1 if the compile is GNU GCC. */
 #cmakedefine01 COMPILER_IS_GCC
 
+/* Target processor clips on negative float to int conversion. */
+#cmakedefine01 CPU_CLIPS_NEGATIVE
+
+/* Target processor clips on positive float to int conversion. */
+#cmakedefine01 CPU_CLIPS_POSITIVE
+
 /* Target processor is big endian. */
 #cmakedefine01 CPU_IS_BIG_ENDIAN
 

+ 3 - 3
Engine/lib/libsndfile/src/double64.c

@@ -461,7 +461,7 @@ double64_get_capability	(SF_PRIVATE *psf)
 		unsigned char	c [8] ;
 	} data ;
 
-	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
+	data.d = 1.234567890123456789 ; /* Some abitrary value. */
 
 	if (! psf->ieee_replace)
 	{	/* If this test is true ints and floats are compatible and little endian. */
@@ -517,9 +517,9 @@ d2i_clip_array (const double *src, int count, int *dest, double scale)
 {	for (int i = 0 ; i < count ; i++)
 	{	float tmp = scale * src [i] ;
 
-		if (tmp > (1.0 * INT_MAX))
+		if (CPU_CLIPS_POSITIVE == 0 && tmp > (1.0 * INT_MAX))
 			dest [i] = INT_MAX ;
-		else if (tmp < (-1.0 * INT_MAX))
+		else if (CPU_CLIPS_NEGATIVE == 0 && tmp < (-1.0 * INT_MAX))
 			dest [i] = INT_MIN ;
 		else
 			dest [i] = psf_lrint (tmp) ;

+ 2 - 2
Engine/lib/libsndfile/src/dwvw.c

@@ -370,7 +370,7 @@ dwvw_decode_load_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int bit_count)
 
 	if (bit_count < 0)
 	{	get_dwm = SF_TRUE ;
-		/* modify bit_count to ensure we have enough bits for finding dwm. */
+		/* modify bit_count to ensure we have enought bits for finding dwm. */
 		bit_count = pdwvw->dwm_maxsize ;
 		} ;
 
@@ -428,7 +428,7 @@ static void
 dwvw_encode_store_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int data, int new_bits)
 {	int 	byte ;
 
-	/* Shift the bits into the reservoir. */
+	/* Shift the bits into the resevoir. */
 	pdwvw->bits = arith_shift_left (pdwvw->bits, new_bits) | (data & (arith_shift_left (1, new_bits) - 1)) ;
 	pdwvw->bit_count += new_bits ;
 

+ 1 - 1
Engine/lib/libsndfile/src/file_io.c

@@ -66,7 +66,7 @@
 #define	SENSIBLE_SIZE	(0x40000000)
 
 /*
-**	Neat solution to the Win32/OS2 binary file flag requirement.
+**	Neat solution to the Win32/OS2 binary file flage requirement.
 **	If O_BINARY isn't already defined by the inclusion of the system
 **	headers, set it to zero.
 */

+ 3 - 3
Engine/lib/libsndfile/src/float32.c

@@ -413,7 +413,7 @@ float32_get_capability	(SF_PRIVATE *psf)
 		unsigned char	c [4] ;
 	} data ;
 
-	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
+	data.f = (float) 1.23456789 ; /* Some abitrary value. */
 
 	if (! psf->ieee_replace)
 	{	/* If this test is true ints and floats are compatible and little endian. */
@@ -468,9 +468,9 @@ f2i_clip_array (const float *src, int count, int *dest, float scale)
 {	for (int i = 0 ; i < count ; i++)
 	{	float tmp = scale * src [i] ;
 
-		if (tmp > (1.0 * INT_MAX))
+		if (CPU_CLIPS_POSITIVE == 0 && tmp > (1.0 * INT_MAX))
 			dest [i] = INT_MAX ;
-		else if (tmp < (-1.0 * INT_MAX))
+		else if (CPU_CLIPS_NEGATIVE == 0 && tmp < (-1.0 * INT_MAX))
 			dest [i] = INT_MIN ;
 		else
 			dest [i] = psf_lrintf (tmp) ;

+ 7 - 3
Engine/lib/libsndfile/src/ima_adpcm.c

@@ -187,7 +187,7 @@ ima_reader_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
 	**	to avoid having to branch when pulling apart the nibbles.
 	*/
 	count = ((samplesperblock - 2) | 7) + 2 ;
-	pimasize = sizeof (IMA_ADPCM_PRIVATE) + psf->sf.channels * (blockalign + samplesperblock + sizeof (short) * count) ;
+	pimasize = sizeof (IMA_ADPCM_PRIVATE) + psf->sf.channels * (blockalign + samplesperblock + sizeof(short) * count) ;
 
 	if (! (pima = calloc (1, pimasize)))
 		return SFE_MALLOC_FAILED ;
@@ -238,7 +238,7 @@ ima_reader_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
 		case SF_FORMAT_AIFF :
 				psf_log_printf (psf, "still need to check block count\n") ;
 				pima->decode_block = aiff_ima_decode_block ;
-				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks / pima->channels ;
+				psf->sf.frames = pima->samplesperblock * pima->blocks / pima->channels ;
 				break ;
 
 		default :
@@ -262,6 +262,9 @@ aiff_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima)
 	int		chan, k, diff, bytecode, predictor ;
 	short	step, stepindx, *sampledata ;
 
+static int count = 0 ;
+count ++ ;
+
 	pima->blockcount += pima->channels ;
 	pima->samplecount = 0 ;
 
@@ -388,7 +391,7 @@ aiff_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima)
 static int
 wavlike_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima)
 {	int		chan, k, predictor, blockindx, indx, indxstart, diff ;
-	short	step, bytecode, stepindx [2] = { 0 } ;
+	short	step, bytecode, stepindx [2] = { 0 };
 
 	pima->blockcount ++ ;
 	pima->samplecount = 0 ;
@@ -1002,3 +1005,4 @@ ima_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
 
 	return total ;
 } /* ima_write_d */
+

+ 5 - 5
Engine/lib/libsndfile/src/ircam.c

@@ -171,35 +171,35 @@ ircam_read_header	(SF_PRIVATE *psf)
 	switch (encoding)
 	{	case IRCAM_PCM_16 :
 				psf->bytewidth = 2 ;
-				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
+				psf->blockwidth = psf->sf.channels * psf->bytewidth ;
 
 				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_PCM_16 ;
 				break ;
 
 		case IRCAM_PCM_32 :
 				psf->bytewidth = 4 ;
-				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
+				psf->blockwidth = psf->sf.channels * psf->bytewidth ;
 
 				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_PCM_32 ;
 				break ;
 
 		case IRCAM_FLOAT :
 				psf->bytewidth = 4 ;
-				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
+				psf->blockwidth = psf->sf.channels * psf->bytewidth ;
 
 				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_FLOAT ;
 				break ;
 
 		case IRCAM_ALAW :
 				psf->bytewidth = 1 ;
-				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
+				psf->blockwidth = psf->sf.channels * psf->bytewidth ;
 
 				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_ALAW ;
 				break ;
 
 		case IRCAM_ULAW :
 				psf->bytewidth = 1 ;
-				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
+				psf->blockwidth = psf->sf.channels * psf->bytewidth ;
 
 				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_ULAW ;
 				break ;

+ 2 - 2
Engine/lib/libsndfile/src/mat4.c

@@ -104,7 +104,7 @@ mat4_open	(SF_PRIVATE *psf)
 
 	psf->container_close = mat4_close ;
 
-	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
+	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
 
 	switch (subformat)
 	{	case SF_FORMAT_PCM_16 :
@@ -320,7 +320,7 @@ mat4_read_header (SF_PRIVATE *psf)
 				psf->filelength - psf->dataoffset, psf->sf.channels * psf->sf.frames * psf->bytewidth) ;
 		}
 	else if ((psf->filelength - psf->dataoffset) > psf->sf.channels * psf->sf.frames * psf->bytewidth)
-		psf->dataend = psf->dataoffset + (sf_count_t) rows * (sf_count_t) cols * psf->bytewidth ;
+		psf->dataend = psf->dataoffset + rows * cols * psf->bytewidth ;
 
 	psf->datalength = psf->filelength - psf->dataoffset - psf->dataend ;
 

+ 1 - 1
Engine/lib/libsndfile/src/mat5.c

@@ -114,7 +114,7 @@ mat5_open	(SF_PRIVATE *psf)
 
 	psf->container_close = mat5_close ;
 
-	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
+	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
 
 	switch (subformat)
 	{	case SF_FORMAT_PCM_U8 :

+ 46 - 45
Engine/lib/libsndfile/src/nms_adpcm.c

@@ -48,36 +48,36 @@
 /* Variable names from ITU G.726 spec */
 struct nms_adpcm_state
 {	/* Log of the step size multiplier. Operated on by codewords. */
-	short yl ;
+	int yl ;
 
 	/* Quantizer step size multiplier. Generated from yl. */
-	short y ;
+	int y ;
 
-	/* Coefficients of the pole predictor */
-	short a [2] ;
+	/* Coefficents of the pole predictor */
+	int a [2] ;
 
-	/* Coefficients of the zero predictor  */
-	short b [6] ;
+	/* Coefficents of the zero predictor  */
+	int b [6] ;
 
 	/* Previous quantized deltas (multiplied by 2^14) */
-	short d_q [7] ;
+	int d_q [7] ;
 
 	/* d_q [x] + s_ez [x], used by the pole-predictor for signs only. */
-	short p [3] ;
+	int p [3] ;
 
 	/* Previous reconstructed signal values. */
-	short s_r [2] ;
+	int s_r [2] ;
 
 	/* Zero predictor components of the signal estimate. */
-	short s_ez ;
+	int s_ez ;
 
 	/* Signal estimate, (including s_ez). */
-	short s_e ;
+	int s_e ;
 
 	/* The most recent codeword (enc:generated, dec:inputted) */
-	char Ik ;
+	int Ik ;
 
-	char parity ;
+	int parity ;
 
 	/*
 	** Offset into code tables for the bitrate.
@@ -109,7 +109,7 @@ typedef struct
 } NMS_ADPCM_PRIVATE ;
 
 /* Pre-computed exponential interval used in the antilog approximation. */
-static unsigned short table_expn [] =
+static unsigned int table_expn [] =
 {	0x4000, 0x4167, 0x42d5, 0x444c,	0x45cb, 0x4752, 0x48e2, 0x4a7a,
 	0x4c1b, 0x4dc7, 0x4f7a, 0x5138,	0x52ff, 0x54d1, 0x56ac, 0x5892,
 	0x5a82, 0x5c7e, 0x5e84, 0x6096,	0x62b4, 0x64dd, 0x6712, 0x6954,
@@ -117,21 +117,21 @@ static unsigned short table_expn [] =
 } ;
 
 /* Table mapping codewords to scale factor deltas. */
-static short table_scale_factor_step [] =
+static int table_scale_factor_step [] =
 {	0x0,	0x0,	0x0,	0x0,	0x4b0,	0x0,	0x0,	0x0,	/* 2-bit */
 	-0x3c,	0x0,	0x90,	0x0,	0x2ee,	0x0,	0x898,	0x0,	/* 3-bit */
 	-0x30,	0x12,	0x6b,	0xc8,	0x188,	0x2e0,	0x551,	0x1150,	/* 4-bit */
 } ;
 
 /* Table mapping codewords to quantized delta interval steps. */
-static unsigned short table_step [] =
+static unsigned int table_step [] =
 {	0x73F,	0,		0,		0,		0x1829,	0,		0,		0,		/* 2-bit */
 	0x3EB,	0,		0xC18,	0,		0x1581,	0,		0x226E,	0,		/* 3-bit */
 	0x20C,	0x635,	0xA83,	0xF12,	0x1418,	0x19E3,	0x211A,	0x2BBA,	/* 4-bit */
 } ;
 
 /* Binary search lookup table for quantizing using table_step. */
-static short table_step_search [] =
+static int table_step_search [] =
 {	0,		0x1F6D,	0,		-0x1F6D,	0,		0,			0,			0, /* 2-bit */
 	0x1008,	0x1192,	0,		-0x219A,	0x1656,	-0x1656,	0,			0, /* 3-bit */
 	0x872,	0x1277,	-0x8E6,	-0x232B,	0xD06,	-0x17D7,	-0x11D3,	0, /* 4-bit */
@@ -179,23 +179,23 @@ static sf_count_t nms_adpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
 ** Maps [1,20480] to [1,1024] in an exponential relationship. This is
 ** approximately ret = b^exp where b = e^(ln(1024)/ln(20480)) ~= 1.0003385
 */
-static inline short
-nms_adpcm_antilog (short exp)
-{	int_fast32_t r ;
+static inline int
+nms_adpcm_antilog (int exp)
+{	int ret ;
 
-	r = 0x1000 ;
-	r += (((int_fast32_t) (exp & 0x3f) * 0x166b) >> 12) ;
-	r *= table_expn [(exp & 0x7c0) >> 6] ;
-	r >>= (26 - (exp >> 11)) ;
+	ret = 0x1000 ;
+	ret += (((exp & 0x3f) * 0x166b) >> 12) ;
+	ret *= table_expn [(exp & 0x7c0) >> 6] ;
+	ret >>= (26 - (exp >> 11)) ;
 
-	return (short) r ;
+	return ret ;
 } /* nms_adpcm_antilog */
 
 static void
 nms_adpcm_update (struct nms_adpcm_state *s)
 {	/* Variable names from ITU G.726 spec */
-	short a1ul, fa1 ;
-	int_fast32_t se ;
+	int a1ul ;
+	int fa1 ;
 	int i ;
 
 	/* Decay and Modify the scale factor in the log domain based on the codeword. */
@@ -206,7 +206,7 @@ nms_adpcm_update (struct nms_adpcm_state *s)
 		s->yl = 20480 ;
 	s->y = nms_adpcm_antilog (s->yl) ;
 
-	/* Update the zero predictor coefficients. */
+	/* Update the zero predictor coefficents. */
 	for (i = 0 ; i < 6 ; i++)
 	{	s->b [i] = (s->b [i] * 0xff) >> 8 ;
 		if ((s->d_q [0] ^ s->d_q [i + 1]) >= 0)
@@ -215,14 +215,14 @@ nms_adpcm_update (struct nms_adpcm_state *s)
 			s->b [i] -= 128 ;
 		}
 
-	/* Update the pole predictor coefficients. */
+	/* Update the pole predictor coefficents. */
 	fa1 = s->a [0] >> 5 ;
 	if (fa1 < -256)
 		fa1 = -256 ;
 	else if (fa1 > 256)
 		fa1 = 256 ;
 
-	s->a [0] = (s->a [0] * 0xff) >> 8 ;
+	s->a [0] = (0xff * s->a [0]) >> 8 ;
 	if (s->p [0] != 0 && s->p [1] != 0 && ((s->p [0] ^ s->p [1]) < 0))
 		s->a [0] -= 192 ;
 	else
@@ -230,7 +230,7 @@ nms_adpcm_update (struct nms_adpcm_state *s)
 		fa1 = -fa1 ;
 		}
 
-	s->a [1] = fa1 + ((s->a [1] * 0xfe) >> 8) ;
+	s->a [1] = fa1 + ((0xfe * s->a [1]) >> 8) ;
 	if (s->p [0] != 0 && s->p [2] != 0 && ((s->p [0] ^ s->p [2]) < 0))
 		s->a [1] -= 128 ;
 	else
@@ -250,18 +250,19 @@ nms_adpcm_update (struct nms_adpcm_state *s)
 			s->a [0] = a1ul ;
 		} ;
 
-	/* Compute the zero predictor estimate and rotate past deltas. */
-	se = 0 ;
+	/* Compute the zero predictor estimate. Rotate past deltas too. */
+	s->s_ez = 0 ;
 	for (i = 5 ; i >= 0 ; i--)
-	{	se += (int_fast32_t) s->d_q [i] * s->b [i] ;
+	{	s->s_ez += s->d_q [i] * s->b [i] ;
 		s->d_q [i + 1] = s->d_q [i] ;
 		} ;
-	s->s_ez = se >> 14 ;
 
-	/* Complete the signal estimate. */
-	se += (int_fast32_t) s->a [0] * s->s_r [0] ;
-	se += (int_fast32_t) s->a [1] * s->s_r [1] ;
-	s->s_e = se >> 14 ;
+	/* Compute the signal estimate. */
+	s->s_e = s->a [0] * s->s_r [0] + s->a [1] * s->s_r [1] + s->s_ez ;
+
+	/* Return to scale */
+	s->s_ez >>= 14 ;
+	s->s_e >>= 14 ;
 
 	/* Rotate members to prepare for next iteration. */
 	s->s_r [1] = s->s_r [0] ;
@@ -273,7 +274,7 @@ nms_adpcm_update (struct nms_adpcm_state *s)
 static int16_t
 nms_adpcm_reconstruct_sample (struct nms_adpcm_state *s, uint8_t I)
 {	/* Variable names from ITU G.726 spec */
-	int_fast32_t dqx ;
+	int dqx ;
 
 	/*
 	** The ordering of the 12-bit right-shift is a precision loss. It agrees
@@ -307,17 +308,17 @@ nms_adpcm_codec_init (struct nms_adpcm_state *s, enum nms_enc_type type)
 /*
 ** nms_adpcm_encode_sample()
 **
-** Encode a linear 16-bit pcm sample into a 2, 3, or 4 bit NMS-ADPCM codeword
+** Encode a linear 16-bit pcm sample into a 2,3, or 4 bit NMS-ADPCM codeword
 ** using and updating the predictor state.
 */
 static uint8_t
 nms_adpcm_encode_sample (struct nms_adpcm_state *s, int16_t sl)
 {	/* Variable names from ITU G.726 spec */
-	int_fast32_t d ;
+	int d ;
 	uint8_t I ;
 
 	/* Down scale the sample from 16 => ~14 bits. */
-	sl = ((int_fast32_t) sl * 0x1fdf) / 0x7fff ;
+	sl = (sl * 0x1fdf) / 0x7fff ;
 
 	/* Compute estimate, and delta from actual value */
 	nms_adpcm_update (s) ;
@@ -406,7 +407,7 @@ nms_adpcm_encode_sample (struct nms_adpcm_state *s, int16_t sl)
 */
 static int16_t
 nms_adpcm_decode_sample (struct nms_adpcm_state *s, uint8_t I)
-{	int_fast32_t sl ;
+{	int sl ;
 
 	nms_adpcm_update (s) ;
 	sl = nms_adpcm_reconstruct_sample (s, I) ;
@@ -1090,7 +1091,7 @@ nms_adpcm_init (SF_PRIVATE *psf)
 	else
 		pnms->blocks_total = psf->datalength / (pnms->shortsperblock * sizeof (short)) ;
 
-	psf->sf.frames		= (sf_count_t) pnms->blocks_total * NMS_SAMPLES_PER_BLOCK ;
+	psf->sf.frames		= pnms->blocks_total * NMS_SAMPLES_PER_BLOCK ;
 	psf->codec_close	= nms_adpcm_close ;
 	psf->seek			= nms_adpcm_seek ;
 

+ 6 - 10
Engine/lib/libsndfile/src/ogg.c

@@ -211,16 +211,12 @@ ogg_read_first_page (SF_PRIVATE *psf, OGG_PRIVATE *odata)
 
 int
 ogg_write_page (SF_PRIVATE *psf, ogg_page *page)
-{	int n ;
+{	int bytes ;
 
-	n = psf_fwrite (page->header, 1, page->header_len, psf) ;
-	if (n == page->header_len)
-		n += psf_fwrite (page->body, 1, page->body_len, psf) ;
+	bytes = psf_fwrite (page->header, 1, page->header_len, psf) ;
+	bytes += psf_fwrite (page->body, 1, page->body_len, psf) ;
 
-	if (n != page->body_len + page->header_len)
-		return -1 ;
-
-	return n ;
+	return bytes == page->header_len + page->body_len ;
 } /* ogg_write_page */
 
 sf_count_t
@@ -387,7 +383,7 @@ ogg_stream_unpack_page (SF_PRIVATE *psf, OGG_PRIVATE *odata)
 	/*
 	** Unpack all the packets on the page. It is undocumented (like much of
 	** libOgg behavior) but all packets from a page read into the stream are
-	** guaranteed to remain valid in memory until a new page is read into the
+	** guarenteed to remain valid in memory until a new page is read into the
 	** stream.
 	*/
 	for (i = 1 ; ; i++)
@@ -823,7 +819,7 @@ ogg_stream_classify (SF_PRIVATE *psf, OGG_PRIVATE* odata)
 			break ;
 		} ;
 
-	psf_log_printf (psf, "This Ogg bitstream contains some unknown data type.\n") ;
+	psf_log_printf (psf, "This Ogg bitstream contains some uknown data type.\n") ;
 	return SFE_UNIMPLEMENTED ;
 } /* ogg_stream_classify */
 

+ 1 - 1
Engine/lib/libsndfile/src/ogg.h

@@ -151,7 +151,7 @@ int ogg_stream_unpack_page (SF_PRIVATE *psf, OGG_PRIVATE *odata) ;
 
 /*
 ** Seek within the Ogg virtual bitstream for a page containing target_gp.
-** Performs a bisection search. If not found exactly, the best result is
+** Preforms a bisection search. If not found exactly, the best result is
 ** returned in *best_gp. Found page is loaded into the virtual bitstream,
 ** ready for unpacking. Arguments pcm_start and pcm_end are the highest and
 ** lowest granule positions of the file. begin and end are the file offset

+ 12 - 15
Engine/lib/libsndfile/src/ogg_opus.c

@@ -72,7 +72,7 @@
 **  - Samples shall refer to discrete PCM values, regardless of any channel
 **	considerations. This is the same as what libsndfile calls samples.
 **  - Samples/channel shall refer to groups of samples, one for each channel.
-**	This is what Opus calls samples, and what libsndfile calls frames. It
+**	This is what Opus calles samples, and what libsndfile calles frames. It
 **	has the advantage that its name is also the formula to calculate it.
 **
 **
@@ -827,16 +827,15 @@ ogg_opus_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 
 	/* The first page MUST only contain the header, so flush it out now */
 	ogg_stream_packetin (&odata->ostream, &op) ;
-	while (ogg_stream_flush (&odata->ostream, &odata->opage))
-	{	nn = ogg_write_page (psf, &odata->opage) ;
-		if (nn < 0)
+	for ( ; (nn = ogg_stream_flush (&odata->ostream, &odata->opage)) ; )
+	{	if (! (nn = ogg_write_page (psf, &odata->opage)))
 		{	psf_log_printf (psf, "Opus : Failed to write header!\n") ;
 			if (psf->error)
 				return psf->error ;
 			return SFE_INTERNAL ;
 			} ;
 		psf->dataoffset += nn ;
-		} ;
+		}
 
 	/*
 	** Metadata Tags (manditory)
@@ -851,16 +850,15 @@ ogg_opus_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 	vorbiscomment_write_tags (psf, &op, &opustags_ident, opus_get_version_string (), - (OGG_OPUS_COMMENT_PAD)) ;
 	op.packetno = 2 ;
 	ogg_stream_packetin (&odata->ostream, &op) ;
-	while (ogg_stream_flush (&odata->ostream, &odata->opage))
-	{	nn = ogg_write_page (psf, &odata->opage) ;
-		if (nn < 0)
+	for ( ; (nn = ogg_stream_flush (&odata->ostream, &odata->opage)) ; )
+	{	if (! (nn = ogg_write_page (psf, &odata->opage)))
 		{	psf_log_printf (psf, "Opus : Failed to write comments!\n") ;
 			if (psf->error)
 				return psf->error ;
 			return SFE_INTERNAL ;
 			} ;
 		psf->dataoffset += nn ;
-		} ;
+		}
 
 	return 0 ;
 } /* ogg_opus_write_header */
@@ -1134,8 +1132,7 @@ ogg_opus_write_out (SF_PRIVATE *psf, OGG_PRIVATE *odata, OPUS_PRIVATE *oopus)
 		if (nbytes > 0)
 		{	oopus->u.encode.last_segments -= ogg_page_segments (&odata->opage) ;
 			oopus->pg_pos = oopus->pkt_pos ;
-			if (ogg_write_page (psf, &odata->opage) < 0)
-				return -1 ;
+			ogg_write_page (psf, &odata->opage) ;
 			}
 		else
 			break ;
@@ -1451,7 +1448,7 @@ ogg_opus_analyze_file (SF_PRIVATE *psf)
 		oopus->pkt_pos = oopus->pg_pos - gp ;
 		}
 	else if (gp < oopus->pg_pos)
-	{	psf_log_printf (psf, "Opus : First data page is also the last, and granule position has an (ambiguous) offset.\n") ;
+	{	psf_log_printf (psf, "Opus : First data page is also the last, and granule position has an (ambigious) offset.\n") ;
 		return SFE_MALFORMED_FILE ;
 		} ;
 	oopus->u.decode.gp_start = oopus->pkt_pos ;
@@ -1514,7 +1511,7 @@ ogg_opus_null_read (SF_PRIVATE *psf, sf_count_t offset)
 				return total ;
 			/*
 			** Ignore pre-skip skipping. The preskip was accounted for in the
-			** argument to offset, so we need to count it.
+			** arugment to offset, so we need to count it.
 			*/
 			oopus->loc = 0 ;
 			} ;
@@ -1612,7 +1609,7 @@ ogg_opus_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
 
 	/* Figure out the current position granule pos. Use the start of the
 	 * current buffer, to avoid backwards seeking if the target is on the page
-	 * but before the current location. */
+	 * but before the current locaiton. */
 	oopus->loc = 0 ;
 	current_gp = oopus->pkt_pos - (uint64_t) (oopus->len * oopus->sr_factor) ;
 
@@ -1647,7 +1644,7 @@ ogg_opus_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
 			if (ret < 0)
 			{	/*
 				** Page seek failed, what to do? Could be bad data. We can
-				** either fall-back to manual seeking or bail. Manual seeking
+				** either fall-back to manual seeking or bail. Manaul seeking
 				** from the beginning has the advantage of finding where the
 				** file goes bad.
 				*/

+ 1 - 1
Engine/lib/libsndfile/src/ogg_vcomment.c

@@ -79,7 +79,7 @@ vorbiscomment_read_tags (SF_PRIVATE *psf, ogg_packet *packet, vorbiscomment_iden
 
 	/*
 	** The smallest possible header is the ident string length plus two 4-byte
-	** integers, (vendor string length, tags count.)
+	** integers, (vender string length, tags count.)
 	*/
 	if (packet->bytes < (ident ? ident->length : 0) + 4 + 4)
 		return SFE_MALFORMED_FILE ;

+ 75 - 97
Engine/lib/libsndfile/src/ogg_vorbis.c

@@ -82,6 +82,28 @@
 /* How many seconds in the future to not bother bisection searching for. */
 #define VORBIS_SEEK_THRESHOLD 2
 
+typedef int convert_func (SF_PRIVATE *psf, int, void *, int, int, float **) ;
+
+static int	vorbis_read_header (SF_PRIVATE *psf) ;
+static int	vorbis_write_header (SF_PRIVATE *psf, int calc_length) ;
+static int	vorbis_close (SF_PRIVATE *psf) ;
+static int	vorbis_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
+static int	vorbis_byterate (SF_PRIVATE *psf) ;
+static int	vorbis_calculate_granulepos (SF_PRIVATE *psf, uint64_t *gp_out) ;
+static int	vorbis_skip (SF_PRIVATE *psf, uint64_t target_gp) ;
+static int	vorbis_seek_trysearch (SF_PRIVATE *psf, uint64_t target_gp) ;
+static sf_count_t	vorbis_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
+static sf_count_t	vorbis_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
+static sf_count_t	vorbis_read_sample (SF_PRIVATE *psf, void *ptr, sf_count_t lens, convert_func *transfn) ;
+static int	vorbis_rnull (SF_PRIVATE *psf, int samples, void *vptr, int off , int channels, float **pcm) ;
+
 typedef struct
 {	int id ;
 	const char *name ;
@@ -123,45 +145,6 @@ typedef struct
 	sf_count_t last_page ;
 } VORBIS_PRIVATE ;
 
-typedef int convert_func (SF_PRIVATE *psf, int, void *, int, int, float **) ;
-
-static int	vorbis_read_header (SF_PRIVATE *psf) ;
-static int	vorbis_write_header (SF_PRIVATE *psf, int calc_length) ;
-static int	vorbis_close (SF_PRIVATE *psf) ;
-static int	vorbis_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
-static int	vorbis_byterate (SF_PRIVATE *psf) ;
-static int	vorbis_calculate_granulepos (SF_PRIVATE *psf, uint64_t *gp_out) ;
-static int	vorbis_skip (SF_PRIVATE *psf, uint64_t target_gp) ;
-static int	vorbis_seek_trysearch (SF_PRIVATE *psf, uint64_t target_gp) ;
-static sf_count_t	vorbis_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
-static sf_count_t	vorbis_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
-static sf_count_t	vorbis_read_sample (SF_PRIVATE *psf, void *ptr, sf_count_t lens, convert_func *transfn) ;
-static int	vorbis_write_samples (SF_PRIVATE *psf, OGG_PRIVATE *odata, VORBIS_PRIVATE *vdata, int in_frames) ;
-static int	vorbis_rnull (SF_PRIVATE *psf, int samples, void *vptr, int off , int channels, float **pcm) ;
-static void	vorbis_log_error (SF_PRIVATE *psf, int error) ;
-
-
-static void
-vorbis_log_error(SF_PRIVATE *psf, int error) {
-	switch (error)
-	{	case 0: return;
-		case OV_EIMPL:		psf->error = SFE_UNIMPLEMENTED ; break ;
-		case OV_ENOTVORBIS:	psf->error = SFE_MALFORMED_FILE ; break ;
-		case OV_EBADHEADER:	psf->error = SFE_MALFORMED_FILE ; break ;
-		case OV_EVERSION:	psf->error = SFE_UNSUPPORTED_ENCODING ; break ;
-		case OV_EFAULT:
-		case OV_EINVAL:
-		default: psf->error = SFE_INTERNAL ;
-		} ;
-} ;
-
 static int
 vorbis_read_header (SF_PRIVATE *psf)
 {	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
@@ -397,6 +380,7 @@ vorbis_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 	{	ogg_packet header ;
 		ogg_packet header_comm ;
 		ogg_packet header_code ;
+		int result ;
 
 		vorbis_analysis_headerout (&vdata->vdsp, &vdata->vcomment, &header, &header_comm, &header_code) ;
 		ogg_stream_packetin (&odata->ostream, &header) ; /* automatically placed in its own page */
@@ -406,9 +390,9 @@ vorbis_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
 		/* This ensures the actual
 		 * audio data will start on a new page, as per spec
 		 */
-		while (ogg_stream_flush (&odata->ostream, &odata->opage))
-			if (ogg_write_page (psf, &odata->opage) < 0)
-				return -1 ;
+		while ((result = ogg_stream_flush (&odata->ostream, &odata->opage)) != 0)
+		{	ogg_write_page (psf, &odata->opage) ;
+			} ;
 	}
 
 	return 0 ;
@@ -418,25 +402,44 @@ static int
 vorbis_close (SF_PRIVATE *psf)
 {	OGG_PRIVATE* odata = psf->container_data ;
 	VORBIS_PRIVATE *vdata = psf->codec_data ;
-	int ret = 0 ;
 
 	if (odata == NULL || vdata == NULL)
 		return 0 ;
 
-	/*	Clean up this logical bitstream ; before exit we should see if we're
+	/*	Clean up this logical bitstream ; before exit we shuld see if we're
 	**	followed by another [chained]. */
 
 	if (psf->file.mode == SFM_WRITE)
 	{
 		if (psf->write_current <= 0)
-			ret = vorbis_write_header (psf, 0) ;
+			vorbis_write_header (psf, 0) ;
 
-		if (ret == 0)
-		{	/* A write of zero samples tells Vorbis the stream is done and to
-			   flush. */
-			ret = vorbis_write_samples (psf, odata, vdata, 0) ;
-			} ;
-		} ;
+		vorbis_analysis_wrote (&vdata->vdsp, 0) ;
+		while (vorbis_analysis_blockout (&vdata->vdsp, &vdata->vblock) == 1)
+		{
+
+		/* analysis, assume we want to use bitrate management */
+			vorbis_analysis (&vdata->vblock, NULL) ;
+			vorbis_bitrate_addblock (&vdata->vblock) ;
+
+			while (vorbis_bitrate_flushpacket (&vdata->vdsp, &odata->opacket))
+			{	/* weld the packet into the bitstream */
+				ogg_stream_packetin (&odata->ostream, &odata->opacket) ;
+
+				/* write out pages (if any) */
+				while (!odata->eos)
+				{	int result = ogg_stream_pageout (&odata->ostream, &odata->opage) ;
+					if (result == 0) break ;
+					ogg_write_page (psf, &odata->opage) ;
+
+		/* this could be set above, but for illustrative purposes, I do
+		   it here (to show that vorbis does know where the stream ends) */
+
+					if (ogg_page_eos (&odata->opage)) odata->eos = 1 ;
+				}
+			}
+		}
+	}
 
 	/* ogg_page and ogg_packet structs always point to storage in
 	   libvorbis.  They are never freed or manipulated directly */
@@ -446,7 +449,7 @@ vorbis_close (SF_PRIVATE *psf)
 	vorbis_comment_clear (&vdata->vcomment) ;
 	vorbis_info_clear (&vdata->vinfo) ;
 
-	return ret ;
+	return 0 ;
 } /* vorbis_close */
 
 int
@@ -685,40 +688,33 @@ vorbis_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t lens)
 /*==============================================================================
 */
 
-static int
+static void
 vorbis_write_samples (SF_PRIVATE *psf, OGG_PRIVATE *odata, VORBIS_PRIVATE *vdata, int in_frames)
-{	int ret ;
-
-	if ((ret = vorbis_analysis_wrote (&vdata->vdsp, in_frames)) != 0)
-		return ret ;
+{
+	vorbis_analysis_wrote (&vdata->vdsp, in_frames) ;
 
 	/*
 	**	Vorbis does some data preanalysis, then divvies up blocks for
 	**	more involved (potentially parallel) processing. Get a single
 	**	block for encoding now.
 	*/
-	while ((ret = vorbis_analysis_blockout (&vdata->vdsp, &vdata->vblock)) == 1)
+	while (vorbis_analysis_blockout (&vdata->vdsp, &vdata->vblock) == 1)
 	{
 		/* analysis, assume we want to use bitrate management */
-		if ((ret = vorbis_analysis (&vdata->vblock, NULL)) != 0)
-			return ret ;
-		if ((ret = vorbis_bitrate_addblock (&vdata->vblock)) != 0)
-			return ret ;
+		vorbis_analysis (&vdata->vblock, NULL) ;
+		vorbis_bitrate_addblock (&vdata->vblock) ;
 
-		while ((ret = vorbis_bitrate_flushpacket (&vdata->vdsp, &odata->opacket)) == 1)
+		while (vorbis_bitrate_flushpacket (&vdata->vdsp, &odata->opacket))
 		{
 			/* weld the packet into the bitstream */
-			if ((ret = ogg_stream_packetin (&odata->ostream, &odata->opacket)) != 0)
-				return ret ;
+			ogg_stream_packetin (&odata->ostream, &odata->opacket) ;
 
 			/* write out pages (if any) */
 			while (!odata->eos)
-			{	ret = ogg_stream_pageout (&odata->ostream, &odata->opage) ;
-				if (ret == 0)
+			{	int result = ogg_stream_pageout (&odata->ostream, &odata->opage) ;
+				if (result == 0)
 					break ;
-
-				if (ogg_write_page (psf, &odata->opage) < 0)
-					return -1 ;
+				ogg_write_page (psf, &odata->opage) ;
 
 				/*	This could be set above, but for illustrative purposes, I do
 				**	it here (to show that vorbis does know where the stream ends) */
@@ -726,22 +722,16 @@ vorbis_write_samples (SF_PRIVATE *psf, OGG_PRIVATE *odata, VORBIS_PRIVATE *vdata
 					odata->eos = 1 ;
 				} ;
 			} ;
-		if (ret != 0)
-			return ret ;
 		} ;
-	if (ret != 0)
-		return ret ;
 
 	vdata->gp += in_frames ;
-
-	return 0 ;
 } /* vorbis_write_data */
 
 
 static sf_count_t
 vorbis_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t lens)
 {
-	int i, m, j = 0, ret ;
+	int i, m, j = 0 ;
 	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
 	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
 	int in_frames = lens / psf->sf.channels ;
@@ -750,17 +740,14 @@ vorbis_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t lens)
 		for (m = 0 ; m < psf->sf.channels ; m++)
 			buffer [m][i] = (float) (ptr [j++]) / 32767.0f ;
 
-	if ((ret = vorbis_write_samples (psf, odata, vdata, in_frames)))
-	{	vorbis_log_error (psf, ret) ;
-		return 0 ;
-		} ;
+	vorbis_write_samples (psf, odata, vdata, in_frames) ;
 
 	return lens ;
 } /* vorbis_write_s */
 
 static sf_count_t
 vorbis_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t lens)
-{	int i, m, j = 0, ret ;
+{	int i, m, j = 0 ;
 	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
 	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
 	int in_frames = lens / psf->sf.channels ;
@@ -769,17 +756,14 @@ vorbis_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t lens)
 		for (m = 0 ; m < psf->sf.channels ; m++)
 			buffer [m][i] = (float) (ptr [j++]) / 2147483647.0f ;
 
-	if ((ret = vorbis_write_samples (psf, odata, vdata, in_frames)))
-	{	vorbis_log_error (psf, ret) ;
-		return 0 ;
-		} ;
+	vorbis_write_samples (psf, odata, vdata, in_frames) ;
 
 	return lens ;
 } /* vorbis_write_i */
 
 static sf_count_t
 vorbis_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t lens)
-{	int i, m, j = 0, ret ;
+{	int i, m, j = 0 ;
 	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
 	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
 	int in_frames = lens / psf->sf.channels ;
@@ -788,17 +772,14 @@ vorbis_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t lens)
 		for (m = 0 ; m < psf->sf.channels ; m++)
 			buffer [m][i] = ptr [j++] ;
 
-	if ((ret = vorbis_write_samples (psf, odata, vdata, in_frames)) != 0)
-	{	vorbis_log_error (psf, ret) ;
-		return 0 ;
-		} ;
+	vorbis_write_samples (psf, odata, vdata, in_frames) ;
 
 	return lens ;
 } /* vorbis_write_f */
 
 static sf_count_t
 vorbis_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t lens)
-{	int i, m, j = 0, ret ;
+{	int i, m, j = 0 ;
 	OGG_PRIVATE *odata = (OGG_PRIVATE *) psf->container_data ;
 	VORBIS_PRIVATE *vdata = (VORBIS_PRIVATE *) psf->codec_data ;
 	int in_frames = lens / psf->sf.channels ;
@@ -807,10 +788,7 @@ vorbis_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t lens)
 		for (m = 0 ; m < psf->sf.channels ; m++)
 			buffer [m][i] = (float) ptr [j++] ;
 
-	if ((ret = vorbis_write_samples (psf, odata, vdata, in_frames)) != 0)
-	{	vorbis_log_error (psf, ret) ;
-		return 0 ;
-		} ;
+	vorbis_write_samples (psf, odata, vdata, in_frames) ;
 
 	return lens ;
 } /* vorbis_write_d */
@@ -906,7 +884,7 @@ vorbis_seek_trysearch (SF_PRIVATE *psf, uint64_t target_gp)
 		return 0 ;
 
 	/*	Search for a position a half large-block before our target. As Vorbis is
-	**	lapped, every sample position comes from two blocks, the "left" half of
+	**	lapped, every sample position come from two blocks, the "left" half of
 	**	one block and the "right" half of the previous block.  The granule
 	**	position of an Ogg page of a Vorbis stream is the sample offset of the
 	**	last finished sample in the stream that can be decoded from a page.  A

+ 1 - 1
Engine/lib/libsndfile/src/paf.c

@@ -350,7 +350,7 @@ paf24_init (SF_PRIVATE *psf)
 					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
 
 	/*
-	**	Not exactly sure why this needs to be here but the tests
+	**	Not exatly sure why this needs to be here but the tests
 	**	fail without it.
 	*/
 	psf->last_op = 0 ;

+ 93 - 61
Engine/lib/libsndfile/src/pcm.c

@@ -127,7 +127,7 @@ pcm_init (SF_PRIVATE *psf)
 		return SFE_INTERNAL ;
 		} ;
 
-	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
+	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
 
 	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
 		chars = SF_CHARS_SIGNED ;
@@ -1782,20 +1782,20 @@ static void
 f2sc_clip_array (const float *src, signed char *dest, int count, int normalize)
 {	float	normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x10) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7F))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i] = 127 ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x10))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i] = -128 ;
 			continue ;
 			} ;
 
-		dest [i] = psf_lrintf (scaled_value) ;
+		dest [i] = psf_lrintf (scaled_value) >> 24 ;
 		} ;
 } /* f2sc_clip_array */
 
@@ -1841,20 +1841,20 @@ static	void
 f2uc_clip_array	(const float *src, unsigned char *dest, int count, int normalize)
 {	float	normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x10) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7F))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i] = 0xFF ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x10))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i] = 0 ;
 			continue ;
 			} ;
 
-		dest [i] = psf_lrintf (scaled_value) + 128 ;
+		dest [i] = (psf_lrintf (scaled_value) >> 24) + 128 ;
 		} ;
 } /* f2uc_clip_array */
 
@@ -1907,25 +1907,25 @@ f2bes_clip_array (const float *src, short *dest, int count, int normalize)
 	float			normfact, scaled_value ;
 	int				value ;
 
-	normfact = normalize ? (8.0 * 0x1000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFF))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [1] = 0xFF ;
 			ucptr [0] = 0x7F ;
 			continue ;
 		} ;
-		if (scaled_value <= (-8.0 * 0x1000))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [1] = 0x00 ;
 			ucptr [0] = 0x80 ;
 			continue ;
 			} ;
 
 		value = psf_lrintf (scaled_value) ;
-		ucptr [1] = value ;
-		ucptr [0] = value >> 8 ;
+		ucptr [1] = value >> 16 ;
+		ucptr [0] = value >> 24 ;
 		} ;
 } /* f2bes_clip_array */
 
@@ -1978,25 +1978,25 @@ f2les_clip_array (const float *src, short *dest, int count, int normalize)
 	float			normfact, scaled_value ;
 	int				value ;
 
-	normfact = normalize ? (8.0 * 0x1000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFF))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [0] = 0xFF ;
 			ucptr [1] = 0x7F ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x1000))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [0] = 0x00 ;
 			ucptr [1] = 0x80 ;
 			continue ;
 			} ;
 
 		value = psf_lrintf (scaled_value) ;
-		ucptr [0] = value ;
-		ucptr [1] = value >> 8 ;
+		ucptr [0] = value >> 16 ;
+		ucptr [1] = value >> 24 ;
 		} ;
 } /* f2les_clip_array */
 
@@ -2047,27 +2047,31 @@ f2let_clip_array (const float *src, tribyte *dest, int count, int normalize)
 {	float	normfact, scaled_value ;
 	int		value ;
 
-	normfact = normalize ? (8.0 * 0x100000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFFFF))
+#if CPU_CLIPS_POSITIVE == 0
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i].bytes [0] = 0xFF ;
 			dest [i].bytes [1] = 0xFF ;
 			dest [i].bytes [2] = 0x7F ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x100000))
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i].bytes [0] = 0x00 ;
 			dest [i].bytes [1] = 0x00 ;
 			dest [i].bytes [2] = 0x80 ;
 			continue ;
 		} ;
+#endif
 
 		value = psf_lrintf (scaled_value) ;
-		dest [i].bytes [0] = value ;
-		dest [i].bytes [1] = value >> 8 ;
-		dest [i].bytes [2] = value >> 16 ;
+		dest [i].bytes [0] = value >> 8 ;
+		dest [i].bytes [1] = value >> 16 ;
+		dest [i].bytes [2] = value >> 24 ;
 		} ;
 } /* f2let_clip_array */
 
@@ -2118,27 +2122,31 @@ f2bet_clip_array (const float *src, tribyte *dest, int count, int normalize)
 {	float	normfact, scaled_value ;
 	int		value ;
 
-	normfact = normalize ? (8.0 * 0x100000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFFFF))
+#if CPU_CLIPS_POSITIVE == 0
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i].bytes [0] = 0x7F ;
 			dest [i].bytes [1] = 0xFF ;
 			dest [i].bytes [2] = 0xFF ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x100000))
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i].bytes [0] = 0x80 ;
 			dest [i].bytes [1] = 0x00 ;
 			dest [i].bytes [2] = 0x00 ;
 			continue ;
 		} ;
+#endif
 
 		value = psf_lrint (scaled_value) ;
-		dest [i].bytes [0] = value >> 16 ;
-		dest [i].bytes [1] = value >> 8 ;
-		dest [i].bytes [2] = value ;
+		dest [i].bytes [0] = value >> 24 ;
+		dest [i].bytes [1] = value >> 16 ;
+		dest [i].bytes [2] = value >> 8 ;
 		} ;
 } /* f2bet_clip_array */
 
@@ -2198,6 +2206,7 @@ f2bei_clip_array (const float *src, int *dest, int count, int normalize)
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
+#if CPU_CLIPS_POSITIVE == 0
 		if (scaled_value >= 1.0 * 0x7FFFFFFF)
 		{	ucptr [0] = 0x7F ;
 			ucptr [1] = 0xFF ;
@@ -2205,6 +2214,8 @@ f2bei_clip_array (const float *src, int *dest, int count, int normalize)
 			ucptr [3] = 0xFF ;
 			continue ;
 			} ;
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
 		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [0] = 0x80 ;
 			ucptr [1] = 0x00 ;
@@ -2212,6 +2223,7 @@ f2bei_clip_array (const float *src, int *dest, int count, int normalize)
 			ucptr [3] = 0x00 ;
 			continue ;
 		} ;
+#endif
 
 		value = psf_lrintf (scaled_value) ;
 		ucptr [0] = value >> 24 ;
@@ -2277,6 +2289,7 @@ f2lei_clip_array (const float *src, int *dest, int count, int normalize)
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
+#if CPU_CLIPS_POSITIVE == 0
 		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [0] = 0xFF ;
 			ucptr [1] = 0xFF ;
@@ -2284,6 +2297,8 @@ f2lei_clip_array (const float *src, int *dest, int count, int normalize)
 			ucptr [3] = 0x7F ;
 			continue ;
 			} ;
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
 		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [0] = 0x00 ;
 			ucptr [1] = 0x00 ;
@@ -2291,6 +2306,7 @@ f2lei_clip_array (const float *src, int *dest, int count, int normalize)
 			ucptr [3] = 0x80 ;
 			continue ;
 			} ;
+#endif
 
 		value = psf_lrintf (scaled_value) ;
 		ucptr [0] = value ;
@@ -2342,20 +2358,20 @@ static void
 d2sc_clip_array	(const double *src, signed char *dest, int count, int normalize)
 {	double	normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x10) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7F))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i] = 127 ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x10))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i] = -128 ;
 			continue ;
 			} ;
 
-		dest [i] = psf_lrintf (scaled_value) ;
+		dest [i] = psf_lrintf (scaled_value) >> 24 ;
 		} ;
 } /* d2sc_clip_array */
 
@@ -2401,20 +2417,20 @@ static	void
 d2uc_clip_array	(const double *src, unsigned char *dest, int count, int normalize)
 {	double	normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x10) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7F))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i] = 255 ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x10))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i] = 0 ;
 			continue ;
 			} ;
 
-		dest [i] = psf_lrint (src [i] * normfact) + 128 ;
+		dest [i] = (psf_lrint (src [i] * normfact) >> 24) + 128 ;
 		} ;
 } /* d2uc_clip_array */
 
@@ -2467,25 +2483,25 @@ d2bes_clip_array (const double *src, short *dest, int count, int normalize)
 	double			normfact, scaled_value ;
 	int				value ;
 
-	normfact = normalize ? (8.0 * 0x1000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFF))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [1] = 0xFF ;
 			ucptr [0] = 0x7F ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x1000))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [1] = 0x00 ;
 			ucptr [0] = 0x80 ;
 			continue ;
 			} ;
 
 		value = psf_lrint (scaled_value) ;
-		ucptr [1] = value ;
-		ucptr [0] = value >> 8 ;
+		ucptr [1] = value >> 16 ;
+		ucptr [0] = value >> 24 ;
 		} ;
 } /* d2bes_clip_array */
 
@@ -2538,25 +2554,25 @@ d2les_clip_array (const double *src, short *dest, int count, int normalize)
 	int				value ;
 	double			normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x1000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFF))
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [0] = 0xFF ;
 			ucptr [1] = 0x7F ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x1000))
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [0] = 0x00 ;
 			ucptr [1] = 0x80 ;
 			continue ;
 			} ;
 
 		value = psf_lrint (scaled_value) ;
-		ucptr [0] = value ;
-		ucptr [1] = value >> 8 ;
+		ucptr [0] = value >> 16 ;
+		ucptr [1] = value >> 24 ;
 		} ;
 } /* d2les_clip_array */
 
@@ -2607,27 +2623,31 @@ d2let_clip_array (const double *src, tribyte *dest, int count, int normalize)
 {	int		value ;
 	double	normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x100000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFFFF))
+#if CPU_CLIPS_POSITIVE == 0
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i].bytes [0] = 0xFF ;
 			dest [i].bytes [1] = 0xFF ;
 			dest [i].bytes [2] = 0x7F ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x100000))
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i].bytes [0] = 0x00 ;
 			dest [i].bytes [1] = 0x00 ;
 			dest [i].bytes [2] = 0x80 ;
 			continue ;
 			} ;
+#endif
 
 		value = psf_lrint (scaled_value) ;
-		dest [i].bytes [0] = value ;
-		dest [i].bytes [1] = value >> 8 ;
-		dest [i].bytes [2] = value >> 16 ;
+		dest [i].bytes [0] = value >> 8 ;
+		dest [i].bytes [1] = value >> 16 ;
+		dest [i].bytes [2] = value >> 24 ;
 		} ;
 } /* d2let_clip_array */
 
@@ -2678,27 +2698,31 @@ d2bet_clip_array (const double *src, tribyte *dest, int count, int normalize)
 {	int		value ;
 	double	normfact, scaled_value ;
 
-	normfact = normalize ? (8.0 * 0x100000) : 1.0 ;
+	normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ;
 
 	for (int i = 0 ; i < count ; i++)
 	{	scaled_value = src [i] * normfact ;
-		if (scaled_value >= (1.0 * 0x7FFFFF))
+#if CPU_CLIPS_POSITIVE == 0
+		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	dest [i].bytes [2] = 0xFF ;
 			dest [i].bytes [1] = 0xFF ;
 			dest [i].bytes [0] = 0x7F ;
 			continue ;
 			} ;
-		if (scaled_value <= (-8.0 * 0x100000))
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
+		if (scaled_value <= (-8.0 * 0x10000000))
 		{	dest [i].bytes [2] = 0x00 ;
 			dest [i].bytes [1] = 0x00 ;
 			dest [i].bytes [0] = 0x80 ;
 			continue ;
 			} ;
+#endif
 
 		value = psf_lrint (scaled_value) ;
-		dest [i].bytes [2] = value ;
-		dest [i].bytes [1] = value >> 8 ;
-		dest [i].bytes [0] = value >> 16 ;
+		dest [i].bytes [2] = value >> 8 ;
+		dest [i].bytes [1] = value >> 16 ;
+		dest [i].bytes [0] = value >> 24 ;
 		} ;
 } /* d2bet_clip_array */
 
@@ -2758,6 +2782,7 @@ d2bei_clip_array (const double *src, int *dest, int count, int normalize)
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
+#if CPU_CLIPS_POSITIVE == 0
 		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [3] = 0xFF ;
 			ucptr [2] = 0xFF ;
@@ -2765,6 +2790,8 @@ d2bei_clip_array (const double *src, int *dest, int count, int normalize)
 			ucptr [0] = 0x7F ;
 			continue ;
 			} ;
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
 		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [3] = 0x00 ;
 			ucptr [2] = 0x00 ;
@@ -2772,6 +2799,7 @@ d2bei_clip_array (const double *src, int *dest, int count, int normalize)
 			ucptr [0] = 0x80 ;
 			continue ;
 			} ;
+#endif
 
 		value = psf_lrint (scaled_value) ;
 		ucptr [0] = value >> 24 ;
@@ -2837,6 +2865,7 @@ d2lei_clip_array (const double *src, int *dest, int count, int normalize)
 	for (int i = 0 ; i < count ; i++)
 	{	ucptr = (unsigned char*) &dest [i] ;
 		scaled_value = src [i] * normfact ;
+#if CPU_CLIPS_POSITIVE == 0
 		if (scaled_value >= (1.0 * 0x7FFFFFFF))
 		{	ucptr [0] = 0xFF ;
 			ucptr [1] = 0xFF ;
@@ -2844,6 +2873,8 @@ d2lei_clip_array (const double *src, int *dest, int count, int normalize)
 			ucptr [3] = 0x7F ;
 			continue ;
 			} ;
+#endif
+#if CPU_CLIPS_NEGATIVE == 0
 		if (scaled_value <= (-8.0 * 0x10000000))
 		{	ucptr [0] = 0x00 ;
 			ucptr [1] = 0x00 ;
@@ -2851,6 +2882,7 @@ d2lei_clip_array (const double *src, int *dest, int count, int normalize)
 			ucptr [3] = 0x80 ;
 			continue ;
 			} ;
+#endif
 
 		value = psf_lrint (scaled_value) ;
 		ucptr [0] = value ;

+ 1 - 1
Engine/lib/libsndfile/src/rf64.c

@@ -242,7 +242,7 @@ rf64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
 							} ;
 						} ;
 
-					if (psf->filelength - 8 != riff_size)
+					if (psf->filelength != riff_size + 8)
 						psf_log_printf (psf, "  Riff size : %D (should be %D)\n", riff_size, psf->filelength - 8) ;
 					else
 						psf_log_printf (psf, "  Riff size : %D\n", riff_size) ;

+ 3 - 3
Engine/lib/libsndfile/src/sds.c

@@ -454,7 +454,7 @@ sds_2byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds)
 
 	ucptr = psds->read_data + 5 ;
 	for (k = 0 ; k < 120 ; k += 2)
-	{	sample = arith_shift_left (ucptr [k], 25) | arith_shift_left (ucptr [k + 1], 18) ;
+	{	sample = arith_shift_left (ucptr [k], 25) + arith_shift_left (ucptr [k + 1], 18) ;
 		psds->read_samples [k / 2] = (int) (sample - 0x80000000) ;
 		} ;
 
@@ -498,7 +498,7 @@ sds_3byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds)
 
 	ucptr = psds->read_data + 5 ;
 	for (k = 0 ; k < 120 ; k += 3)
-	{	sample = (((uint32_t) ucptr [k]) << 25) | (ucptr [k + 1] << 18) | (ucptr [k + 2] << 11) ;
+	{	sample = (((uint32_t) ucptr [k]) << 25) + (ucptr [k + 1] << 18) + (ucptr [k + 2] << 11) ;
 		psds->read_samples [k / 3] = (int) (sample - 0x80000000) ;
 		} ;
 
@@ -542,7 +542,7 @@ sds_4byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds)
 
 	ucptr = psds->read_data + 5 ;
 	for (k = 0 ; k < 120 ; k += 4)
-	{	sample = (((uint32_t) ucptr [k]) << 25) | (ucptr [k + 1] << 18) | (ucptr [k + 2] << 11) | (ucptr [k + 3] << 4) ;
+	{	sample = (((uint32_t) ucptr [k]) << 25) + (ucptr [k + 1] << 18) + (ucptr [k + 2] << 11) + (ucptr [k + 3] << 4) ;
 		psds->read_samples [k / 4] = (int) (sample - 0x80000000) ;
 		} ;
 

+ 0 - 4
Engine/lib/libsndfile/src/sfconfig.h

@@ -41,10 +41,6 @@
 #define HAVE_ALSA_ASOUNDLIB_H 0
 #endif
 
-#ifndef HAVE_SNDIO_H
-#define HAVE_SNDIO_H 0
-#endif
-
 #ifndef HAVE_BYTESWAP_H
 #define HAVE_BYTESWAP_H 0
 #endif

+ 4 - 4
Engine/lib/libsndfile/src/sndfile.c

@@ -472,7 +472,7 @@ SNDFILE*
 sf_open_virtual	(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
 {	SF_PRIVATE 	*psf ;
 
-	/* Make sure we have a valid set of virtual pointers. */
+	/* Make sure we have a valid set ot virtual pointers. */
 	if (sfvirtual->get_filelen == NULL)
 	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
 		snprintf (sf_parselog, sizeof (sf_parselog), "Bad vio_get_filelen in SF_VIRTUAL_IO struct.\n") ;
@@ -658,7 +658,7 @@ sf_format_check	(const SF_INFO *info)
 
 	/* This is the place where each file format can check if the supplied
 	** SF_INFO struct is valid.
-	** Return 0 on failure, 1 on success.
+	** Return 0 on failure, 1 ons success.
 	*/
 
 	if (info->channels < 1 || info->channels > SF_MAX_CHANNELS)
@@ -1112,7 +1112,7 @@ sf_command	(SNDFILE *sndfile, int command, void *data, int datasize)
 
 				format = SF_CODEC (psf->sf.format) ;
 
-				/* Only files containing the following data types support the PEAK chunk. */
+				/* Only files containg the following data types support the PEAK chunk. */
 				if (format != SF_FORMAT_FLOAT && format != SF_FORMAT_DOUBLE)
 					return SF_FALSE ;
 
@@ -1522,7 +1522,7 @@ sf_seek	(SNDFILE *sndfile, sf_count_t offset, int whence)
 	** used with SEEK_SET.
 	*/
 	switch (whence)
-	{	/* The SEEK_SET behaviour is independent of mode. */
+	{	/* The SEEK_SET behaviour is independant of mode. */
 		case SEEK_SET :
 		case SEEK_SET | SFM_READ :
 		case SEEK_SET | SFM_WRITE :

+ 1 - 1
Engine/lib/libsndfile/src/voc.c

@@ -845,7 +845,7 @@ Detailed description of new data blocks (VOC files version 1.20 and above):
 
         (Source is fax from Barry Boone at Creative Labs, 405/742-6622)
 
-BLOCK 8 - digitized sound attribute extension, must precede block 1.
+BLOCK 8 - digitized sound attribute extension, must preceed block 1.
           Used to define stereo, 8 bit audio
         BYTE bBlockID;       // = 8
         BYTE nBlockLen[3];   // 3 byte length

+ 1 - 1
Engine/lib/libsndfile/src/w64.c

@@ -153,7 +153,7 @@ w64_open	(SF_PRIVATE *psf)
 
 			/*
 			** At this point we don't know the file length so set it stupidly high, but not
-			** so high that it triggers undefined behaviour when something is added to it.
+			** so high that it triggers undefined behaviour whan something is added to it.
 			*/
 			psf->filelength = SF_COUNT_MAX - 10000 ;
 			psf->datalength = psf->filelength ;

+ 2 - 2
Engine/lib/libsndfile/src/wav.c

@@ -208,7 +208,7 @@ wav_open	(SF_PRIVATE *psf)
 			} ;
 
 #if (ENABLE_EXPERIMENTAL_CODE == 0)
-		/* For now, don't support writing MPEGLAYER3 WAVs, as we can't guarantee that
+		/* For now, don't support writing MPEGLAYER3 WAVs, as we can't guarentee that
 		** such a file written by libsndfile would have the same length when opened again.
 		*/
 		if (subformat == SF_FORMAT_MPEG_LAYER_III)
@@ -1537,7 +1537,7 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, uint32_t chunklen)
 **
 **        0x01 On: One Shot         Off: Loop
 **        0x02 On: Root note is Set Off: No root
-**        0x04 On: Stretch is On,   Off: Stretch is OFF
+**        0x04 On: Stretch is On,   Off: Strech is OFF
 **        0x08 On: Disk Based       Off: Ram based
 **        0x10 On: ??????????       Off: ????????? (Acidizer puts that ON)
 **

+ 2 - 2
Engine/lib/libsndfile/src/wavlike.c

@@ -88,7 +88,7 @@ static const struct chanmap_s
 {	int id ;
 	const char * name ;
 } channel_mask_bits [] =
-{	/* WAVEFORMATEXTENSIBLE doesn't distinguish FRONT_LEFT from LEFT */
+{	/* WAVEFORMATEXTENSIBLE doesn't distuingish FRONT_LEFT from LEFT */
 	{	SF_CHANNEL_MAP_LEFT, "L" },
 	{	SF_CHANNEL_MAP_RIGHT, "R" },
 	{	SF_CHANNEL_MAP_CENTER, "C" },
@@ -161,7 +161,7 @@ wavlike_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
 	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
 
 		psf_log_printf (psf, "\n"
-			"  Ambiguous information in 'fmt ' chunk. Possible file types:\n"
+			"  Ambiguous information in 'fmt ' chunk. Possibile file types:\n"
 			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
 			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
 			"    2) 24 bit file with incorrect Block Align value.\n"

+ 1 - 1
Engine/lib/libsndfile/tests/alaw_test.c

@@ -151,7 +151,7 @@ main (void)
 
 
 /*=================================================================================
-**	The following routines came from the sox-12.15 (Sound eXchange) distribution.
+**	The following routines came from the sox-12.15 (Sound eXcahcnge) distribution.
 **
 **	This code is not compiled into libsndfile. It is only used to test the
 **	libsndfile lookup tables for correctness.

+ 1 - 1
Engine/lib/libsndfile/tests/benchmark.tpl

@@ -43,7 +43,7 @@
 #endif
 
 /*
-**	Neat solution to the Win32/OS2 binary file flag requirement.
+**	Neat solution to the Win32/OS2 binary file flage requirement.
 **	If O_BINARY isn't already defined by the inclusion of the system
 **	headers, set it to zero.
 */

+ 2 - 2
Engine/lib/libsndfile/tests/command_test.c

@@ -714,7 +714,7 @@ instrumet_rw_test (const char *filename)
 	{	inst.basenote = 22 ;
 
 		if (sf_command (sndfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
-			printf ("Success: [%s] updated\n", filename) ;
+			printf ("Sucess: [%s] updated\n", filename) ;
 		else
 			printf ("Error: SFC_SET_INSTRUMENT on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
 		}
@@ -913,7 +913,7 @@ cue_rw_test (const char *filename)
 	{	cues.cue_points [1].sample_offset = 3 ;
 
 		if (sf_command (sndfile, SFC_SET_CUE, &cues, sizeof (cues)) == SF_TRUE)
-			printf ("Success: [%s] updated\n", filename) ;
+			printf ("Sucess: [%s] updated\n", filename) ;
 		else
 			printf ("Error: SFC_SET_CUE on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
 		}

+ 5 - 1
Engine/lib/libsndfile/tests/compression_size_test.c

@@ -175,7 +175,7 @@ compression_size_test (int format, const char * filename)
 
 int
 main (int argc, char *argv [])
-{	int all_tests = 0 ;
+{	int all_tests = 0, tests = 0 ;
 
 	if (argc != 2)
 	{	printf (
@@ -197,6 +197,7 @@ main (int argc, char *argv [])
 	{	if (HAVE_EXTERNAL_XIPH_LIBS)
 		{	vorbis_test () ;
 			compression_size_test (SF_FORMAT_OGG | SF_FORMAT_VORBIS, "vorbis.oga") ;
+			tests ++ ;
 			}
 		else
 			puts ("    No Ogg Vorbis tests because support was not compiled in.") ;
@@ -205,6 +206,7 @@ main (int argc, char *argv [])
 	if (all_tests || strcmp (argv [1], "flac") == 0)
 	{	if (HAVE_EXTERNAL_XIPH_LIBS)
 		{	compression_size_test (SF_FORMAT_FLAC | SF_FORMAT_PCM_16, "pcm16.flac") ;
+			tests ++ ;
 			}
 		else
 			puts ("    No FLAC tests because support was not compiled in.") ;
@@ -213,6 +215,7 @@ main (int argc, char *argv [])
 	if (all_tests || strcmp (argv [1], "opus") == 0)
 	{	if (HAVE_EXTERNAL_XIPH_LIBS)
 		{	compression_size_test (SF_FORMAT_OGG | SF_FORMAT_OPUS, "opus.opus") ;
+			tests ++ ;
 			}
 		else
 			puts ("    No Opus tests because support was not compiled in.") ;
@@ -221,6 +224,7 @@ main (int argc, char *argv [])
 	if (all_tests || strcmp (argv [1], "mpeg") == 0)
 	{	if (HAVE_MPEG)
 		{	compression_size_test (SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III, "mpeg.mp3") ;
+			tests ++ ;
 			}
 		else
 			puts ("    No MPEG tests because support was not compiled in.") ;

+ 1 - 1
Engine/lib/libsndfile/tests/misc_test.c

@@ -293,7 +293,7 @@ filesystem_full_test (int format)
 	sfinfo.frames = 0 ;
 
 	if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) != NULL)
-	{	printf ("\n\nLine %d : Error, file should not have opened.\n", __LINE__ - 1) ;
+	{	printf ("\n\nLine %d : Error, file should not have openned.\n", __LINE__ - 1) ;
 		exit (1) ;
 		} ;
 

+ 5 - 0
Engine/lib/libsndfile/tests/multi_file_test.c

@@ -79,6 +79,7 @@ static int verbose = SF_FALSE ;
 int
 main (int argc, char **argv)
 {	int		do_all = 0 ;
+	int		test_count = 0 ;
 
 	if (argc == 3 && strcmp (argv [2], "-v") == 0)
 	{	verbose = SF_TRUE ;
@@ -106,14 +107,17 @@ main (int argc, char **argv)
 
 	if (do_all || ! strcmp (argv [1], "wav"))
 	{	multi_file_test	("multi_wav.dat", wav_formats, ARRAY_LEN (wav_formats)) ;
+		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "aiff"))
 	{	multi_file_test	("multi_aiff.dat", aiff_formats, ARRAY_LEN (aiff_formats)) ;
+		test_count++ ;
 		} ;
 
 	if (do_all || ! strcmp (argv [1], "au"))
 	{	multi_file_test	("multi_au.dat", au_formats, ARRAY_LEN (au_formats)) ;
+		test_count++ ;
 		} ;
 
 	return 0 ;
@@ -231,3 +235,4 @@ write_file_at_end (int fd, int filetype, int channels, int file_num)
 
 	sf_close (sndfile) ;
 } /* write_file_at_end */
+

+ 1 - 1
Engine/lib/libsndfile/tests/peak_chunk_test.c

@@ -339,7 +339,7 @@ read_write_peak_test (const char *filename, int filetype)
 
 	sf_close (file) ;
 
-	/* Open the file RDWR, write sample valid 1.25. */
+	/* Open the fiel RDWR, write sample valied 1.25. */
 	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
 
 	for (k = 0 ; k < ARRAY_LEN (small_data) ; k ++)

+ 1 - 1
Engine/lib/libsndfile/tests/sftest.c

@@ -58,7 +58,7 @@ main (int argc, char *argv [])
 		} ;
 
 	printf ("Total         : %d\n", total) ;
-	printf ("Maximum value : %d\n", max) ;
+	printf ("Maximun value : %d\n", max) ;
 
 	sf_close (file) ;
 

+ 1 - 1
Engine/lib/libsndfile/tests/ulaw_test.c

@@ -152,7 +152,7 @@ main (void)
 
 
 /*=================================================================================
-**	The following routines came from the sox-12.15 (Sound eXchange) distribution.
+**	The following routines came from the sox-12.15 (Sound eXcahcnge) distribution.
 **
 **	This code is not compiled into libsndfile. It is only used to test the
 **	libsndfile lookup tables for correctness.

+ 3 - 3
Engine/lib/libsndfile/tests/utils.tpl

@@ -208,7 +208,7 @@ sf_count_t		file_length_fd (int fd) ;
 #define	LOG_BUFFER_SIZE		4096
 
 /*
-**	Neat solution to the Win32/OS2 binary file flag requirement.
+**	Neat solution to the Win32/OS2 binary file flage requirement.
 **	If O_BINARY isn't already defined by the inclusion of the system
 **	headers, set it to zero.
 */
@@ -426,8 +426,8 @@ check_log_buffer_or_die (SNDFILE *file, int line_num)
 		} ;
 
 	/* Look for "Should" */
-	if (strstr (buffer, "unknown marker"))
-	{	printf ("\n\nLine %d : Log buffer contains `unknown marker'. Dumping.\n", line_num) ;
+	if (strstr (buffer, "nknown marker"))
+	{	printf ("\n\nLine %d : Log buffer contains `nknown marker'. Dumping.\n", line_num) ;
 		puts (buffer) ;
 		exit (1) ;
 		} ;

+ 1 - 1
Engine/lib/libsndfile/tests/win32_test.c

@@ -244,7 +244,7 @@ show_stat_fstat_error (void)
 
 	assert (write (fd, data, sizeof (data)) > 0) ;
 
-	printf ("1) Now call stat and fstat on the file and retrieve the file lengths.\n") ;
+	printf ("1) Now call stat and fstat on the file and retreive the file lengths.\n") ;
 
 	if (stat (filename, &buf) != 0)
 	{	printf ("\n\nLine %d: stat() failed : %s\n\n", __LINE__, strerror (errno)) ;

+ 1 - 1
Engine/lib/libsndfile/tests/write_read_test.tpl

@@ -856,7 +856,7 @@ mono_rdwr_[+ (get "type_name") +]_test (const char *filename, int format, int lo
 		create_short_file (filename) ;
 
 		/* Opening a already existing short file (ie invalid header) RDWR is disallowed.
-		** If this returns a valid pointer sf_open() screwed up.
+		** If this returns a valif pointer sf_open() screwed up.
 		*/
 		if ((file = sf_open (filename, SFM_RDWR, &sfinfo)))
 		{	printf ("\n\nLine %d: sf_open should (SFM_RDWR) have failed but didn't.\n", __LINE__) ;

+ 3 - 0
Tools/CMake/finders/FindVorbis.cmake

@@ -7,6 +7,9 @@ if(TARGET vorbis)
   if(NOT TARGET VORBIS::VORBIS)
     add_library(VORBIS::VORBIS ALIAS vorbis)
   endif()
+  if(NOT TARGET Vorbis::vorbisenc)
+    add_library(Vorbis::vorbisenc ALIAS vorbisenc)
+  endif()
 else()
   set(VORBIS_FOUND FALSE)
   message(FATAL_ERROR "Vorbis was not added with add_subdirectory before calling find_package(Vorbis).")