Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

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

Adding files for a new outdoor noise renderer

parent e070bac6
......@@ -143,6 +143,9 @@ endif( )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE )
set( ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE ON CACHE BOOL "Build VACore with rendering module: air traffic noise (VATSS)" )
endif( )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE )
set( ITA_VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE OFF CACHE BOOL "Build VACore with rendering module: outdoor noise" )
endif( )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_PROTOTYPE_FREE_FIELD )
set( ITA_VACORE_WITH_RENDERER_PROTOTYPE_FREE_FIELD ON CACHE BOOL "Build VACore with rendering module: prototype free-field" )
......@@ -272,6 +275,9 @@ endif( )
if( ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE" )
endif( )
if( ITA_VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE )
add_definitions( -DVACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE )
endif( )
if( ITA_VACORE_WITH_RENDERER_PROTOTYPE_FREE_FIELD )
add_definitions( "-DVACORE_WITH_RENDERER_PROTOTYPE_FREE_FIELD" )
endif( )
......@@ -332,7 +338,7 @@ vista_add_files_to_sources( ProjectSources "conf" NON_RECURSIVE SOURCE_GROUP "co
vista_add_files_to_sources( ProjectSources "data" SOURCE_GROUP_MIRROR_DIR "data" "wav" "daff" "mat" "ac" "skp" )
add_library( VACore ${ProjectSources} )
add_library( VACore ${ProjectSources} "conf/VACore.ini.proto" )
target_link_libraries( VACore ${VISTA_USE_PACKAGE_LIBRARIES} ) # contains all libraries from vista_use_package() calls
set( BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_TEMP} )
......
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#include "VABinauralOutdoorNoiseAudioRenderer.h"
#ifdef VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE
#include "../../../Filtering/VATemporalVariations.h"
// VA includes
#include <VA.h>
#include <VAObjectPool.h>
#include <VAReferenceableObject.h>
#include "../../../directivities/VADirectivityDAFFEnergetic.h"
#include "../../../directivities/VADirectivityDAFFHRIR.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
#include "../../../Motion/VASampleAndHoldMotionModel.h"
#include "../../../Scene/VAScene.h"
#include "../../../Utils/VAUtils.h"
#include "../../../VAAudiostreamTracker.h"
#include "../../../VACoreImpl.h"
#include "../../../VACoreConfig.h"
#include "../../../VALog.h"
// ITA includes
#include <DAFF.h>
#include <ITAUPConvolution.h>
#include <ITAUPFilter.h>
#include <ITAUPFilterPool.h>
#include <ITAAtomicPrimitives.h>
#include <ITAThirdOctaveFilterbank.h>
#include <ITAClock.h>
#include <ITACriticalSection.h>
//#include <ITAConfigUtils.h>
#include <ITADataSourceRealization.h>
#include <ITASampleBuffer.h>
#include <ITAStopWatch.h>
#include <ITASampleFrame.h>
#include <ITAStreamInfo.h>
#include <ITAFastMath.h>
// Vista includes
#include <VistaInterProcComm/Concurrency/VistaThreadEvent.h>
// STL includes
#include <assert.h>
#include <fstream>
#include <iomanip>
// 3rdParty includes
#include <tbb/concurrent_queue.h>
// Renderer
CVABinauralOutdoorNoiseAudioRenderer::CVABinauralOutdoorNoiseAudioRenderer( const CVAAudioRendererInitParams& oParams )
: CVAOutdoorNoiseAudioRenderer( oParams )
, ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
{
m_iHRIRFilterLength = 128;
if( oParams.pConfig->HasKey( "HRIRFilterLength" ) )
m_iHRIRFilterLength = ( *oParams.pConfig )[ "HRIRFilterLength" ];
}
CVABinauralOutdoorNoiseAudioRenderer::~CVABinauralOutdoorNoiseAudioRenderer()
{
}
ITADatasource* CVABinauralOutdoorNoiseAudioRenderer::GetOutputDatasource()
{
return this;
}
void CVABinauralOutdoorNoiseAudioRenderer::ProcessStream( const ITAStreamInfo* pStreamInfo )
{
// If streaming is active, set to 1
ctxAudio.m_iStatus = 1;
float* pfOutputChL = GetWritePointer( 0 );
float* pfOutputChR = GetWritePointer( 1 );
fm_zero( pfOutputChL, GetBlocklength() );
fm_zero( pfOutputChR, GetBlocklength() );
const CVAAudiostreamState* pStreamState = dynamic_cast< const CVAAudiostreamState* >( pStreamInfo );
double dReceiverTime = pStreamState->dSysTime;
// Important: process DSP audio components of base class
CVAOutdoorNoiseAudioRenderer::Process( dReceiverTime );
// Check for reset request
if( ctxAudio.m_iResetFlag == 1 )
{
ResetInternalData();
return;
}
else if( ctxAudio.m_iResetFlag == 2 )
{
// Reset active, skip until finished
return;
}
std::map< int, CVAONSoundReceiver* >::iterator lit = m_mListeners.begin();
while( lit != m_mListeners.end() )
{
lit->second->voIncidenceDirections;
lit++;
}
IncrementWritePointer();
return;
}
void CVABinauralAirTrafficNoiseAudioRenderer::UpdateTrajectories()
{
// Neue Quellendaten bernehmen
for( std::map< int, CVABATNSource* >::iterator it = m_mSources.begin(); it != m_mSources.end(); ++it )
{
int iSourceID = it->first;
CVABATNSource* pSource = it->second;
CVASoundSourceState* pSourceCur = ( m_pCurSceneState ? m_pCurSceneState->GetSoundSourceState( iSourceID ) : nullptr );
CVASoundSourceState* pSourceNew = ( m_pNewSceneState ? m_pNewSceneState->GetSoundSourceState( iSourceID ) : nullptr );
const CVAMotionState* pMotionCur = ( pSourceCur ? pSourceCur->GetMotionState() : nullptr );
const CVAMotionState* pMotionNew = ( pSourceNew ? pSourceNew->GetMotionState() : nullptr );
if( pMotionNew && ( pMotionNew != pMotionCur ) )
{
VA_TRACE( "BinauralAirTrafficNoiseAudioRenderer", "Source " << iSourceID << " new motion state" );
pSource->pMotionModel->InputMotionKey( pMotionNew );
}
}
// Neue Hrerdaten bernehmen
for( std::map< int, CVABATNSoundReceiver* >::iterator it = m_mListeners.begin(); it != m_mListeners.end(); ++it )
{
int iListenerID = it->first;
CVABATNSoundReceiver* pListener = it->second;
CVAReceiverState* pListenerCur = ( m_pCurSceneState ? m_pCurSceneState->GetReceiverState( iListenerID ) : nullptr );
CVAReceiverState* pListenerNew = ( m_pNewSceneState ? m_pNewSceneState->GetReceiverState( iListenerID ) : nullptr );
const CVAMotionState* pMotionCur = ( pListenerCur ? pListenerCur->GetMotionState() : nullptr );
const CVAMotionState* pMotionNew = ( pListenerNew ? pListenerNew->GetMotionState() : nullptr );
if( pMotionNew && ( pMotionNew != pMotionCur ) )
{
VA_TRACE( "BinauralAirTrafficNoiseAudioRenderer", "Listener " << iListenerID << " new position " );// << *pMotionNew);
pListener->pMotionModel->InputMotionKey( pMotionNew );
}
}
}
void CVABinauralAirTrafficNoiseAudioRenderer::SampleTrajectoriesInternal( double dTime )
{
bool bEstimationPossible = true;
for( std::list< CVABATNSource* >::iterator it = ctxAudio.m_lSources.begin(); it != ctxAudio.m_lSources.end(); ++it )
{
CVABATNSource* pSource = *it;
pSource->pMotionModel->HandleMotionKeys();
bEstimationPossible &= pSource->pMotionModel->EstimatePosition( dTime, pSource->vPredPos );
bEstimationPossible &= pSource->pMotionModel->EstimateOrientation( dTime, pSource->vPredView, pSource->vPredUp );
pSource->bValidTrajectoryPresent = bEstimationPossible;
}
bEstimationPossible = true;
for( std::list< CVABATNSoundReceiver* >::iterator it = ctxAudio.m_lListener.begin(); it != ctxAudio.m_lListener.end(); ++it )
{
CVABATNSoundReceiver* pListener = *it;
pListener->pMotionModel->HandleMotionKeys();
bEstimationPossible &= pListener->pMotionModel->EstimatePosition( dTime, pListener->vPredPos );
bEstimationPossible &= pListener->pMotionModel->EstimateOrientation( dTime, pListener->vPredView, pListener->vPredUp );
pListener->bValidTrajectoryPresent = bEstimationPossible;
}
}
CVABATNSoundPath* CVABinauralAirTrafficNoiseAudioRenderer::CreateSoundPath( CVABATNSource* pSource, CVABATNSoundReceiver* pListener )
{
int iSourceID = pSource->pData->iID;
int iListenerID = pListener->pData->iID;
assert( !pSource->bDeleted && !pListener->bDeleted );
VA_VERBOSE( "BinauralAirTrafficNoiseAudioRenderer", "Creating sound path from source " << iSourceID << " -> listener " << iListenerID );
CVABATNSoundPath* pPath = dynamic_cast< CVABATNSoundPath* >( m_pSoundPathPool->RequestObject() );
pPath->pSoundSource = pSource;
pPath->pSoundReceiver = pListener;
pPath->bDelete = false;
CVASoundSourceState* pSourceNew = ( m_pNewSceneState ? m_pNewSceneState->GetSoundSourceState( iSourceID ) : nullptr );
if( pSourceNew != nullptr )
{
pPath->oDirSoundPath.oDirectivityStateNew.pData = ( IVADirectivity* ) pSourceNew->GetDirectivityData();
pPath->oRefSoundPath.oDirectivityStateNew.pData = ( IVADirectivity* ) pSourceNew->GetDirectivityData();
}
CVAReceiverState* pListenerNew = ( m_pNewSceneState ? m_pNewSceneState->GetReceiverState( iListenerID ) : nullptr );
if( pListenerNew != nullptr )
{
pPath->oDirSoundPath.oSoundReceiverDirectivityStateNew.pData = ( IVADirectivity* ) pListenerNew->GetDirectivity();
pPath->oRefSoundPath.oSoundReceiverDirectivityStateNew.pData = ( IVADirectivity* ) pListenerNew->GetDirectivity();
}
m_lSoundPaths.push_back( pPath );
m_pUpdateMessage->vNewPaths.push_back( pPath );
return pPath;
}
void CVABinauralAirTrafficNoiseAudioRenderer::DeleteSoundPath( CVABATNSoundPath* pPath )
{
VA_VERBOSE( "BinauralAirTrafficNoiseAudioRenderer", "Marking sound path from source " << pPath->pSoundSource->pData->iID << " -> listener " << pPath->pSoundReceiver->pData->iID << " for deletion" );
pPath->bDelete = true;
pPath->RemoveReference();
m_pUpdateMessage->vDelPaths.push_back( pPath );
}
CVABinauralAirTrafficNoiseAudioRenderer::CVABATNSoundReceiver* CVABinauralAirTrafficNoiseAudioRenderer::CreateSoundReceiver( int iID, const CVAReceiverState* pListenerState )
{
VA_VERBOSE( "BinauralAirTrafficNoiseAudioRenderer", "Creating listener with ID " << iID );
CVABATNSoundReceiver* pListener = dynamic_cast< CVABATNSoundReceiver* >( m_pListenerPool->RequestObject() );
pListener->pData = m_pCore->GetSceneManager()->GetListenerDesc( iID );
pListener->pData->AddReference();
// Move to prerequest of pool?
pListener->psfOutput = new ITASampleFrame( 2, m_pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize, true );
assert( pListener->pData );
pListener->bDeleted = false;
// Motion model
CVABasicMotionModel* pMotionInstance = dynamic_cast< CVABasicMotionModel* >( pListener->pMotionModel->GetInstance() );
pMotionInstance->SetName( std::string( "bfrend_mm_listener_" + pListener->pData->sName ) );
pMotionInstance->Reset();
m_mListeners.insert( std::pair< int, CVABinauralAirTrafficNoiseAudioRenderer::CVABATNSoundReceiver* >( iID, pListener ) );
m_pUpdateMessage->vNewListeners.push_back( pListener );
return pListener;
}
void CVABinauralAirTrafficNoiseAudioRenderer::DeleteListener( int iListenerID )
{
VA_VERBOSE( "BinauralAirTrafficNoiseAudioRenderer", "Marking listener with ID " << iListenerID << " for removal" );
std::map< int, CVABATNSoundReceiver* >::iterator it = m_mListeners.find( iListenerID );
CVABATNSoundReceiver* pListener = it->second;
m_mListeners.erase( it );
pListener->bDeleted = true;
pListener->pData->RemoveReference();
pListener->RemoveReference();
m_pUpdateMessage->vDelListeners.push_back( pListener );
return;
}
CVABinauralAirTrafficNoiseAudioRenderer::CVABATNSource* CVABinauralAirTrafficNoiseAudioRenderer::CreateSoundSource( int iID, const CVASoundSourceState* pSourceState )
{
VA_VERBOSE( "BinauralAirTrafficNoiseAudioRenderer", "Creating source with ID " << iID );
CVABATNSource* pSource = dynamic_cast< CVABATNSource* >( m_pSourcePool->RequestObject() );
pSource->pData = m_pCore->GetSceneManager()->GetSoundSourceDesc( iID );
pSource->pData->AddReference();
pSource->bDeleted = false;
CVABasicMotionModel* pMotionInstance = dynamic_cast< CVABasicMotionModel* >( pSource->pMotionModel->GetInstance() );
pMotionInstance->SetName( std::string( "bfrend_mm_source_" + pSource->pData->sName ) );
pMotionInstance->Reset();
m_mSources.insert( std::pair< int, CVABATNSource* >( iID, pSource ) );
m_pUpdateMessage->vNewSources.push_back( pSource );
return pSource;
}
void CVABinauralAirTrafficNoiseAudioRenderer::DeleteSource( int iSourceID )
{
VA_VERBOSE( "BinauralAirTrafficNoiseAudioRenderer", "Marking source with ID " << iSourceID << " for removal" );
std::map< int, CVABATNSource* >::iterator it = m_mSources.find( iSourceID );
CVABATNSource* pSource = it->second;
m_mSources.erase( it );
pSource->bDeleted = true;
pSource->pData->RemoveReference();
pSource->RemoveReference();
m_pUpdateMessage->vDelSources.push_back( pSource );
return;
}
void CVABinauralAirTrafficNoiseAudioRenderer::SyncInternalData()
{
CVABATNUpdateMessage* pUpdate;
while( ctxAudio.m_qpUpdateMessages.try_pop( pUpdate ) )
{
std::list< CVABATNSoundPath* >::const_iterator citp = pUpdate->vDelPaths.begin();
while( citp != pUpdate->vDelPaths.end() )
{
CVABATNSoundPath* pPath( *citp++ );
ctxAudio.m_lSoundPaths.remove( pPath );
pPath->RemoveReference();
}
citp = pUpdate->vNewPaths.begin();
while( citp != pUpdate->vNewPaths.end() )
{
CVABATNSoundPath* pPath( *citp++ );
pPath->AddReference();
ctxAudio.m_lSoundPaths.push_back( pPath );
}
std::list< CVABATNSource* >::const_iterator cits = pUpdate->vDelSources.begin();
while( cits != pUpdate->vDelSources.end() )
{
CVABATNSource* pSource( *cits++ );
ctxAudio.m_lSources.remove( pSource );
pSource->pData->RemoveReference();
pSource->RemoveReference();
}
cits = pUpdate->vNewSources.begin();
while( cits != pUpdate->vNewSources.end() )
{
CVABATNSource* pSource( *cits++ );
pSource->AddReference();
pSource->pData->AddReference();
ctxAudio.m_lSources.push_back( pSource );
}
std::list< CVABATNSoundReceiver* >::const_iterator citl = pUpdate->vDelListeners.begin();
while( citl != pUpdate->vDelListeners.end() )
{
CVABATNSoundReceiver* pListener( *citl++ );
ctxAudio.m_lListener.remove( pListener );
pListener->pData->RemoveReference();
pListener->RemoveReference();
}
citl = pUpdate->vNewListeners.begin();
while( citl != pUpdate->vNewListeners.end() )
{
CVABATNSoundReceiver* pListener( *citl++ );
pListener->AddReference();
pListener->pData->AddReference();
ctxAudio.m_lListener.push_back( pListener );
}
pUpdate->RemoveReference();
}
return;
}
void CVABinauralAirTrafficNoiseAudioRenderer::ResetInternalData()
{
std::list< CVABATNSoundPath* >::const_iterator citp = ctxAudio.m_lSoundPaths.begin();
while( citp != ctxAudio.m_lSoundPaths.end() )
{
CVABATNSoundPath* pPath( *citp++ );
pPath->RemoveReference();
}
ctxAudio.m_lSoundPaths.clear();
std::list< CVABATNSoundReceiver* >::const_iterator itl = ctxAudio.m_lListener.begin();
while( itl != ctxAudio.m_lListener.end() )
{
CVABATNSoundReceiver* pListener( *itl++ );
pListener->pData->RemoveReference();
pListener->RemoveReference();
}
ctxAudio.m_lListener.clear();
std::list< CVABATNSource* >::const_iterator cits = ctxAudio.m_lSources.begin();
while( cits != ctxAudio.m_lSources.end() )
{
CVABATNSource* pSource( *cits++ );
pSource->pData->RemoveReference();
pSource->RemoveReference();
}
ctxAudio.m_lSources.clear();
ctxAudio.m_iResetFlag = 2; // set ack
}
void CVABinauralAirTrafficNoiseAudioRenderer::UpdateSoundPaths()
{
const int iGlobalAuralisationMode = m_iCurGlobalAuralizationMode;
// Check for new data
std::list< CVABATNSoundPath* >::iterator it = m_lSoundPaths.begin();
while( it != m_lSoundPaths.end() )
{
CVABATNSoundPath* pPath( *it++ );
CVABATNSource* pSource = pPath->pSoundSource;
CVABATNSoundReceiver* pListener = pPath->pSoundReceiver;
int iSourceID = pSource->pData->iID;
int iListenerID = pListener->pData->iID;
CVASoundSourceState* pSourceCur = ( m_pCurSceneState ? m_pCurSceneState->GetSoundSourceState( iSourceID ) : nullptr );
CVASoundSourceState* pSourceNew = ( m_pNewSceneState ? m_pNewSceneState->GetSoundSourceState( iSourceID ) : nullptr );
CVAReceiverState* pListenerCur = ( m_pCurSceneState ? m_pCurSceneState->GetReceiverState( iListenerID ) : nullptr );
CVAReceiverState* pListenerNew = ( m_pNewSceneState ? m_pNewSceneState->GetReceiverState( iListenerID ) : nullptr );
if( pSourceNew == nullptr )
{
pPath->oDirSoundPath.oDirectivityStateNew.pData = nullptr;
pPath->oRefSoundPath.oDirectivityStateNew.pData = nullptr;
}
else
{
pPath->oDirSoundPath.oDirectivityStateNew.pData = ( IVADirectivity* ) pSourceNew->GetDirectivityData();
pPath->oRefSoundPath.oDirectivityStateNew.pData = ( IVADirectivity* ) pSourceNew->GetDirectivityData();
}
if( pListenerNew == nullptr )
{
pPath->oDirSoundPath.oSoundReceiverDirectivityStateNew.pData = nullptr;
pPath->oRefSoundPath.oSoundReceiverDirectivityStateNew.pData = nullptr;
}
else
{
pPath->oDirSoundPath.oSoundReceiverDirectivityStateNew.pData = ( IVADirectivity* ) pListenerNew->GetDirectivity();
pPath->oRefSoundPath.oSoundReceiverDirectivityStateNew.pData = ( IVADirectivity* ) pListenerNew->GetDirectivity();
}
}
return;
}
void CVABinauralAirTrafficNoiseAudioRenderer::UpdateGlobalAuralizationMode( int iGlobalAuralizationMode )
{
if( m_iCurGlobalAuralizationMode == iGlobalAuralizationMode )
return;
m_iCurGlobalAuralizationMode = iGlobalAuralizationMode;
return;
}
// Klasse ATNSoundPath
CVABATNSoundPath::CVABATNSoundPath( double dSamplerate, int iBlocklength, int iHRIRFilterLength, int iDirFilterLength )
: dGroundReflectionPlanePosition( 0 )
{
oDirSoundPath.pThirdOctaveFilterBank = CITAThirdOctaveFilterbank::Create( dSamplerate, iBlocklength,
CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE );
//CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
oRefSoundPath.pThirdOctaveFilterBank = CITAThirdOctaveFilterbank::Create( dSamplerate, iBlocklength,
CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE );
//CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
oDirSoundPath.pThirdOctaveFilterBank->SetIdentity();
oRefSoundPath.pThirdOctaveFilterBank->SetIdentity();
float fReserverdMaxDelaySamples = ( float ) ( 3 * dSamplerate ); // 3 Sekunden ~ 1km Entfernung
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::CUBIC_SPLINE_INTERPOLATION;
oDirSoundPath.pVariableDelayLine = new CITAVariableDelayLine( dSamplerate, iBlocklength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm );
oRefSoundPath.pVariableDelayLine = new CITAVariableDelayLine( dSamplerate, iBlocklength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm );
oDirSoundPath.pFIRConvolverChL = new ITAUPConvolution( iBlocklength, iHRIRFilterLength );
oRefSoundPath.pFIRConvolverChL = new ITAUPConvolution( iBlocklength, iHRIRFilterLength );
oDirSoundPath.pFIRConvolverChR = new ITAUPConvolution( iBlocklength, iHRIRFilterLength );
oRefSoundPath.pFIRConvolverChR = new ITAUPConvolution( iBlocklength, iHRIRFilterLength );
oDirSoundPath.pFIRConvolverChL->SetFilterExchangeMode( ITAUPConvolution::CROSSFADE_COSINE_SQUARE );
oRefSoundPath.pFIRConvolverChL->SetFilterExchangeMode( ITAUPConvolution::CROSSFADE_COSINE_SQUARE );
oDirSoundPath.pFIRConvolverChR->SetFilterExchangeMode( ITAUPConvolution::CROSSFADE_COSINE_SQUARE );
oRefSoundPath.pFIRConvolverChR->SetFilterExchangeMode( ITAUPConvolution::CROSSFADE_COSINE_SQUARE );
oDirSoundPath.pFIRConvolverChL->SetFilterCrossfadeLength( ( std::min )( iBlocklength, 32 ) );
oRefSoundPath.pFIRConvolverChL->SetFilterCrossfadeLength( ( std::min )( iBlocklength, 32 ) );
oDirSoundPath.pFIRConvolverChR->SetFilterCrossfadeLength( ( std::min )( iBlocklength, 32 ) );
oRefSoundPath.pFIRConvolverChR->SetFilterCrossfadeLength( ( std::min )( iBlocklength, 32 ) );
oDirSoundPath.pFIRConvolverChL->SetGain( 0.0f, true );
oRefSoundPath.pFIRConvolverChL->SetGain( 0.0f, true );
oDirSoundPath.pFIRConvolverChR->SetGain( 0.0f, true );
oRefSoundPath.pFIRConvolverChR->SetGain( 0.0f, true );
ITAUPFilter* pDHRIRFilterChL = oDirSoundPath.pFIRConvolverChL->RequestFilter();
ITAUPFilter* pRHRIRFilterChL = oRefSoundPath.pFIRConvolverChL->RequestFilter();
ITAUPFilter* pDHRIRFilterChR = oDirSoundPath.pFIRConvolverChR->RequestFilter();
ITAUPFilter* pRHRIRFilterChR = oRefSoundPath.pFIRConvolverChR->RequestFilter();
pDHRIRFilterChL->identity();
pRHRIRFilterChL->identity();
pDHRIRFilterChR->identity();
pRHRIRFilterChR->identity();
oDirSoundPath.pFIRConvolverChL->ExchangeFilter( pDHRIRFilterChL );
oRefSoundPath.pFIRConvolverChL->ExchangeFilter( pRHRIRFilterChL );
oDirSoundPath.pFIRConvolverChR->ExchangeFilter( pDHRIRFilterChR );
oRefSoundPath.pFIRConvolverChR->ExchangeFilter( pRHRIRFilterChR );
// Auto-release filter after it is not used anymore
oDirSoundPath.pFIRConvolverChL->ReleaseFilter( pDHRIRFilterChL );
oRefSoundPath.pFIRConvolverChL->ReleaseFilter( pRHRIRFilterChL );
oDirSoundPath.pFIRConvolverChR->ReleaseFilter( pDHRIRFilterChR );
oRefSoundPath.pFIRConvolverChR->ReleaseFilter( pRHRIRFilterChR );
m_sfHRIRTemp.init( 2, iHRIRFilterLength, false );
}
CVABATNSoundPath::~CVABATNSoundPath()
{
delete oDirSoundPath.pThirdOctaveFilterBank;
delete oRefSoundPath.pThirdOctaveFilterBank;
delete oDirSoundPath.pVariableDelayLine;
delete oRefSoundPath.pVariableDelayLine;
delete oDirSoundPath.pFIRConvolverChL;
delete oRefSoundPath.pFIRConvolverChL;
delete oDirSoundPath.pFIRConvolverChR;
delete oRefSoundPath.pFIRConvolverChR;
}
void CVABATNSoundPath::UpdateMetrics()
{
if( pSoundSource->vPredPos != pSoundReceiver->vPredPos )
{