Commit b209af11 authored by Jonas Stienen's avatar Jonas Stienen

Merge branch 'feature/sweetspot_widening'

# Conflicts:
#	include/ITANCTC.h
#	src/ITANCTC.cpp
parents 9024a769 32c5a40d
......@@ -6,12 +6,21 @@ list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
# dependencies
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaBase VistaTools VistaAspects VistaInterProcComm FIND_DEPENDENCIES )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITAFFT REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITAConvolution REQUIRED FIND_DEPENDENCIES )
vista_use_package( OpenDAFF REQUIRED )
if( NOT DEFINED ITA_CORE_LIBS_BUILD_STATIC )
set( ITA_CORE_LIBS_BUILD_STATIC OFF CACHE BOOL "Build all ITA core libs in static mode" )
endif( NOT DEFINED ITA_CORE_LIBS_BUILD_STATIC )
if( NOT DEFINED ITA_VISTA_BUILD_STATIC )
set( ITA_VISTA_BUILD_STATIC OFF CACHE BOOL "Build against static ViSTA libraries" )
endif( NOT DEFINED ITA_VISTA_BUILD_STATIC )
if( NOT DEFINED ITA_CTC_WITH_DUAL_CTC )
set( ITA_CTC_WITH_DUAL_CTC OFF CACHE BOOL "Build support for Crosstalk-Cancellation with arbitrary loudspeaker number and pose" )
endif( NOT DEFINED ITA_CTC_WITH_DUAL_CTC )
......@@ -24,6 +33,10 @@ if( NOT DEFINED ITA_CTC_WITH_QUAD_CTC )
set( ITA_CTC_WITH_QUAD_CTC OFF CACHE BOOL "Build support for quad-loudspeaker Crosstalk-Cancellation (deprecated)" )
endif( NOT DEFINED ITA_CTC_WITH_QUAD_CTC )
if( NOT DEFINED ITA_CTC_NCTC_EXPORT_FILTER_TO_HARDDRIVE )
set( ITA_CTC_NCTC_EXPORT_FILTER_TO_HARDDRIVE OFF CACHE BOOL "Export HRIR input,, intermediate results and final CTC filter set to harddrive (as multi-channel WAV files)" )
endif( NOT DEFINED ITA_CTC_NCTC_EXPORT_FILTER_TO_HARDDRIVE )
# includes
include_directories( "include" )
......@@ -53,15 +66,34 @@ if( ITA_CTC_WITH_QUAD_CTC )
set( ITACTCSources "${ITACTCSources}" "src/ITAQuadCTC.cpp" "src/ITAQuadCTCStreamFilter.cpp" )
endif( ITA_CTC_WITH_QUAD_CTC )
if( ITA_CTC_NCTC_EXPORT_FILTER_TO_HARDDRIVE )
add_definitions( -DNCTC_EXPORT_FILTER_TO_HARDDRIVE )
endif( ITA_CTC_NCTC_EXPORT_FILTER_TO_HARDDRIVE )
# compiler
add_definitions( -DITA_BASE_DLL -DITA_FFT_DLL -DITA_CONVOLUTION_DLL -DITA_CTC_DLL -DITA_CTC_EXPORT )
# compiler settings
if( ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
endif( ITA_VISTA_BUILD_STATIC )
if( NOT ITA_CORE_LIBS_BUILD_STATIC )
add_definitions( -DITA_CTC_EXPORT )
else( NOT ITA_CORE_LIBS_BUILD_STATIC )
add_definitions( -DITA_FFT_STATIC -DITA_BASE_STATIC -DITA_CONVOLUTION_STATIC -DITA_CTC_STATIC )
set( BUILD_SHARED_LIBS_TEMP ${BUILD_SHARED_LIBS} )
if( BUILD_SHARED_LIBS )
set( BUILD_SHARED_LIBS OFF )
message( "Ignoring activated BUILD_SHARED_LIBS temporary because static ITA core libs requested" )
endif( BUILD_SHARED_LIBS )
endif( NOT ITA_CORE_LIBS_BUILD_STATIC )
# linker
add_library( ITACTC SHARED ${ITACTCHeader} ${ITACTCSources} )
add_library( ITACTC ${ITACTCHeader} ${ITACTCSources} )
target_link_libraries( ITACTC ${VISTA_USE_PACKAGE_LIBRARIES} )
set( BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_TEMP} )
# configure
vista_configure_lib( ITACTC )
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2016
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: ITACTCDefinitions.h 2900 2012-09-17 08:42:42Z stienen $
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2016
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_CTC_DEFINITIONS
#define INCLUDE_WATCHER_ITA_CTC_DEFINITIONS
#ifdef ITA_CTC_DLL
#ifdef ITA_CTC_EXPORT
#define ITA_CTC_API __declspec(dllexport)
#else
#define ITA_CTC_API __declspec(dllimport)
#endif
#if ( defined WIN32 ) && !( defined ITA_CTC_STATIC )
#ifdef ITA_CTC_EXPORT
#define ITA_CTC_API __declspec( dllexport )
#else
#define ITA_CTC_API __declspec( dllimport )
#endif
#else
#define ITA_CTC_API
#define ITA_CTC_API
#endif
#endif // INCLUDE_WATCHER_ITA_CTC_DEFINITIONS
......@@ -73,8 +73,9 @@ public:
* of the object, they can also be set in yaw, pitch and
* roll convention.
*/
struct ITA_CTC_API Pose
class ITA_CTC_API Pose
{
public:
inline Pose() {};
VistaVector3D vPos; //!< Position vector
......@@ -104,31 +105,39 @@ public:
* the corresponding setters/getters
*
*/
struct ITA_CTC_API Config
class ITA_CTC_API Config
{
inline Config()
{
voLoudspeaker.clear();
}
public:
enum
{
OPTIMIZATION_NONE = 0, //!< No optimization in filter design
};
Config();
int N; //!< Number of loudspeakers
int iCTCFilterLength; //!< CTC filter taps, i.e. 4096
double dSampleRate; //!< Sampling rate
float fSpeedOfSound; //!< Speed of sound, m/s
int iOptimization; //!< Optimization algorithm (future work, see features/room_compensation)
float fCrossTalkCancellationFactor; //!< Factor for cross-talk cancellation (none = 0.0, full = 1.0)
float fWaveIncidenceAngleCompensationFactor; //!< Factor for cross-talk cancellation (none = 0.0, full = 1.0)
class ITA_CTC_API Loudspeaker
{
public:
enum
{
SIDE_NOT_SPECIFIED = 0, //!@ Side of the loudspeaker not specified
LEFT_SIDE = 1, //!@ Loudspeaker is left from listener viewpoint
RIGHT_SIDE = 2, //!@ Loudspeaker is right from listener viewpoint
};
Loudspeaker();
Loudspeaker( const Pose& oStaticPose );
Pose oPose; //!< Pose of loudspeaker
const DAFFContentDFT* pDirectivity; //!< Directivity data
int iSide;
};
std::vector< Loudspeaker > voLoudspeaker; //!< Loudspeaker of this setup
......@@ -162,6 +171,7 @@ public:
/**
* \return Static configuration parameters
*/
const Config& GetConfig() const;
//! Get beta parameter
......@@ -176,6 +186,30 @@ public:
*/
void SetBeta( float fBeta );
//! Get cross-talk cancellation factor
/**
* \return Factor [0..1]
*/
float GetCrossTalkCancellationFactor();
//! Set cross-talk cancellation factor
/**
* \param fFactor number between [0..1] (none: 0, max range = 1.0)
*/
void SetCrossTalkCancellationFactor( float fFactor );
//! Get cross-talk cancellation factor
/**
* \return Factor [0..1]
*/
float GetWaveIncidenceAngleCompensation();
//! Set cross-talk cancellation factor
/**
* \param fFactor number between [0..1] (none: 0, max range = 1.0)
*/
void SetWaveIncidenceAngleCompensationFactor( float fFactor );
//! Get additional delay parameter
/**
* \return Delay in seconds
......@@ -271,6 +305,8 @@ private:
std::atomic< float > m_fBeta; //!< Beta parameter (regularization)
std::vector< float > m_vfDelayTime; //!< Add a delay [seconds] to the resulting CTC filter (individual channels)
std::atomic <int > m_iOptimization; //!< Optimization (see Config enum)
std::atomic< float > m_fCrossTalkCancellationFactor; //!< Factor for cross-talk cancellation (none = 0.0, full = 1.0)
std::atomic< float > m_fWaveIncidenceAngleCompensationFactor; //!< Factor for cross-talk cancellation (none = 0.0, full = 1.0)
const DAFFContentIR* m_pHRIR; //!< HRIR dataset pointer
Pose m_oHeadPose; //!< Current head Pose data
......@@ -283,7 +319,7 @@ private:
std::vector< ITAHDFTSpectra* > m_vpHelper2x2; //!< Two-by-two helper matrix
ITAHDFTSpectrum* t; //!< Helper
ITAHDFTSpectrum* det; //!< Helper
int GetLoudspeakerSide(int);
//! Adds a HRIR into the target filter
/**
* @param oLoudspeakerPose Pose of loudspeaker (or virtual source)
......
This diff is collapsed.
......@@ -8,11 +8,20 @@ if( NOT ITACTC_COMMON_BUILD )
endif()
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITACTC REQUIRED FIND_DEPENDENCIES )
vista_use_package( OpenDAFF REQUIRED FIND_DEPENDENCIES )
if( ITA_CORE_LIBS_BUILD_STATIC AND DEFINED ITA_CORE_LIBS_BUILD_STATIC )
add_definitions( -DITA_BASE_STATIC -DITA_CTC_STATIC )
endif( ITA_CORE_LIBS_BUILD_STATIC AND DEFINED ITA_CORE_LIBS_BUILD_STATIC )
if( ITA_VISTA_BUILD_STATIC AND DEFINED ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTATOOLS_STATIC -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTAINTERPROCCOMM_STATIC )
endif( ITA_VISTA_BUILD_STATIC AND DEFINED ITA_VISTA_BUILD_STATIC )
add_definitions( -DITA_BASE_DLL -DITA_CTC_DLL )
if( ITA_CTC_WITH_N_CTC )
......
// $Id: ^NCTC_CTCFilterTest.cpp,v 1.1 2008-11-19 00:14:45 stienen Exp $
#include <ITANCTC.h>
#include <ITACTCUtils.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment