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

Refactoring core init with file path

parent 149739e6
......@@ -17,6 +17,8 @@
#include <VACoreDefinitions.h>
#include <VAStruct.h>
#include <string>
#ifndef VACORE_DEFAULT_CONFIGFILE
#define VACORE_DEFAULT_CONFIGFILE "\"VACore.ini\""
#endif // VACORE_DEFAULT_CONFIGFILE
......@@ -32,13 +34,25 @@ namespace VACore
* @return Pointer to the core instance (VA interface API from VABase)
*/
VACORE_API IVAInterface* CreateCoreInstance( const CVAStruct& oArgs );
//! Parses input INI configuration file and converts it into a VA core config struct
/**
* @param[in] sConfigFilePath File path to core config (INI) file
* @return Core configuration
*/
VACORE_API CVAStruct GetCoreConfigFromFile( const std::string& sConfigFilePath );
//! Factore method - create a VACore instance with configuration file
/**
* @param[in] sConfigFile Configuration file, or default file
* @return Pointer to the core instance (VA interface API from VABase)
*
* @sa GetCoreConfigFromFile()
*/
VACORE_API IVAInterface* CreateCoreInstance( const std::string& sConfigFile = VACORE_DEFAULT_CONFIGFILE );
inline IVAInterface* CreateCoreInstance( const std::string& sConfigFile = VACORE_DEFAULT_CONFIGFILE )
{
return CreateCoreInstance( VACore::GetCoreConfigFromFile( sConfigFile ) );
};
//! Returns the filesystem path of the VACore shared lib (e.g. VACore.dll)
/**
......
......@@ -804,8 +804,8 @@ void CVABinauralAirTrafficNoiseAudioRenderer::ProcessStream( const ITAStreamInfo
bool bERGlobalStatusEnabled = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_EARLY_REFLECTIONS ) > 0;
bool bEREnabled = bERSourceStatusEnabled && bERListenerStatusEnabled && bERGlobalStatusEnabled;
float fDirectSoundPathOverallGain = float( pPath->oDirSoundPath.dGeometricalSpreadingLoss * pSourceState->GetVolume() );
float fReflectedSoundPathOverallGain = float( pPath->oRefSoundPath.dGeometricalSpreadingLoss * pSourceState->GetVolume() );
float fDirectSoundPathOverallGain = float( pPath->oDirSoundPath.dGeometricalSpreadingLoss * pSourceState->GetVolume( m_pCore->GetCoreConfig()->dDefaultAmplitudeCalibration ) );
float fReflectedSoundPathOverallGain = float( pPath->oRefSoundPath.dGeometricalSpreadingLoss * pSourceState->GetVolume( m_pCore->GetCoreConfig()->dDefaultAmplitudeCalibration ) );
if( pPath->pSoundSource->pData->bMuted )
{
fDirectSoundPathOverallGain = 0.0f;
......@@ -865,14 +865,14 @@ void CVABinauralAirTrafficNoiseAudioRenderer::ProcessStream( const ITAStreamInfo
pPath->oDirSoundPath.pThirdOctaveFilterBank->Process( ctxAudio.m_sbTempBufD.data(), ctxAudio.m_sbTempBufD.data() ); // inplace
pPath->oRefSoundPath.pThirdOctaveFilterBank->Process( ctxAudio.m_sbTempBufR.data(), ctxAudio.m_sbTempBufR.data() ); // inplace
pPath->oDirSoundPath.pFIRConvolverChL->Process( ctxAudio.m_sbTempBufD.data(), ( *pPath->pSoundReceiver->psfOutput )[ 0 ].data(), ITAUPConvolution::OUTPUT_MIX );
pPath->oRefSoundPath.pFIRConvolverChL->Process( ctxAudio.m_sbTempBufR.data(), ( *pPath->pSoundReceiver->psfOutput )[ 0 ].data(), ITAUPConvolution::OUTPUT_MIX );
pPath->oRefSoundPath.pFIRConvolverChL->Process( ctxAudio.m_sbTempBufR.data(), ( *pPath->pSoundReceiver->psfOutput )[ 0 ].data(), ITAUPConvolution::OUTPUT_MIX );
pPath->oDirSoundPath.pFIRConvolverChR->Process( ctxAudio.m_sbTempBufD.data(), ( *pPath->pSoundReceiver->psfOutput )[ 1 ].data(), ITAUPConvolution::OUTPUT_MIX );
pPath->oRefSoundPath.pFIRConvolverChR->Process( ctxAudio.m_sbTempBufR.data(), ( *pPath->pSoundReceiver->psfOutput )[ 1 ].data(), ITAUPConvolution::OUTPUT_MIX );
spit++;
}
......@@ -1237,10 +1237,10 @@ CVABATNSoundPath::CVABATNSoundPath( double dSamplerate, int iBlocklength, int iH
{
oDirSoundPath.pThirdOctaveFilterBank = CITAThirdOctaveFilterbank::Create( dSamplerate, iBlocklength,
CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE );
//CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
//CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
oRefSoundPath.pThirdOctaveFilterBank = CITAThirdOctaveFilterbank::Create( dSamplerate, iBlocklength,
CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE );
//CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
//CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
oDirSoundPath.pThirdOctaveFilterBank->SetIdentity();
oRefSoundPath.pThirdOctaveFilterBank->SetIdentity();
......
......@@ -718,7 +718,7 @@ void CVAPTHearingAidRenderer::ProcessStream( const ITAStreamInfo* pStreamInfo )
bool bDSGlobalStatusEnabled = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_DIRECT_SOUND );
bool bDSEnabled = bDSSourceStatusEnabled && bDSListenerStatusEnabled && bDSGlobalStatusEnabled;
float fSoundSourceGain = float( dDistanceDecrease * pSourceState->GetVolume( m_oParams.pCore->GetCoreConfig()->dDefaultAmplitudeCalibration ) );
float fSoundSourceGain = float( dDistanceDecrease * pSourceState->GetVolume( m_pCore->GetCoreConfig()->dDefaultAmplitudeCalibration ) );
if( pPath->pSource->pData->bMuted || ( bDSEnabled == false ) )
fSoundSourceGain = 0.0f;
pPath->pFIRConvolverChL1->SetGain( ( float ) m_dRenderingGain*fSoundSourceGain );
......
......@@ -185,12 +185,12 @@ IVAInterface* VACore::CreateCoreInstance( const CVAStruct& oArgs )
return new CVACoreImpl( oArgs );
}
IVAInterface* VACore::CreateCoreInstance( const std::string& sConfigFile )
CVAStruct VACore::GetCoreConfigFromFile( const std::string& sConfigFilePath )
{
CVAStruct oFinalCoreConfigStruct, oCurrentConfig;
std::list< VistaFileSystemFile > voConfigFiles;
std::vector< VistaFileSystemDirectory > voIncludePaths;
voConfigFiles.push_back( VistaFileSystemFile( sConfigFile ) );
voConfigFiles.push_back( VistaFileSystemFile( sConfigFilePath ) );
VA_PRINT( "VA working directory: '" << VistaFileSystemDirectory::GetCurrentWorkingDirectory() << "'" );
......@@ -253,7 +253,7 @@ IVAInterface* VACore::CreateCoreInstance( const std::string& sConfigFile )
oFinalCoreConfigStruct.Merge( oCurrentConfig, true );
}
return CreateCoreInstance( oFinalCoreConfigStruct );
return oFinalCoreConfigStruct;
}
#ifdef WIN32
......@@ -881,7 +881,7 @@ void CVACoreImpl::GetModules( std::vector< CVAModuleInfo >& viModuleInfos ) cons
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
}
CVAStruct CVACoreImpl::CallModule( const std::string& sModuleName, const CVAStruct& oArgs )
{
......@@ -924,7 +924,7 @@ CVAStruct CVACoreImpl::CallModule( const std::string& sModuleName, const CVAStru
#endif // VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
}
CVAStruct CVACoreImpl::GetSearchPaths() const
{
......@@ -1870,7 +1870,7 @@ CVASoundSourceInfo CVACoreImpl::GetSoundSourceInfo( const int iID ) const
CVASoundSourceInfo oInfo;
oInfo.iID = oDesc->iID;
oInfo.bMuted = oDesc->bMuted;
oInfo.dSpoundPower = oDesc->fSoundPowerLevelDB;
oInfo.dSpoundPower = oDesc->fSoundPower;
oInfo.sName = oDesc->sName;
return oInfo;
}
......
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