mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-31 22:23:54 +01:00 
			
		
		
		
	upgrade to libsoxr 0.0.4 from current git
This commit is contained in:
		| @@ -1,260 +1,280 @@ | ||||
| # SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| # Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| cmake_minimum_required (VERSION 2.8 FATAL_ERROR) | ||||
|  | ||||
| project (soxr C) | ||||
| set (DESCRIPTION_SUMMARY "One-dimensional sample-rate conversion library") | ||||
|  | ||||
|  | ||||
|  | ||||
| # Release versioning: | ||||
|  | ||||
| set (PROJECT_VERSION_MAJOR 0) | ||||
| set (PROJECT_VERSION_MINOR 0) | ||||
| set (PROJECT_VERSION_PATCH 3) | ||||
|  | ||||
| # For shared-object; if, since the last public release: | ||||
| #  * library code changed at all: ++revision | ||||
| #  * interfaces changed at all:   ++current, revision = 0 | ||||
| #  * interfaces added:            ++age | ||||
| #  * interfaces removed:          age = 0 | ||||
|  | ||||
| set (SO_VERSION_CURRENT  0) | ||||
| set (SO_VERSION_REVISION 0) | ||||
| set (SO_VERSION_AGE      0) | ||||
|  | ||||
|  | ||||
|  | ||||
| # Main options: | ||||
|  | ||||
| include (CMakeDependentOption) | ||||
|  | ||||
| if (NOT CMAKE_BUILD_TYPE) | ||||
|   set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) | ||||
| endif () | ||||
|  | ||||
| option (BUILD_TESTS "Build sanity-tests."  OFF) | ||||
| option (BUILD_SHARED_LIBS "Build shared libraries." ON) | ||||
| option (BUILD_EXAMPLES "Build examples." OFF) | ||||
| option (WITH_OPENMP "Include OpenMP threading." ON) | ||||
| option (WITH_LSR_BINDINGS "Include a `libsamplerate'-like interface." ON) | ||||
| cmake_dependent_option (WITH_SINGLE_PRECISION "Build with single precision (for up to 20-bit accuracy)." ON | ||||
|   "WITH_DOUBLE_PRECISION" ON) | ||||
| cmake_dependent_option (WITH_DOUBLE_PRECISION "Build with double precision (for up to 32-bit accuracy)." ON | ||||
|   "WITH_SINGLE_PRECISION" ON) | ||||
| cmake_dependent_option (WITH_SIMD "Use SIMD (for faster single precision)." ON | ||||
|   "WITH_SINGLE_PRECISION" OFF) | ||||
| cmake_dependent_option (WITH_AVFFT "Use libavcodec (LGPL) for SIMD DFT." OFF | ||||
|   "WITH_SIMD;NOT WITH_PFFFT" OFF) | ||||
| cmake_dependent_option (WITH_PFFFT "Use PFFFT (BSD-like licence) for SIMD DFT." ON | ||||
|   "WITH_SIMD;NOT WITH_AVFFT" OFF) | ||||
| if (UNIX) | ||||
|   cmake_dependent_option (BUILD_LSR_TESTS "Build LSR tests." OFF | ||||
|     "WITH_LSR_BINDINGS" OFF) | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Introspection: | ||||
|  | ||||
| list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) | ||||
|  | ||||
| include (CheckFunctionExists) | ||||
| include (CheckIncludeFiles) | ||||
| include (CheckLibraryExists) | ||||
| include (TestBigEndian) | ||||
|  | ||||
| check_library_exists (m pow "" NEED_LIBM) | ||||
| if (NEED_LIBM) | ||||
|   set (CMAKE_REQUIRED_LIBRARIES "m;${CMAKE_REQUIRED_LIBRARIES}") | ||||
|   link_libraries (m) | ||||
| endif () | ||||
|  | ||||
| if (WITH_OPENMP) | ||||
|   find_package (OpenMP) | ||||
| endif () | ||||
| if (OPENMP_FOUND) | ||||
|   set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||||
|   set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") | ||||
| endif () | ||||
|  | ||||
| if (WITH_SIMD) | ||||
|   find_package (SIMD) | ||||
|   if (SIMD_FOUND) | ||||
|     set (HAVE_SIMD 1) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
| if (WITH_SINGLE_PRECISION) | ||||
|   set (HAVE_SINGLE_PRECISION 1) | ||||
| endif () | ||||
|  | ||||
| if (WITH_DOUBLE_PRECISION) | ||||
|   set (HAVE_DOUBLE_PRECISION 1) | ||||
| endif () | ||||
|  | ||||
| if (WITH_AVFFT) | ||||
|   find_package (LibAVCodec) | ||||
|   if (AVCODEC_FOUND) | ||||
|     include_directories (${AVCODEC_INCLUDE_DIRS}) | ||||
|     link_libraries (${AVCODEC_LIBRARIES}) | ||||
|     set (HAVE_AVFFT 1) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
| if (EXISTS ${PROJECT_SOURCE_DIR}/src/vr32.c) | ||||
|   set (HAVE_VR 1) | ||||
| endif () | ||||
|  | ||||
| check_function_exists (lrint HAVE_LRINT) | ||||
| check_include_files (fenv.h HAVE_FENV_H) | ||||
| test_big_endian (WORDS_BIGENDIAN) | ||||
|  | ||||
| macro (make_exist) | ||||
|   foreach (x ${ARGN}) | ||||
|     if (NOT ${x}) | ||||
|       set (${x} 0) | ||||
|     endif () | ||||
|   endforeach () | ||||
| endmacro () | ||||
|  | ||||
| make_exist (HAVE_LRINT HAVE_FENV_H WORDS_BIGENDIAN HAVE_SIMD HAVE_VR) | ||||
| make_exist (HAVE_SINGLE_PRECISION HAVE_DOUBLE_PRECISION HAVE_AVFFT) | ||||
|  | ||||
|  | ||||
|  | ||||
| # Compiler configuration: | ||||
|  | ||||
| if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) | ||||
|   set (PROJECT_CXX_FLAGS "-Wconversion -Wall -W -pedantic -Wundef -Wcast-align -Wpointer-arith -Wno-long-long") | ||||
|   set (PROJECT_C_FLAGS "${PROJECT_CXX_FLAGS} -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes") | ||||
|   if (CMAKE_BUILD_TYPE STREQUAL "Release") | ||||
|     set (CMAKE_SHARED_LINKER_FLAGS "-s") # strip | ||||
|   endif () | ||||
|   #option (VISIBILITY_HIDDEN "Build with -fvisibility=hidden." ON) | ||||
|   if (VISIBILITY_HIDDEN) | ||||
|     add_definitions (-fvisibility=hidden) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
| if (MSVC) | ||||
|   add_definitions (-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS) | ||||
|   option (ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically."  OFF) | ||||
|   if (ENABLE_STATIC_RUNTIME) | ||||
|     foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) | ||||
|       string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | ||||
|     endforeach () | ||||
|   endif () | ||||
|   # By default, do not warn when built on machines using only VS Express: | ||||
|   if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) | ||||
|     set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Build configuration: | ||||
|  | ||||
| if (${BUILD_SHARED_LIBS} AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) # Allow exes to find dlls: | ||||
|   set (BIN ${PROJECT_BINARY_DIR}/bin/) | ||||
|   set (EXAMPLES_BIN ${BIN}) | ||||
|   set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN}) | ||||
|   set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN}) | ||||
| else () | ||||
|   set (BIN ./) | ||||
|   set (EXAMPLES_BIN ../examples/) | ||||
| endif () | ||||
|  | ||||
| set (LIB_TYPE STATIC) | ||||
| if (BUILD_SHARED_LIBS) | ||||
|   set (LIB_TYPE SHARED) | ||||
|   if (MSVC) | ||||
|     add_definitions (-DSOXR_DLL) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Installation configuration: | ||||
|  | ||||
| set (LIB_SUFFIX "" CACHE STRING "Define suffix of libraries directory name (32 or 64).") | ||||
| set (BIN_INSTALL_DIR "bin" CACHE PATH "The subdirectory to the binaries." FORCE) | ||||
| set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory to the libraries." FORCE) | ||||
| set (INCLUDE_INSTALL_DIR "include" CACHE PATH "The subdirectory to the headers." FORCE) | ||||
|  | ||||
| if (APPLE) | ||||
|   option (BUILD_FRAMEWORK "Build an OS X framework." OFF) | ||||
|   set (FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.") | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Top-level: | ||||
|  | ||||
| set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) | ||||
| math (EXPR SO_VERSION_MAJOR "${SO_VERSION_CURRENT} - ${SO_VERSION_AGE}") | ||||
| math (EXPR SO_VERSION_MINOR "${SO_VERSION_AGE}") | ||||
| math (EXPR SO_VERSION_PATCH "${SO_VERSION_REVISION}") | ||||
| set (SO_VERSION ${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_PATCH}) | ||||
|  | ||||
| configure_file ( | ||||
|   ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.h.in | ||||
|   ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.h) | ||||
| include_directories (${PROJECT_BINARY_DIR}) | ||||
|  | ||||
| configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) | ||||
| file (COPY doc/logo.png DESTINATION doc) | ||||
| add_custom_target (docs doxygen) | ||||
|  | ||||
| if (BUILD_TESTS OR BUILD_LSR_TESTS) | ||||
|   enable_testing () | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Subdirectories: | ||||
|  | ||||
| include_directories (${PROJECT_SOURCE_DIR}/src) | ||||
|  | ||||
| add_subdirectory (src) | ||||
| if (BUILD_TESTS) | ||||
|   add_subdirectory (tests) | ||||
| endif () | ||||
| if (BUILD_LSR_TESTS) | ||||
|   add_subdirectory (lsr-tests) | ||||
| endif () | ||||
| if (BUILD_EXAMPLES OR BUILD_TESTS) | ||||
|   add_subdirectory (examples) | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Deinstallation: | ||||
|  | ||||
| configure_file ( | ||||
|   "${CMAKE_CURRENT_SOURCE_DIR}/deinstall.cmake.in" | ||||
|   "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake" | ||||
|   IMMEDIATE @ONLY) | ||||
|  | ||||
| add_custom_target (deinstall | ||||
|   COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake") | ||||
|  | ||||
|  | ||||
|  | ||||
| # Packaging: | ||||
|  | ||||
| if (UNIX) | ||||
|   set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") | ||||
|   set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") | ||||
|   set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") | ||||
|  | ||||
|   set (CPACK_SOURCE_GENERATOR "TBZ2") | ||||
|   set (CPACK_SOURCE_IGNORE_FILES "/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore;.*vr32\\\\.c") | ||||
|  | ||||
|   include (CPack) | ||||
|  | ||||
|   if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/cpack) | ||||
|     add_subdirectory (cpack) | ||||
|   endif () | ||||
| endif () | ||||
| # SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| # Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| cmake_minimum_required (VERSION 2.8 FATAL_ERROR) | ||||
|  | ||||
| project (soxr C) | ||||
| set (DESCRIPTION_SUMMARY "One-dimensional sample-rate conversion library") | ||||
|  | ||||
|  | ||||
|  | ||||
| # Release versioning: | ||||
|  | ||||
| set (PROJECT_VERSION_MAJOR 0) | ||||
| set (PROJECT_VERSION_MINOR 0) | ||||
| set (PROJECT_VERSION_PATCH 5) | ||||
|  | ||||
| # For shared-object; if, since the last public release: | ||||
| #  * library code changed at all: ++revision | ||||
| #  * interfaces changed at all:   ++current, revision = 0 | ||||
| #  * interfaces added:            ++age | ||||
| #  * interfaces removed:          age = 0 | ||||
|  | ||||
| set (SO_VERSION_CURRENT  0) | ||||
| set (SO_VERSION_REVISION 0) | ||||
| set (SO_VERSION_AGE      0) | ||||
|  | ||||
|  | ||||
|  | ||||
| # Main options: | ||||
|  | ||||
| include (CMakeDependentOption) | ||||
|  | ||||
| if (NOT CMAKE_BUILD_TYPE) | ||||
|   set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) | ||||
| endif () | ||||
|  | ||||
| option (BUILD_TESTS "Build sanity-tests."  OFF) | ||||
| option (BUILD_SHARED_LIBS "Build shared libraries." ON) | ||||
| option (BUILD_EXAMPLES "Build examples." OFF) | ||||
| option (WITH_OPENMP "Include OpenMP threading." ON) | ||||
| option (WITH_LSR_BINDINGS "Include a `libsamplerate'-like interface." ON) | ||||
| cmake_dependent_option (WITH_SINGLE_PRECISION "Build with single precision (for up to 20-bit accuracy)." ON | ||||
|   "WITH_DOUBLE_PRECISION" ON) | ||||
| cmake_dependent_option (WITH_DOUBLE_PRECISION "Build with double precision (for up to 32-bit accuracy)." ON | ||||
|   "WITH_SINGLE_PRECISION" ON) | ||||
| cmake_dependent_option (WITH_SIMD "Use SIMD (for faster single precision)." ON | ||||
|   "WITH_SINGLE_PRECISION" OFF) | ||||
| cmake_dependent_option (WITH_AVFFT "Use libavcodec (LGPL) for SIMD DFT." OFF | ||||
|   "WITH_SIMD;NOT WITH_PFFFT" OFF) | ||||
| cmake_dependent_option (WITH_PFFFT "Use PFFFT (BSD-like licence) for SIMD DFT." ON | ||||
|   "WITH_SIMD;NOT WITH_AVFFT" OFF) | ||||
| if (UNIX) | ||||
|   cmake_dependent_option (BUILD_LSR_TESTS "Build LSR tests." OFF | ||||
|     "WITH_LSR_BINDINGS" OFF) | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Introspection: | ||||
|  | ||||
| list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) | ||||
|  | ||||
| include (CheckFunctionExists) | ||||
| include (CheckIncludeFiles) | ||||
| include (CheckLibraryExists) | ||||
| include (TestBigEndian) | ||||
|  | ||||
| check_library_exists (m pow "" NEED_LIBM) | ||||
| if (NEED_LIBM) | ||||
|   set (CMAKE_REQUIRED_LIBRARIES "m;${CMAKE_REQUIRED_LIBRARIES}") | ||||
|   link_libraries (m) | ||||
| endif () | ||||
|  | ||||
| if (WITH_OPENMP) | ||||
|   find_package (OpenMP) | ||||
| endif () | ||||
| if (OPENMP_FOUND) | ||||
|   set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||||
|   set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") | ||||
| endif () | ||||
|  | ||||
| if (WITH_SIMD) | ||||
|   find_package (SIMD) | ||||
|   if (SIMD_FOUND) | ||||
|     set (HAVE_SIMD 1) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
| if (WITH_SINGLE_PRECISION) | ||||
|   set (HAVE_SINGLE_PRECISION 1) | ||||
| endif () | ||||
|  | ||||
| if (WITH_DOUBLE_PRECISION) | ||||
|   set (HAVE_DOUBLE_PRECISION 1) | ||||
| endif () | ||||
|  | ||||
| if (WITH_AVFFT) | ||||
|   find_package (LibAVCodec) | ||||
|   if (AVCODEC_FOUND) | ||||
|     include_directories (${AVCODEC_INCLUDE_DIRS}) | ||||
|     link_libraries (${AVCODEC_LIBRARIES}) | ||||
|     set (HAVE_AVFFT 1) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
| if (EXISTS ${PROJECT_SOURCE_DIR}/src/vr32.c) | ||||
|   set (HAVE_VR 1) | ||||
| endif () | ||||
|  | ||||
| check_function_exists (lrint HAVE_LRINT) | ||||
| check_include_files (fenv.h HAVE_FENV_H) | ||||
| test_big_endian (WORDS_BIGENDIAN) | ||||
|  | ||||
| macro (make_exist) | ||||
|   foreach (x ${ARGN}) | ||||
|     if (NOT ${x}) | ||||
|       set (${x} 0) | ||||
|     endif () | ||||
|   endforeach () | ||||
| endmacro () | ||||
|  | ||||
| make_exist (HAVE_LRINT HAVE_FENV_H WORDS_BIGENDIAN HAVE_SIMD HAVE_VR) | ||||
| make_exist (HAVE_SINGLE_PRECISION HAVE_DOUBLE_PRECISION HAVE_AVFFT) | ||||
|  | ||||
|  | ||||
|  | ||||
| # Compiler configuration: | ||||
|  | ||||
| if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) | ||||
|   set (PROJECT_CXX_FLAGS "-Wconversion -Wall -W -pedantic -Wundef -Wcast-align -Wpointer-arith -Wno-long-long") | ||||
|   set (PROJECT_C_FLAGS "${PROJECT_CXX_FLAGS} -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes") | ||||
|   if (CMAKE_BUILD_TYPE STREQUAL "Release") | ||||
|     set (CMAKE_SHARED_LINKER_FLAGS "-s") # strip | ||||
|   endif () | ||||
|   #option (VISIBILITY_HIDDEN "Build with -fvisibility=hidden." ON) | ||||
|   if (VISIBILITY_HIDDEN) | ||||
|     add_definitions (-fvisibility=hidden) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
| if (MSVC) | ||||
|   add_definitions (-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS) | ||||
|   option (ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically."  OFF) | ||||
|   if (ENABLE_STATIC_RUNTIME) | ||||
|     foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) | ||||
|       string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | ||||
|     endforeach () | ||||
|   endif () | ||||
|   # By default, do not warn when built on machines using only VS Express: | ||||
|   if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) | ||||
|     set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Build configuration: | ||||
|  | ||||
| if (${BUILD_SHARED_LIBS} AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) # Allow exes to find dlls: | ||||
|   set (BIN ${PROJECT_BINARY_DIR}/bin/) | ||||
|   set (EXAMPLES_BIN ${BIN}) | ||||
|   set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN}) | ||||
|   set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN}) | ||||
| else () | ||||
|   set (BIN ./) | ||||
|   set (EXAMPLES_BIN ../examples/) | ||||
| endif () | ||||
|  | ||||
| set (LIB_TYPE STATIC) | ||||
| if (BUILD_SHARED_LIBS) | ||||
|   set (LIB_TYPE SHARED) | ||||
|   if (MSVC) | ||||
|     add_definitions (-DSOXR_DLL) | ||||
|   endif () | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Installation configuration: | ||||
|  | ||||
| set (LIB_SUFFIX "" CACHE STRING "Define suffix of libraries directory name (32 or 64).") | ||||
| set (BIN_INSTALL_DIR "bin" CACHE PATH "The subdirectory to the binaries." FORCE) | ||||
| set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory to the libraries." FORCE) | ||||
| set (INCLUDE_INSTALL_DIR "include" CACHE PATH "The subdirectory to the headers." FORCE) | ||||
|  | ||||
| if (APPLE) | ||||
|   option (BUILD_FRAMEWORK "Build an OS X framework." OFF) | ||||
|   set (FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.") | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Top-level: | ||||
|  | ||||
| set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) | ||||
| math (EXPR SO_VERSION_MAJOR "${SO_VERSION_CURRENT} - ${SO_VERSION_AGE}") | ||||
| math (EXPR SO_VERSION_MINOR "${SO_VERSION_AGE}") | ||||
| math (EXPR SO_VERSION_PATCH "${SO_VERSION_REVISION}") | ||||
| set (SO_VERSION ${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_PATCH}) | ||||
|  | ||||
| configure_file ( | ||||
|   ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.h.in | ||||
|   ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.h) | ||||
| include_directories (${PROJECT_BINARY_DIR}) | ||||
|  | ||||
| if (BUILD_TESTS OR BUILD_LSR_TESTS) | ||||
|   enable_testing () | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Subdirectories: | ||||
|  | ||||
| include_directories (${PROJECT_SOURCE_DIR}/src) | ||||
|  | ||||
| add_subdirectory (src) | ||||
| if (BUILD_TESTS) | ||||
|   add_subdirectory (tests) | ||||
| endif () | ||||
| if (BUILD_LSR_TESTS) | ||||
|   add_subdirectory (lsr-tests) | ||||
| endif () | ||||
| if (BUILD_EXAMPLES OR BUILD_TESTS) | ||||
|   add_subdirectory (examples) | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Rough-and-ready distclean for anyone still doing in-tree builds: | ||||
|  | ||||
| if (UNIX) | ||||
|   add_custom_target (distclean | ||||
|     COMMAND make clean && rm -rf | ||||
|       CMakeCache.txt | ||||
|       CMakeFiles | ||||
|       cmake_install.cmake | ||||
|       CPackConfig.cmake | ||||
|       CPackSourceConfig.cmake | ||||
|       deinstall.cmake | ||||
|       Makefile | ||||
|       soxr-config.h | ||||
|       src/CMakeFiles | ||||
|       src/cmake_install.cmake | ||||
|       src/libsoxr-dev.src | ||||
|       src/libsoxr-lsr.pc | ||||
|       src/libsoxr.pc | ||||
|       src/libsoxr.src | ||||
|       src/Makefile) | ||||
| endif () | ||||
|  | ||||
|  | ||||
|  | ||||
| # Deinstallation: | ||||
|  | ||||
| configure_file ( | ||||
|   "${CMAKE_CURRENT_SOURCE_DIR}/deinstall.cmake.in" | ||||
|   "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake" | ||||
|   IMMEDIATE @ONLY) | ||||
|  | ||||
| add_custom_target (deinstall | ||||
|   COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake") | ||||
|  | ||||
|  | ||||
|  | ||||
| # Packaging: | ||||
|  | ||||
| if (UNIX) | ||||
|   set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") | ||||
|   set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") | ||||
|   set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") | ||||
|  | ||||
|   set (CPACK_SOURCE_GENERATOR "TBZ2") | ||||
|   set (CPACK_SOURCE_IGNORE_FILES "/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore") | ||||
|  | ||||
|   include (CPack) | ||||
|  | ||||
|   if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/cpack) | ||||
|     add_subdirectory (cpack) | ||||
|   endif () | ||||
| endif () | ||||
|   | ||||
| @@ -1,50 +1,50 @@ | ||||
| SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
|  | ||||
| The SoX Resampler library `libsoxr' performs one-dimensional sample-rate | ||||
| conversion - it may be used, for example, to resample PCM-encoded audio. | ||||
| For higher-dimensional resampling, such as for visual-image processing, you | ||||
| should look elsewhere. | ||||
|  | ||||
| It aims to be fast (e.g. multi-channel resampling can utilise multiple | ||||
| CPU-cores), high-quality (i.e. bit-perfect up to 32-bits, for occupied- | ||||
| bandwidths up to 98%¹), and to allow any rational or irrational resampling | ||||
| ratio.  Phase-response, preserved bandwidth, aliasing, and rejection level | ||||
| parameters are all configurable; alternatively, simple `preset' | ||||
| configurations may be selected. | ||||
|  | ||||
| The resampler is currently available either as part of `libsox' (the audio | ||||
| file-format and effect library), or stand-alone as `libsoxr' (this package). | ||||
| The interfaces to libsox and libsoxr are slightly different, with that of | ||||
| libsoxr designed specifically for resampling.  An application requiring | ||||
| support for other effects, or for reading-from or writing-to audio files or | ||||
| devices, should use libsox (or other libraries such as libsndfile or | ||||
| libavformat). | ||||
|  | ||||
| Libsoxr provides a simple API that allows interfacing using any commonly- | ||||
| used sample format or buffering scheme: clients may use either floating- | ||||
| point or integer sample formats, and, in the case of multiple channels, | ||||
| either channel-interleaved, or split channels.  The API is currently | ||||
| documented in the header file `soxr.h' and by example code in the 'examples' | ||||
| directory. | ||||
|  | ||||
| For compatibility with the popular `libsamplerate' library, the header file | ||||
| `soxr-lsr.h' is provided and may be used as an alternative API.  For details | ||||
| of that API, see http://www.mega-nerd.com/SRC/api.html.  Note however, that | ||||
| libsoxr does not provide a full emulation of libsamplerate; in particular, | ||||
| `vari-speeding' is not supported. | ||||
|  | ||||
| For build and installation instructions, see the file `INSTALL'; for | ||||
| copyright and licensing information, see the file `LICENCE'. | ||||
|  | ||||
| The resampler was inspired by Laurent De Soras' paper `The Quest For The | ||||
| Perfect Resampler', http://ldesoras.free.fr/doc/articles/resampler-en.pdf; | ||||
| it combines Julius O. Smith's `Bandlimited Interpolation' technique | ||||
| (https://ccrma.stanford.edu/~jos/resample/resample.pdf) with FFT-based | ||||
| over-sampling. | ||||
|  | ||||
| Its use of FFTs means that, for real-time resampling, libsoxr may have a | ||||
| higher latency than non-FFT based resamplers.  E.g. when using the `High | ||||
| Quality' configuration to resample between 44100Hz and 48kHz, the latency is | ||||
| around 1000 output samples, i.e. roughly 20 ms. | ||||
|  | ||||
| ¹ Note that no practical resampler can be bit-perfect to 100% bandwidth. | ||||
| SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
|  | ||||
| The SoX Resampler library `libsoxr' performs one-dimensional sample-rate | ||||
| conversion -- it may be used, for example, to resample PCM-encoded audio. | ||||
| For higher-dimensional resampling, such as for visual-image processing, you | ||||
| should look elsewhere. | ||||
|  | ||||
| It aims to give fast¹ and very high quality² results for any constant | ||||
| (rational or irrational) resampling ratio.  Phase-response, preserved | ||||
| bandwidth, aliasing, and rejection level parameters are all configurable; | ||||
| alternatively, simple `preset' configurations may be selected.  An | ||||
| experimental, variable-rate resampling mode of operation is also included. | ||||
|  | ||||
| The resampler is currently available either as part of `libsox' (the audio | ||||
| file-format and effect library), or stand-alone as `libsoxr' (this package). | ||||
| The interfaces to libsox and libsoxr are slightly different, with that of | ||||
| libsoxr designed specifically for resampling.  An application requiring | ||||
| support for other effects, or for reading-from or writing-to audio files or | ||||
| devices, should use libsox (or other libraries such as libsndfile or | ||||
| libavformat). | ||||
|  | ||||
| Libsoxr provides a simple API that allows interfacing using the most | ||||
| commonly-used sample formats and buffering schemes: sample-formats may be | ||||
| either floating-point or integer, and multiple channels either interleaved | ||||
| or split in separate buffers.  The API is documented in the header file | ||||
| `soxr.h', together with sample code found in the 'examples' directory. | ||||
|  | ||||
| For compatibility with the popular `libsamplerate' library, the header file | ||||
| `soxr-lsr.h' is provided and may be used as an alternative API.³  Note | ||||
| however, that libsoxr does not provide a full emulation of libsamplerate | ||||
| and that using this approach, only a sub-set of libsoxr's features are | ||||
| available. | ||||
|  | ||||
| The design was inspired by Laurent De Soras' paper `The Quest For The | ||||
| Perfect Resampler', http://ldesoras.free.fr/doc/articles/resampler-en.pdf; | ||||
| in essence, it combines Julius O. Smith's `Bandlimited Interpolation' | ||||
| technique (https://ccrma.stanford.edu/~jos/resample/resample.pdf) with FFT- | ||||
| based over-sampling. | ||||
|  | ||||
| Note that for real-time resampling, libsoxr may have a higher latency | ||||
| than non-FFT based resamplers.  For example, when using the `High Quality' | ||||
| configuration to resample between 44100Hz and 48000Hz, the latency is | ||||
| around 1000 output samples, i.e. roughly 20ms. | ||||
|  | ||||
| For build and installation instructions, see the file `INSTALL'; for | ||||
| copyright and licensing information, see the file `LICENCE'. | ||||
| ________ | ||||
| ¹ For example, multi-channel resampling can utilise multiple CPU-cores. | ||||
| ² Bit-perfect within practical occupied-bandwidth limits. | ||||
| ³ For details of that API, see http://www.mega-nerd.com/SRC/api.html. | ||||
|   | ||||
							
								
								
									
										28
									
								
								lib-src/libsoxr/configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								lib-src/libsoxr/configure
									
									
									
									
										vendored
									
									
								
							| @@ -1,15 +1,13 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| # SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| # Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| # Wrapper to allow easier integration with projects using autotools. | ||||
|  | ||||
| # Such projects will probably be using static libs so should pass | ||||
| #  -DBUILD_SHARED_LIBS=OFF amongst any other options needed. | ||||
|  | ||||
| # Autotools options should not be passed to this script. | ||||
|  | ||||
| # Configure for Audacity. | ||||
| #   cmake $* . | ||||
| cmake -DBUILD_SHARED_LIBS=OFF -DWITH_OPENMP=OFF . | ||||
| #!/bin/sh | ||||
|  | ||||
| # SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| # Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| # Wrapper to allow easier integration with projects using autotools. | ||||
|  | ||||
| # Such projects will probably be using static libs so should pass | ||||
| #  -DBUILD_SHARED_LIBS=OFF amongst any other options needed. | ||||
|  | ||||
| # Autotools options should not be passed to this script. | ||||
|  | ||||
| cmake $* . | ||||
|   | ||||
| @@ -1,13 +1,15 @@ | ||||
| #!/bin/sh | ||||
| # SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| # Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| build=$1 | ||||
| test x$build = x && build=Release | ||||
|  | ||||
| mkdir -p $build | ||||
| cd $build | ||||
|  | ||||
| cmake -DCMAKE_BUILD_TYPE=$build -DBUILD_TESTS=ON .. && | ||||
|   make && | ||||
|     (make test || echo "FAILURE details in $build/Testing/Temporary/LastTest.log") | ||||
| #!/bin/sh | ||||
| # SoX Resampler Library       Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| # Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| build=$1 | ||||
| test x$build = x && build=Release | ||||
|  | ||||
| rm -f CMakeCache.txt             # Prevent interference from any in-tree build | ||||
|  | ||||
| mkdir -p $build | ||||
| cd $build | ||||
|  | ||||
| cmake -DCMAKE_BUILD_TYPE=$build -DBUILD_TESTS=ON .. && | ||||
|   make && | ||||
|     (make test || echo "FAILURE details in $build/Testing/Temporary/LastTest.log") | ||||
|   | ||||
| @@ -1,24 +1,27 @@ | ||||
| @echo off | ||||
| rem SoX Resampler Library      Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| rem Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| set build=%1 | ||||
| if x%build% == x set build=Release | ||||
|  | ||||
| mkdir %build% | ||||
| cd %build% | ||||
|  | ||||
| cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%build% -DBUILD_TESTS=ON .. | ||||
| if errorlevel 1 goto end | ||||
|  | ||||
| nmake | ||||
| if errorlevel 1 goto end | ||||
|  | ||||
| nmake test | ||||
| if errorlevel 1 goto error | ||||
| goto end | ||||
|  | ||||
| :error | ||||
| echo FAILURE details in Testing\Temporary\LastTest.log | ||||
|  | ||||
| :end | ||||
| @echo off | ||||
| rem SoX Resampler Library      Copyright (c) 2007-12 robs@users.sourceforge.net | ||||
| rem Licence for this file: LGPL v2.1                  See LICENCE for details. | ||||
|  | ||||
| set build=%1 | ||||
| if x%build% == x set build=Release | ||||
|  | ||||
| rem Prevent interference from any in-tree build | ||||
| del/f CMakeCache.txt | ||||
|  | ||||
| mkdir %build% | ||||
| cd %build% | ||||
|  | ||||
| cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%build% -DBUILD_TESTS=ON .. | ||||
| if errorlevel 1 goto end | ||||
|  | ||||
| nmake | ||||
| if errorlevel 1 goto end | ||||
|  | ||||
| nmake test | ||||
| if errorlevel 1 goto error | ||||
| goto end | ||||
|  | ||||
| :error | ||||
| echo FAILURE details in Testing\Temporary\LastTest.log | ||||
|  | ||||
| :end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user