Commit d845c95f authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Introducing auto-generated VACore including paths and config possiblity via...

Introducing auto-generated VACore including paths and config possiblity via CMake. Also, VACore.ini is not under version control, therefore individual changes made are not forced to be committed.
Adding development switch for cross-talk cancellation sweet spot widening.
Refactoring and doc for VA factory.
Adding dev switch in NCTC reproduction for sweet spot widening.
parent 7833d76e
......@@ -34,11 +34,10 @@ endif( NOT DEFINED ITA_VACORE_VERSION_MINOR )
# Settings
if( NOT DEFINED ITA_VACORE_DEFAULT_CONFIG_FILE_NAME )
set( ITA_VACORE_DEFAULT_CONFIG_FILE_NAME "VACore.ini" CACHE STRING "Default VACore configuration file name (INI file)" )
set( ITA_VACORE_DEFAULT_CONFIG_FILE_NAME VACore.ini CACHE STRING "Default VACore configuration file name (INI file)" )
endif( NOT DEFINED ITA_VACORE_DEFAULT_CONFIG_FILE_NAME )
if( NOT DEFINED ITA_VACORE_DEFAULT_DEBUG_LEVEL )
set( ITA_VACORE_DEFAULT_DEBUG_LEVEL 3 CACHE INT "Default VACore debug level (0-5)" )
endif( NOT DEFINED ITA_VACORE_DEFAULT_DEBUG_LEVEL )
......@@ -60,6 +59,20 @@ if( NOT DEFINED ITA_VACORE_MAX_NUM_LISTENERS )
endif( NOT DEFINED ITA_VACORE_MAX_NUM_LISTENERS )
# Data dirs
if( NOT DEFINED ITA_VACORE_BIG_DATA_DIR )
set( ITA_VACORE_BIG_DATA_DIR "" CACHE PATH "VACore big data dir with more files for auralization (will be added to search path)" )
endif( NOT DEFINED ITA_VACORE_BIG_DATA_DIR )
if( NOT DEFINED INSIDE_SCENE_DATA )
set( INSIDE_SCENE_DATA "" CACHE PATH "InsideSceneData folder for Inside scenes" )
endif( NOT DEFINED INSIDE_SCENE_DATA )
# Development
if( NOT DEFINED ITA_VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING )
set( ITA_VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING FALSE CACHE BOOL "Crosstalk-Cancellation sweet spot widening (development)" )
endif( NOT DEFINED ITA_VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING )
# Rendering modules
......@@ -149,7 +162,7 @@ if( ${ITA_VACORE_EVENTS_ENABLED} )
add_definitions( "-DVVACORE_EVENTS_ENABLED=1" )
endif()
add_definitions( "-DVA_DEFAULT_CONFIGFILE=\"VACore.ini\"" )
add_definitions( "-DVACORE_DEFAULT_CONFIGFILE=\"${ITA_VACORE_DEFAULT_CONFIG_FILE_NAME}\"" )
add_definitions( "-DVACORE_MAX_NUM_SOURCES=${ITA_VACORE_MAX_NUM_SOURCES}" )
add_definitions( "-DVACORE_MAX_NUM_LISTENERS=${ITA_VACORE_MAX_NUM_LISTENERS}" )
......@@ -216,6 +229,11 @@ endif()
string( TIMESTAMP VACORE_CMAKE_DATE "%Y-%m-%d" )
add_definitions( "-DVACORE_CMAKE_DATE=\"${VACORE_CMAKE_DATE}\"" )
# Dev switches
if( ITA_VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING )
add_definitions( "-DVACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING" )
endif( ITA_VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING )
# Files
vista_add_files_to_sources( ProjectSources "conf" NON_RECURSIVE SOURCE_GROUP "conf" "ini" )
vista_add_files_to_sources( ProjectSources "data" SOURCE_GROUP_MIRROR_DIR "data" "wav" "daff" "mat" "ac" "skp" )
......@@ -235,6 +253,11 @@ if( ITA_VACORE_INSTALL_WITH_DLLS OR ITA_VA_INSTALL_WITH_DLLS )
vista_install_all_dlls( bin )
endif()
# VA core configuration file
configure_file( "conf/VACore.ini.proto" "${CMAKE_CURRENT_SOURCE_DIR}/conf/${ITA_VACORE_DEFAULT_CONFIG_FILE_NAME}" @ONLY )
# tests
set( VACORE_COMMON_BUILD TRUE )
#add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
#
# VACore default configuration file
# -------------------------------------------------------------------------------------------
#
# VVV VVV A
# VVV VVV AAA Virtual Acoustics (VA)
# VVV VVV AAA Real-time auralisation for virtual reality
# VVV VVV AAA
# VVVVVV AAA (c) Copyright Institut of Technical Acoustics (ITA)
# VVVV AAA RWTH Aachen University (http://www.akustik.rwth-aachen.de)
#
# -------------------------------------------------------------------------------------------
#
# WARNING: This configuration file for the VACore has been automatically created by CMake.
# You can move this file and change the argument path accordingly, otherwise
# your changes will will be overwritten. Alternatively, you can directly modify
# the prototype file 'VACore.ini.proto' and re-run CMake.
#
[Paths]
# Any entry value will be added to the search path list, if existing. They will also be made available as macros (see below).
# Any entry value will be added to the search path list, but only if existing! They will also be made available as macros (see below).
# If a file can not be found during runtime by local name, the core will try to locate it using the paths in ascending name order.
# Macros are not substituted, here.
# Macros are not substituted, here. However, it is recommended to use AddSearchPath during runtime, if you have individual directories
# you want to add.
# Relative configuration path (with some more hardware setup files)
conf_dir = conf
# Relative data path (with some common files)
data_dir = data
# Absolute data path with further files (big data, not shipped with VA)
big_data_dir = @ITA_VACORE_BIG_DATA_DIR@
# Inside scene data directory
InsideSceneData = @INSIDE_SCENE_DATA@
[Files]
# List further config files to be appended to this configuration (also looking at paths)
#VRLabSetup = VASetup.VRLab.ini
[Macros]
# Macros can be defined and will be replaced with given value by the core. Usage: "$(MyMacroName)/file.abc" -> "MyValue/file.abc"
# Macros are substituted forwardly by key name order (use with care), otherwise stay untouched: A = B; C = $(A) -> $(C) is B
DefaultHRIR = HRIR/ITA-Kunstkopf_HRIR_AP11_Pressure_Equalized_3x3_256.v17.ir.daff
HumanDir = Directivity/Saenger.v17.ms.daff
Trompet = Directivity/Trompete1.v17.ms.daff
Trumpet = Directivity/Trompete1.v17.ms.daff
# Legacy support, please use $(DefaultHRIR) macro
VADefaultHRIRDataset = $(DefaultHRIR)
[Debug]
......@@ -33,7 +66,7 @@ Trompet = Directivity/Trompete1.v17.ms.daff
#DumpFinalOutput = $(ProjectName)_out.wav
# Set log level: 0 = quiet; 1 = errors; 2 = warnings (default); 3 = info; 4 = verbose; 5 = trace;
LogLevel = 3
LogLevel = @ITA_VACORE_DEFAULT_DEBUG_LEVEL@
[Audio driver]
......
......@@ -17,9 +17,9 @@
#include <VACoreDefinitions.h>
#include <VAStruct.h>
#ifndef VA_DEFAULT_CONFIGFILE
#define VA_DEFAULT_CONFIGFILE "\"VACore.ini\""
#endif // VA_DEFAULT_CONFIGFILE
#ifndef VACORE_DEFAULT_CONFIGFILE
#define VACORE_DEFAULT_CONFIGFILE "\"VACore.ini\""
#endif // VACORE_DEFAULT_CONFIGFILE
// Foward declarations
class IVACore;
......@@ -27,13 +27,17 @@ class IVACore;
namespace VACore
{
//! Factory method - creates a VACore instance
/**
* @input oArgs Arguments with configuration for the core
* @output Pointer to the core instance (VA interface API from VABase)
*/
VACORE_API IVACore* CreateCoreInstance( const CVAStruct& oArgs );
//! Factore method - create a VACore instance with configuration file
VACORE_API IVACore* CreateCoreInstance( const std::string& sConfigFile = VA_DEFAULT_CONFIGFILE );
VACORE_API IVACore* CreateCoreInstance( const std::string& sConfigFile = VACORE_DEFAULT_CONFIGFILE );
//! Returns the filesystem path of the VACore shared lib (e.g. VACore.dll)
VACORE_API std::string GetCoreLibFilename();
VACORE_API std::string GetCoreLibFilePath();
} // End of namespace "VACore"
......
......@@ -94,6 +94,14 @@ CVANCTCReproduction::CVANCTCReproduction( const CVAAudioReproductionModuleInitPa
m_vpSpectra.push_back( new ITAHDFTSpectra( oNCTCConf.dSampleRate, 2, oNCTCConf.iCTCFilterLength+1, true ) );
}
#ifdef VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING
double dCrossTalkCancellationFactor = -1;
conf.OptNumber( "CrossTalkCancellationFactor", dCrossTalkCancellationFactor, 1.0f );
oNCTCConf.fCrossTalkCancellationFactor = float( dCrossTalkCancellationFactor );
double dWaveIncidenceAngleCompensationFactor = -1;
conf.OptNumber( "WaveIncidenceAngleCompensationFactor", dWaveIncidenceAngleCompensationFactor, 1.0f );
oNCTCConf.fWaveIncidenceAngleCompensationFactor = float( dWaveIncidenceAngleCompensationFactor );
#endif
// Create NCTC instance
m_pNCTC = new ITANCTC( oNCTCConf );
......@@ -128,6 +136,7 @@ CVANCTCReproduction::CVANCTCReproduction( const CVAAudioReproductionModuleInitPa
m_pdsStreamFilter = new ITANCTCStreamFilter( oNCTCStreamConf );
return;
}
......@@ -264,6 +273,38 @@ int CVANCTCReproduction::CallObject( const CVAStruct& oArgs, CVAStruct& oReturn
return 0;
}
#ifdef VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING
if( ( pStruct = oArgs.GetValue( "CrossTalkCancellationFactor" ) ) != nullptr )
{
if( pStruct->GetDatatype() != CVAStructValue::DOUBLE )
VA_EXCEPT2( INVALID_PARAMETER, "CrossTalkCancellationFactor value must be numerical" );
m_pNCTC->SetCrossTalkCancellationFactor( float( double( *pStruct ) ) );
// Force update
m_pNCTC->CalculateFilter( m_vpSpectra );
m_pdsStreamFilter->ExchangeFilters( m_vpSpectra );
return 0;
}
if( ( pStruct = oArgs.GetValue( "WaveIncidenceAngleCompensation" ) ) != nullptr )
{
if( pStruct->GetDatatype() != CVAStructValue::DOUBLE )
VA_EXCEPT2( INVALID_PARAMETER, "WaveIncidenceAngleCompensation value must be numerical" );
m_pNCTC->SetWaveIncidenceAngleCompensationFactor( float( double( *pStruct ) ) );
// Force update
m_pNCTC->CalculateFilter( m_vpSpectra );
m_pdsStreamFilter->ExchangeFilters( m_vpSpectra );
return 0;
}
#endif
return -1;
}
......
......@@ -276,11 +276,15 @@ IVACore* VACore::CreateCoreInstance( const std::string& sConfigFile )
// Trick um DLL-Pfad zu ermitteln
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
std::string VACore::GetCoreLibFilename()
std::string VACore::GetCoreLibFilePath()
{
CHAR pszPath[MAX_PATH+1] = {0};
CHAR pszPath[ MAX_PATH + 1 ] = { 0 };
#ifdef WIN32
GetModuleFileNameA( (HINSTANCE) &__ImageBase, pszPath, _countof(pszPath) );
return pszPath;
#else
VA_EXCEPT2( NOT_IMPLEMENTED, "This function is not implemented for your platform. Sorry." );
#endif // WIN32
return std::string( pszPath );
}
CVACoreImpl::CVACoreImpl(const CVAStruct& oArgs)
......
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