WITH_SAMPLERATE option for cmake, without this playback wont behave right so this is mainly intended for developers who build without audio enabled.
This commit is contained in:
parent
5fff1a98a1
commit
c85c2746df
|
@ -112,6 +112,7 @@ ENDIF()
|
|||
OPTION(WITH_SDL "Enable SDL for sound and joystick support" ON)
|
||||
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
||||
OPTION(WITH_JACK "Enable Jack Support (http://www.jackaudio.org)" OFF)
|
||||
OPTION(WITH_SAMPLERATE "Enable samplerate conversion" ON)
|
||||
|
||||
# Compression
|
||||
OPTION(WITH_LZO "Enable fast LZO compression (used for pointcache)" ON)
|
||||
|
@ -279,10 +280,12 @@ IF(UNIX AND NOT APPLE)
|
|||
SET(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||
ENDIF(WITH_FFTW3)
|
||||
|
||||
SET(LIBSAMPLERATE /usr)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
IF(WITH_SAMPLERATE)
|
||||
SET(LIBSAMPLERATE /usr)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
IF (WITH_OPENCOLLADA)
|
||||
SET(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory")
|
||||
|
@ -375,10 +378,12 @@ ELSEIF(WIN32)
|
|||
SET(ICONV_LIBPATH ${ICONV}/lib)
|
||||
ENDIF(WITH_INTERNATIONAL)
|
||||
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB libsamplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
IF(WITH_SAMPLERATE)
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB libsamplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
SET(PNG "${LIBDIR}/png")
|
||||
SET(PNG_INC "${PNG}/include")
|
||||
|
@ -776,10 +781,12 @@ ELSEIF(APPLE)
|
|||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
|
||||
ENDIF(WITH_FFMPEG)
|
||||
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
IF(WITH_SAMPLERATE)
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
SET(LLIBS stdc++ SystemStubs)
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ MACRO(SETUP_LIBDIRS)
|
|||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
LINK_DIRECTORIES(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH} ${LIBSAMPLERATE_LIBPATH})
|
||||
|
||||
LINK_DIRECTORIES(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
||||
|
||||
IF(WITH_PYTHON)
|
||||
LINK_DIRECTORIES(${PYTHON_LIBPATH})
|
||||
ENDIF(WITH_PYTHON)
|
||||
|
@ -91,6 +91,9 @@ MACRO(SETUP_LIBDIRS)
|
|||
IF(WITH_SNDFILE)
|
||||
LINK_DIRECTORIES(${SNDFILE_LIBPATH})
|
||||
ENDIF(WITH_SNDFILE)
|
||||
IF(WITH_SAMPLERATE)
|
||||
LINK_DIRECTORIES(${LIBSAMPLERATE_LIBPATH})
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
IF(WITH_FFTW3)
|
||||
LINK_DIRECTORIES(${FFTW3_LIBPATH})
|
||||
ENDIF(WITH_FFTW3)
|
||||
|
@ -124,7 +127,7 @@ MACRO(SETUP_LIBLINKS
|
|||
ENDIF(WITH_PYTHON)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIBRARY} ${LIBSAMPLERATE_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIBRARY})
|
||||
|
||||
IF(WITH_INTERNATIONAL)
|
||||
TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
|
||||
|
@ -146,6 +149,9 @@ MACRO(SETUP_LIBLINKS
|
|||
IF(WITH_SNDFILE)
|
||||
TARGET_LINK_LIBRARIES(${target} ${SNDFILE_LIB})
|
||||
ENDIF(WITH_SNDFILE)
|
||||
IF(WITH_SAMPLERATE)
|
||||
TARGET_LINK_LIBRARIES(${target} ${LIBSAMPLERATE_LIB})
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
IF(WITH_SDL)
|
||||
TARGET_LINK_LIBRARIES(${target} ${SDL_LIBRARY})
|
||||
ENDIF(WITH_SDL)
|
||||
|
|
|
@ -61,8 +61,6 @@ SET(SRC
|
|||
FX/AUD_SuperposeFactory.cpp
|
||||
FX/AUD_SuperposeReader.cpp
|
||||
FX/AUD_VolumeFactory.cpp
|
||||
SRC/AUD_SRCResampleFactory.cpp
|
||||
SRC/AUD_SRCResampleReader.cpp
|
||||
intern/AUD_3DMath.h
|
||||
intern/AUD_Buffer.cpp
|
||||
intern/AUD_Buffer.h
|
||||
|
@ -164,6 +162,14 @@ IF(WITH_SNDFILE)
|
|||
)
|
||||
ENDIF(WITH_SNDFILE)
|
||||
|
||||
IF(WITH_SAMPLERATE)
|
||||
ADD_DEFINITIONS(-DWITH_SAMPLERATE)
|
||||
SET(SRCFILESRC
|
||||
SRC/AUD_SRCResampleFactory.cpp
|
||||
SRC/AUD_SRCResampleReader.cpp
|
||||
)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
#IF(WITH_FFTW3)
|
||||
# ADD_DEFINITIONS(-DWITH_FFTW3)
|
||||
# LIST(APPEND INC fftw ${FFTW3_INC})
|
||||
|
@ -181,6 +187,6 @@ IF(WITH_PYTHON)
|
|||
ADD_DEFINITIONS(-DWITH_PYTHON)
|
||||
ENDIF(WITH_PYTHON)
|
||||
|
||||
SET(SRC ${SRC} ${FFMPEGSRC} ${SNDFILESRC} ${FFTW3SRC} ${SDLSRC} ${OPENALSRC} ${JACKSRC} ${PYTHONSRC})
|
||||
SET(SRC ${SRC} ${FFMPEGSRC} ${SNDFILESRC} ${SRCFILESRC} ${FFTW3SRC} ${SDLSRC} ${OPENALSRC} ${JACKSRC} ${PYTHONSRC})
|
||||
|
||||
BLENDERLIB(bf_intern_audaspace "${SRC}" "${INC}")
|
||||
|
|
|
@ -44,4 +44,7 @@ if env['WITH_BF_PYTHON']:
|
|||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
|
||||
incs += ' ' + env['BF_PTHREADS_INC']
|
||||
|
||||
# not optional with scons yet
|
||||
defs.append('WITH_SAMPLERATE')
|
||||
|
||||
env.BlenderLib ('bf_intern_audaspace', sources, Split(incs), defs, libtype=['intern','player'], priority = [25,215] )
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
*/
|
||||
|
||||
#include "AUD_DefaultMixer.h"
|
||||
#ifdef WITH_SAMPLERATE
|
||||
#include "AUD_SRCResampleReader.h"
|
||||
#endif
|
||||
#include "AUD_ChannelMapperReader.h"
|
||||
#include "AUD_ChannelMapperFactory.h"
|
||||
|
||||
|
@ -50,10 +52,12 @@ AUD_IReader* AUD_DefaultMixer::prepare(AUD_IReader* reader)
|
|||
specs.channels = m_specs.channels;
|
||||
}
|
||||
|
||||
#ifdef WITH_SAMPLERATE
|
||||
// resample
|
||||
if(specs.rate != m_specs.rate)
|
||||
reader = new AUD_SRCResampleReader(reader, m_specs.specs);
|
||||
|
||||
#endif
|
||||
|
||||
// rechannel
|
||||
if(specs.channels != m_specs.channels)
|
||||
reader = new AUD_ChannelMapperReader(reader,
|
||||
|
|
Loading…
Reference in New Issue