soxr cmake fixes

This commit is contained in:
Jack Andersen 2016-03-22 21:01:25 -10:00
parent f9d5b1bf5f
commit 5b275866a7
8 changed files with 94 additions and 71 deletions

View File

@ -162,13 +162,13 @@ endif()
add_subdirectory(glslang/glslang)
add_subdirectory(glslang/OGLCompilersDLL)
add_subdirectory(glslang/SPIRV)
list(APPEND _BOO_SYS_LIBS glslang OSDependent OGLCompiler SPIRV)
list(APPEND _BOO_SYS_LIBS glslang soxr OSDependent OGLCompiler SPIRV)
set(BOO_SYS_LIBS ${_BOO_SYS_LIBS} CACHE PATH "boo system libraries" FORCE)
set(BOO_SYS_DEFINES ${_BOO_SYS_DEFINES} CACHE PATH "boo system defines" FORCE)
add_definitions(${_BOO_SYS_DEFINES})
include_directories(include glslang)
include_directories(include glslang soxr/src)
add_library(boo
lib/inputdev/CafeProPad.cpp include/boo/inputdev/CafeProPad.hpp
@ -180,6 +180,8 @@ add_library(boo
lib/inputdev/DeviceSignature.cpp include/boo/inputdev/DeviceSignature.hpp
lib/inputdev/IHIDDevice.hpp
lib/audiodev/AudioMatrix.cpp
lib/audiodev/AudioVoice.hpp
lib/audiodev/AudioVoice.cpp
include/boo/inputdev/IHIDListener.hpp
include/boo/IGraphicsContext.hpp
include/boo/graphicsdev/IGraphicsDataFactory.hpp

View File

@ -68,7 +68,8 @@ struct AQSAudioVoice : IAudioVoice
desc.mBitsPerChannel = 16;
OSStatus err;
while ((err = AudioQueueNewOutput(&desc, AudioQueueOutputCallback(Callback), this, nullptr, nullptr, 0, &m_queue)))
while ((err = AudioQueueNewOutput(&desc, AudioQueueOutputCallback(Callback),
this, nullptr, nullptr, 0, &m_queue)))
{
if (set == AudioChannelSet::Stereo)
break;
@ -144,7 +145,9 @@ struct AQSAudioVoice : IAudioVoice
m_map.m_channels[4] = AudioChannel::FrontCenter;
break;
default:
Log.report(logvisor::Fatal, "unknown channel layout %u; using stereo", layout.mChannelLayoutTag);
Log.report(logvisor::Fatal,
"unknown channel layout %u; using stereo",
layout.mChannelLayoutTag);
m_map.m_channelCount = 2;
m_map.m_channels[0] = AudioChannel::FrontLeft;
m_map.m_channels[1] = AudioChannel::FrontRight;
@ -188,14 +191,16 @@ struct AQSAudioVoice : IAudioVoice
{
if (m_callbackBuf)
{
m_callbackBuf->mAudioDataByteSize = std::min(UInt32(frames * m_frameSize), m_callbackBuf->mAudioDataBytesCapacity);
m_callbackBuf->mAudioDataByteSize =
std::min(UInt32(frames * m_frameSize), m_callbackBuf->mAudioDataBytesCapacity);
memcpy(m_callbackBuf->mAudioData, data, m_callbackBuf->mAudioDataByteSize);
AudioQueueEnqueueBuffer(m_queue, m_callbackBuf, 0, nullptr);
}
else
{
AudioQueueBufferRef buf = m_buffers[m_primeBuf];
buf->mAudioDataByteSize = std::min(UInt32(frames * m_frameSize), buf->mAudioDataBytesCapacity);
buf->mAudioDataByteSize =
std::min(UInt32(frames * m_frameSize), buf->mAudioDataBytesCapacity);
memcpy(buf->mAudioData, data, buf->mAudioDataByteSize);
AudioQueueEnqueueBuffer(m_queue, buf, 0, nullptr);
}

View File

View File

@ -0,0 +1,16 @@
#ifndef BOO_AUDIOVOICE_HPP
#define BOO_AUDIOVOICE_HPP
#include <soxr.h>
namespace boo
{
class AudioVoice
{
soxr_t m_voice;
};
}
#endif // BOO_AUDIOVOICE_HPP

View File

@ -3,8 +3,8 @@
cmake_minimum_required (VERSION 2.8 FATAL_ERROR)
project (soxr C)
set (DESCRIPTION_SUMMARY "High quality, one-dimensional sample-rate conversion library")
#project (soxr C)
#set (DESCRIPTION_SUMMARY "High quality, one-dimensional sample-rate conversion library")
@ -34,9 +34,9 @@ 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." ON)
option (BUILD_SHARED_LIBS "Build shared libraries." ON)
option (BUILD_EXAMPLES "Build examples." OFF)
#option (BUILD_TESTS "Build sanity-tests." ON)
#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
@ -50,7 +50,7 @@ cmake_dependent_option (WITH_AVFFT "Use libavcodec (LGPL) for SIMD DFT." OFF
cmake_dependent_option (WITH_PFFFT "Use PFFFT (BSD-like licence) for SIMD DFT." ON
"WITH_SIMD;NOT WITH_AVFFT" OFF)
if (UNIX)
if (EXISTS ${PROJECT_SOURCE_DIR}/lsr-tests)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/lsr-tests)
cmake_dependent_option (BUILD_LSR_TESTS "Build LSR tests." OFF
"WITH_LSR_BINDINGS" OFF)
endif ()
@ -157,7 +157,7 @@ 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 (BIN ${CMAKE_CURRENT_BINARY_DIR}/bin/)
set (EXAMPLES_BIN ${BIN})
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN})
@ -189,7 +189,7 @@ if (NOT DEFINED INCLUDE_INSTALL_DIR)
endif ()
if (NOT DEFINED DOC_INSTALL_DIR)
if (UNIX)
set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/lib${PROJECT_NAME}")
set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/libsoxr")
else ()
set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/doc")
endif ()
@ -211,9 +211,9 @@ 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})
${CMAKE_CURRENT_SOURCE_DIR}/soxr-config.h.in
${CMAKE_CURRENT_BINARY_DIR}/soxr-config.h)
include_directories (${CMAKE_CURRENT_BINARY_DIR})
if (BUILD_TESTS OR BUILD_LSR_TESTS)
enable_testing ()
@ -229,7 +229,7 @@ install (FILES
# Subdirectories:
include_directories (${PROJECT_SOURCE_DIR}/src)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory (src)
if (BUILD_TESTS)
@ -246,53 +246,53 @@ 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 ()
#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)
#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")
#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 "TGZ")
set (CPACK_SOURCE_IGNORE_FILES "dist;/lsr-tests/;/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore;/\\\\.git/")
include (CPack)
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/cpack)
add_subdirectory (cpack)
endif ()
endif ()
#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 "TGZ")
# set (CPACK_SOURCE_IGNORE_FILES "dist;/lsr-tests/;/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore;/\\\\.git/")
#
# include (CPack)
#
# if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cpack)
# add_subdirectory (cpack)
# endif ()
#endif ()

View File

@ -19,7 +19,7 @@ if (NOT BUILD_SHARED_LIBS AND OPENMP_FOUND)
endif ()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROJECT_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROJECT_CXX_FLAGS}")
link_libraries (${PROJECT_NAME})
link_libraries (soxr)
foreach (fe ${SOURCES} ${LSR_SOURCES})
get_filename_component (f ${fe} NAME_WE)

View File

@ -52,20 +52,20 @@ endif ()
# Libsoxr:
add_library (${PROJECT_NAME} ${LIB_TYPE} ${PROJECT_NAME}.c data-io dbesi0 filter fft4g64
add_library (soxr ${LIB_TYPE} soxr.c data-io dbesi0 filter fft4g64
${SP_SOURCES} vr32 ${DP_SOURCES} ${SIMD_SOURCES})
set_target_properties (${PROJECT_NAME} PROPERTIES
set_target_properties (soxr PROPERTIES
VERSION "${SO_VERSION}"
SOVERSION ${SO_VERSION_MAJOR}
INSTALL_NAME_DIR ${LIB_INSTALL_DIR}
LINK_INTERFACE_LIBRARIES ""
PUBLIC_HEADER "${PROJECT_NAME}.h")
PUBLIC_HEADER "soxr.h")
if (BUILD_FRAMEWORK)
set_target_properties (${PROJECT_NAME} PROPERTIES FRAMEWORK TRUE)
set_target_properties (soxr PROPERTIES FRAMEWORK TRUE)
elseif (NOT WIN32)
set (TARGET_PCS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${TARGET_PCS})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
set (TARGET_PCS ${CMAKE_CURRENT_BINARY_DIR}/soxr.pc)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/soxr.pc.in ${TARGET_PCS})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/soxr.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
endif ()
@ -73,11 +73,11 @@ endif ()
# LSR bindings:
if (WITH_LSR_BINDINGS)
set (LSR ${PROJECT_NAME}-lsr)
set (LSR soxr-lsr)
set (LSR_SO_VERSION 0.1.9)
set (LSR_SO_VERSION_MAJOR 0)
add_library (${LSR} ${LIB_TYPE} lsr)
target_link_libraries (${LSR} ${PROJECT_NAME})
target_link_libraries (${LSR} soxr)
set_target_properties (${LSR} PROPERTIES
VERSION "${LSR_SO_VERSION}"
SOVERSION ${LSR_SO_VERSION_MAJOR}
@ -97,7 +97,7 @@ endif ()
# Installation (from build from source):
install (TARGETS ${PROJECT_NAME} ${LSR}
install (TARGETS soxr ${LSR}
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
@ -108,11 +108,11 @@ install (TARGETS ${PROJECT_NAME} ${LSR}
# Packaging (for unix-like distributions):
#get_property (LIB1 TARGET ${PROJECT_NAME} PROPERTY LOCATION)
#get_property (LIB1 TARGET soxr PROPERTY LOCATION)
#if (BUILD_SHARED_LIBS)
# set (LIB1 ${LIB1}.${SO_VERSION_MAJOR} ${LIB1}.${SO_VERSION})
#endif ()
#list (APPEND TARGET_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.h")
#list (APPEND TARGET_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/soxr.h")
#if (WITH_LSR_BINDINGS)
# get_property (LIB2 TARGET ${LSR} PROPERTY LOCATION)
# if (BUILD_SHARED_LIBS)

View File

@ -2,7 +2,7 @@
# Licence for this file: LGPL v2.1 See LICENCE for details.
add_definitions (${PROJECT_C_FLAGS})
link_libraries (${PROJECT_NAME})
link_libraries (soxr)
file (GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
foreach (fe ${SOURCES})