Applied clustering to the outdoor noise renderer re-using the clustering...

Applied clustering to the outdoor noise renderer re-using the clustering classes .. with a copy from the base class as an example how to extend the clustering by an own implementation of the wave front class
parent e887ff56
......@@ -26,9 +26,9 @@ CVABinauralClustering::~CVABinauralClustering()
{
}
void CVABinauralClustering::AddWaveFront( int sourceID, CVABinauralWaveFrontBase* source )
void CVABinauralClustering::AddWaveFront( int sourceID, IVABinauralWaveFront* source )
{
m_mUnassignedWaveFronts.insert( std::pair< int, CVABinauralWaveFrontBase* >( sourceID, source ) );
m_mUnassignedWaveFronts.insert( std::pair< int, IVABinauralWaveFront* >( sourceID, source ) );
}
void CVABinauralClustering::RemoveWaveFront( int sourceID )
......@@ -120,8 +120,8 @@ void CVABinauralClustering::Update()
for( it = m_iDelWaveFrontIDs.begin(); it != m_iDelWaveFrontIDs.end(); ++it )
{
// remove if in unassigned sources
std::map< int, CVABinauralWaveFrontBase* >::iterator delIt = m_mUnassignedWaveFronts.find( *it );
CVABinauralWaveFrontBase* source = delIt->second;
std::map< int, IVABinauralWaveFront* >::iterator delIt = m_mUnassignedWaveFronts.find( *it );
IVABinauralWaveFront* source = delIt->second;
state->removeSource( *it );
......@@ -135,13 +135,14 @@ void CVABinauralClustering::Update()
}
// add unassigned sources
std::map< int, CVABinauralWaveFrontBase* >::iterator sourceIt;
std::map< int, IVABinauralWaveFront* >::iterator sourceIt;
for( sourceIt = m_mUnassignedWaveFronts.begin(); sourceIt != m_mUnassignedWaveFronts.end(); ++sourceIt )
{
if( sourceIt->second->hasValidTrajectory ){
if( sourceIt->second->GetValidTrajectory() )
{
state->addSource( sourceIt->first, sourceIt->second, m_dDistanceThreshold, 0 );
};
}
}
// TODO: refinement
......
......@@ -24,7 +24,6 @@
* individual wave fronts are expected to individually adjust the time-of-arrival from
* the difference to the clustering direction kernel (this instance).
*
* @todo jst: rename source files
*/
class CVABinauralClustering : public CVAPoolObject
{
......@@ -41,7 +40,7 @@ public:
ITASampleFrame* GetOutput();
void Update();
void AddWaveFront( int sourceID, CVABinauralWaveFrontBase* source );
void AddWaveFront( int sourceID, IVABinauralWaveFront* source );
void RemoveWaveFront( int sourceID );
std::map< int, ITAUPConvolution* > mFIRConvolversL;
......@@ -62,8 +61,8 @@ private:
std::shared_ptr< CVABinauralClusteringState > m_pPrevState;
std::shared_ptr< CVABinauralClusteringState > m_pNextState;
std::map< int, CVABinauralWaveFrontBase* > m_mUnassignedWaveFronts;
std::map< int, CVABinauralWaveFrontBase* > m_mAssignedWaveFronts;
std::map< int, IVABinauralWaveFront* > m_mUnassignedWaveFronts;
std::map< int, IVABinauralWaveFront* > m_mAssignedWaveFronts;
//std::pair< int, CVABinauralClusteringDirection* > AssignToClusteringDirection( CVABinauralClusteringState* pClusteringState, CVABinauralWaveFrontBase* pWaveFront, double dThreshold, int iNumFreeClusters );
......
......@@ -31,10 +31,10 @@ CVABinauralClusteringDirection::CVABinauralClusteringDirection()
CVABinauralClusteringDirection::~CVABinauralClusteringDirection()
{}
void CVABinauralClusteringDirection::Init( int iID, CVABinauralWaveFrontBase* pWaveFront, CVABinauralClusteringDirectionReceiver* pReceiver, ITAUPConvolution* pFIRConvolverChL, ITAUPConvolution* pFIRConvolverChR )
void CVABinauralClusteringDirection::Init( int iID, IVABinauralWaveFront* pWaveFront, CVABinauralClusteringDirectionReceiver* pReceiver, ITAUPConvolution* pFIRConvolverChL, ITAUPConvolution* pFIRConvolverChR )
{
m_pClusteringDirectionReceiver = pReceiver;
v3ClusteringDirectionPos = pWaveFront->v3PredictedPos - pReceiver->v3PredictedPosition;
v3ClusteringDirectionPos = pWaveFront->GetPosition() - pReceiver->v3PredictedPosition;
v3ClusteringDirectionPos.Norm();
m_pFIRConvolverChL = pFIRConvolverChL;
......@@ -53,7 +53,7 @@ void CVABinauralClusteringDirection::Init( int iID, CVABinauralWaveFrontBase* pW
dMaxError = GetDistError( pWaveFront );
m_mWaveFronts.insert( std::pair< int, CVABinauralWaveFrontBase* >( iID, pWaveFront ) );
m_mWaveFronts.insert( std::pair< int, IVABinauralWaveFront* >( iID, pWaveFront ) );
// --
pWaveFront->AddReference();
......@@ -79,7 +79,7 @@ void CVABinauralClusteringDirection::Init( CVABinauralClusteringDirection* pClus
ITASampleFrame* CVABinauralClusteringDirection::GetOutput()
{
// @todo jst: this methods seems to be messy, carful update is required
// @todo jst: this methods seems to be messy, careful update is required
// Reset output buffer for this direction
m_psfOutput->zero();
......@@ -96,10 +96,10 @@ ITASampleFrame* CVABinauralClusteringDirection::GetOutput()
double toaHRTFChR = m_pClusteringDirectionReceiver->pTimeOfArrivalEstimator->getTOA( VAVec3( 1, 0, 0 ), v3ClusteringDirectionPos );
// Process binaural sound sources connected to this clustering direction
std::map< int, CVABinauralWaveFrontBase* >::const_iterator it;
std::map< int, IVABinauralWaveFront* >::const_iterator it;
for( it = m_mWaveFronts.begin(); it != m_mWaveFronts.end(); ++it )
{
CVABinauralWaveFrontBase* pWaveFront( it->second );
IVABinauralWaveFront* pWaveFront( it->second );
pWaveFront->SetClusteringPose( m_pClusteringDirectionReceiver->v3PredictedPosition, m_pClusteringDirectionReceiver->predView, m_pClusteringDirectionReceiver->predUp );
pWaveFront->GetOutput( &( m_sbTempChL ), &( m_sbTempChR ) );
......@@ -152,9 +152,9 @@ ITASampleFrame* CVABinauralClusteringDirection::GetOutput()
return m_psfOutput;
}
double CVABinauralClusteringDirection::GetDistError( CVABinauralWaveFrontBase* source )
double CVABinauralClusteringDirection::GetDistError( IVABinauralWaveFront* source )
{
VAVec3 sourceToListenerPos = source->v3PredictedPos - m_pClusteringDirectionReceiver->v3PredictedPosition;
VAVec3 sourceToListenerPos = source->GetPosition() - m_pClusteringDirectionReceiver->v3PredictedPosition;
VAVec3 dist;
sourceToListenerPos.Norm();
......@@ -164,9 +164,9 @@ double CVABinauralClusteringDirection::GetDistError( CVABinauralWaveFrontBase* s
return dist.Dot( dist );
}
void CVABinauralClusteringDirection::AddWaveFront( int sourceID, CVABinauralWaveFrontBase* source )
void CVABinauralClusteringDirection::AddWaveFront( int sourceID, IVABinauralWaveFront* source )
{
VAVec3 sourceToListenerPos = source->v3PredictedPos - v3ReceiverPos;
VAVec3 sourceToListenerPos = source->GetPosition() - v3ReceiverPos;
double err = GetDistError( source );
sourceToListenerPos.Norm();
......@@ -177,7 +177,7 @@ void CVABinauralClusteringDirection::AddWaveFront( int sourceID, CVABinauralWave
dMaxError = std::max( err, dMaxError );
m_mWaveFronts.insert( std::pair<int, CVABinauralWaveFrontBase*>( sourceID, source ) );
m_mWaveFronts.insert( std::pair<int, IVABinauralWaveFront*>( sourceID, source ) );
// --
source->AddReference();
......@@ -185,9 +185,9 @@ void CVABinauralClusteringDirection::AddWaveFront( int sourceID, CVABinauralWave
++iNumWaveFronts;
}
void CVABinauralClusteringDirection::AddWaveFront( int sourceID, CVABinauralWaveFrontBase* source, double error )
void CVABinauralClusteringDirection::AddWaveFront( int sourceID, IVABinauralWaveFront* source, double error )
{
VAVec3 sourceToListenerPos = source->v3PredictedPos - v3ReceiverPos;
VAVec3 sourceToListenerPos = source->GetPosition() - v3ReceiverPos;
double err = GetDistError( source );
sourceToListenerPos.Norm();
......@@ -199,7 +199,7 @@ void CVABinauralClusteringDirection::AddWaveFront( int sourceID, CVABinauralWave
dMaxError = std::max( err, dMaxError );
m_mWaveFronts.insert( std::pair<int, CVABinauralWaveFrontBase*>( sourceID, source ) );
m_mWaveFronts.insert( std::pair<int, IVABinauralWaveFront*>( sourceID, source ) );
// --
source->AddReference();
......@@ -209,14 +209,14 @@ void CVABinauralClusteringDirection::AddWaveFront( int sourceID, CVABinauralWave
void CVABinauralClusteringDirection::RemoveWaveFront( int sourceID )
{
std::map<int, CVABinauralWaveFrontBase*>::const_iterator it = m_mWaveFronts.find( sourceID );
CVABinauralWaveFrontBase* source = it->second;
std::map< int, IVABinauralWaveFront* >::const_iterator it = m_mWaveFronts.find( sourceID );
IVABinauralWaveFront* source = it->second;
m_mWaveFronts.erase( it );
source->RemoveReference();
v3ClusteringDirectionPos = ( v3ClusteringDirectionPos * iNumWaveFronts - source->v3PredictedPos ) / ( iNumWaveFronts - 1 );
v3ClusteringDirectionPos = ( v3ClusteringDirectionPos * iNumWaveFronts - source->GetPosition() ) / ( iNumWaveFronts - 1 );
//TODO: MaxError
--iNumWaveFronts;
......@@ -224,8 +224,8 @@ void CVABinauralClusteringDirection::RemoveWaveFront( int sourceID )
void CVABinauralClusteringDirection::PreRelease()
{
CVABinauralWaveFrontBase* source;
std::map< int, CVABinauralWaveFrontBase* >::const_iterator it;
IVABinauralWaveFront* source;
std::map< int, IVABinauralWaveFront* >::const_iterator it;
// clear all references from this cluster
for( it = m_mWaveFronts.begin(); it != m_mWaveFronts.end(); )
......
......@@ -25,15 +25,15 @@ public:
CVABinauralClusteringDirection();
~CVABinauralClusteringDirection();
void Init( int iID, CVABinauralWaveFrontBase* pWaveFront, CVABinauralClusteringDirectionReceiver* pClusteringDirectionReceiver, ITAUPConvolution* pFIRRight, ITAUPConvolution* pFIRLeft );
void Init( int iID, IVABinauralWaveFront* pWaveFront, CVABinauralClusteringDirectionReceiver* pClusteringDirectionReceiver, ITAUPConvolution* pFIRRight, ITAUPConvolution* pFIRLeft );
void Init( CVABinauralClusteringDirection* pClusteringDirection );
ITASampleFrame* GetOutput();
double GetDistError( CVABinauralWaveFrontBase* pWaveFront );
double GetDistError( IVABinauralWaveFront* pWaveFront );
void AddWaveFront( int iID, CVABinauralWaveFrontBase* pWaveFront );
void AddWaveFront( int iID, CVABinauralWaveFrontBase* pWaveFront, double dError ); // @todo jst: appears to be unused, confirm
void AddWaveFront( int iID, IVABinauralWaveFront* pWaveFront );
void AddWaveFront( int iID, IVABinauralWaveFront* pWaveFront, double dError ); // @todo jst: appears to be unused, confirm
void RemoveWaveFront( int iID );
void Reset();
......@@ -56,7 +56,7 @@ private:
VAVec3 v3ClusteringDirectionPos;
VAVec3 v3ClusteringDirectionToListenerPos;
std::map< int, CVABinauralWaveFrontBase* > m_mWaveFronts;
std::map< int, IVABinauralWaveFront* > m_mWaveFronts;
int m_iLastHRIRIndex;
......
......@@ -32,7 +32,7 @@ CVABinauralClustering* CVABinauralClusteringEngine::GetClustering( const int iRe
return it->second;
}
void CVABinauralClusteringEngine::AddWaveFront( int sourceID, CVABinauralWaveFrontBase* source )
void CVABinauralClusteringEngine::AddWaveFront( int sourceID, IVABinauralWaveFront* source )
{
std::map< int, CVABinauralClustering* >::iterator it;
for( it = m_mClusteringInstances.begin(); it != m_mClusteringInstances.end(); ++it )
......@@ -40,7 +40,7 @@ void CVABinauralClusteringEngine::AddWaveFront( int sourceID, CVABinauralWaveFro
it->second->AddWaveFront( sourceID, source );
}
m_mCurrentWaveFronts.insert( std::pair< int, CVABinauralWaveFrontBase* >( sourceID, source ) );
m_mCurrentWaveFronts.insert( std::pair< int, IVABinauralWaveFront* >( sourceID, source ) );
}
void CVABinauralClusteringEngine::RemoveWaveFront( int iID )
......
......@@ -12,7 +12,6 @@
//! Single managing instance that handles the entire clustering for all receivers
/**
* @todo rename source files
*/
class CVABinauralClusteringEngine
{
......@@ -33,7 +32,7 @@ public:
CVABinauralClustering* GetClustering( const int iReceiverID );
//! Adds a new wave front
void AddWaveFront( int iWaveFrontID, CVABinauralWaveFrontBase* pWaveFront );
void AddWaveFront( int iWaveFrontID, IVABinauralWaveFront* pWaveFront );
//! Removes a wave front
void RemoveWaveFront( int iWaveFrontID );
......@@ -51,8 +50,8 @@ private:
//IVAObjectPool* m_pWaveFrontPool;
IVAObjectPool* m_pClusteringPool;
std::map< int, CVABinauralWaveFrontBase* > m_mNewWaveFronts;
std::map< int, CVABinauralWaveFrontBase* > m_mCurrentWaveFronts;
//std::map< int, CVABinauralWaveFrontBase* > m_mNewWaveFronts;
std::map< int, IVABinauralWaveFront* > m_mCurrentWaveFronts;
std::map< int, CVABinauralClusteringDirectionReceiver* > m_mReceivers;
......
......@@ -49,7 +49,7 @@ CVABinauralClusteringState::~CVABinauralClusteringState()
}
void
CVABinauralClusteringState::addSource(int sourceID, CVABinauralWaveFrontBase* source, double threshold, int numBlockedClusters)
CVABinauralClusteringState::addSource(int sourceID, IVABinauralWaveFront* source, double threshold, int numBlockedClusters)
{
int numFreeClusters = numClusters - numBlockedClusters - clusters.size();
double err = 0, minerr = std::numeric_limits<double>::infinity();
......@@ -102,7 +102,7 @@ CVABinauralClusteringState::removeSource(int sourceID)
}
std::pair< int, CVABinauralClusteringDirection*>
CVABinauralClusteringState::createCluster(int sourceID, CVABinauralWaveFrontBase* source)
CVABinauralClusteringState::createCluster( int sourceID, IVABinauralWaveFront* source )
{
int clusterID = freeClusterIDs.front();
CVABinauralClusteringDirection* cluster = dynamic_cast< CVABinauralClusteringDirection* >(ClusteringDirectionPool->RequestObject()); // Reference = 1
......
......@@ -34,11 +34,11 @@ public:
CVABinauralClusteringState( const CVABinauralClusteringState& state );
~CVABinauralClusteringState();
void addSource( int sourceID, CVABinauralWaveFrontBase* source, double threshold, int numBlockedClusters );
void addSource( int sourceID, IVABinauralWaveFront* source, double threshold, int numBlockedClusters );
void removeSource( int sourceID );
std::pair< int, CVABinauralClusteringDirection* > createCluster( int sourceID, CVABinauralWaveFrontBase* source );
std::pair< int, CVABinauralClusteringDirection* > createCluster( int sourceID, IVABinauralWaveFront* source );
std::pair< int, CVABinauralClusteringDirection* > createCluster( int clusterID, CVABinauralClusteringDirection* cluster );
......
......@@ -26,7 +26,7 @@
#include "Receiver/VABinauralClusteringDirectionReceiverPoolFactory.h"
#include "WaveFront/VABinauralWaveFrontPoolFactory.h"
VABinauralClusteringRenderer::VABinauralClusteringRenderer( const CVAAudioRendererInitParams& oParams )
CVABinauralClusteringRenderer::CVABinauralClusteringRenderer( const CVAAudioRendererInitParams& oParams )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, m_oParams( oParams )
, m_pCore( oParams.pCore )
......@@ -40,17 +40,17 @@ VABinauralClusteringRenderer::VABinauralClusteringRenderer( const CVAAudioRender
IVAPoolObjectFactory* listenerFactory = new CVABinauralClusteringDirectionReceiverPoolFactory( m_pCore, m_oDefaultReceiverConf );
_listenerPool = IVAObjectPool::Create( 16, 2, listenerFactory, true );
IVAPoolObjectFactory* sourceFactory = new VABinauralSoundSourcePoolFactory( m_oDefaultWaveFrontConf );
IVAPoolObjectFactory* sourceFactory = new CVABinauralWaveFrontPoolFactory( m_oDefaultWaveFrontConf );
_sourcePool = IVAObjectPool::Create( 16, 2, sourceFactory, true );
m_iCurGlobalAuralizationMode = IVAInterface::VA_AURAMODE_DEFAULT;
}
VABinauralClusteringRenderer::~VABinauralClusteringRenderer()
CVABinauralClusteringRenderer::~CVABinauralClusteringRenderer()
{
}
void VABinauralClusteringRenderer::Init( const CVAStruct& oArgs )
void CVABinauralClusteringRenderer::Init( const CVAStruct& oArgs )
{
CVAConfigInterpreter conf( oArgs );
......@@ -116,17 +116,17 @@ void VABinauralClusteringRenderer::Init( const CVAStruct& oArgs )
m_pClusterEngine = new CVABinauralClusteringEngine();
}
void VABinauralClusteringRenderer::Reset()
void CVABinauralClusteringRenderer::Reset()
{
VA_ERROR( "BinauralClusteringRenderer", "Reset hast not yet been implemented" );
}
ITADatasource* VABinauralClusteringRenderer::GetOutputDatasource()
ITADatasource* CVABinauralClusteringRenderer::GetOutputDatasource()
{
return this;
}
void VABinauralClusteringRenderer::UpdateGlobalAuralizationMode( int iGlobalAuralizationMode )
void CVABinauralClusteringRenderer::UpdateGlobalAuralizationMode( int iGlobalAuralizationMode )
{
if( m_iCurGlobalAuralizationMode == iGlobalAuralizationMode )
return;
......@@ -137,7 +137,7 @@ void VABinauralClusteringRenderer::UpdateGlobalAuralizationMode( int iGlobalAura
}
void
VABinauralClusteringRenderer::ProcessStream( const ITAStreamInfo* streamInfo )
CVABinauralClusteringRenderer::ProcessStream( const ITAStreamInfo* streamInfo )
{
#ifdef BINAURAL_CLUSTERING_RENDERER_WITH_BENCHMARKING
......@@ -197,7 +197,7 @@ VABinauralClusteringRenderer::ProcessStream( const ITAStreamInfo* streamInfo )
return;
}
void VABinauralClusteringRenderer::UpdateScene( CVASceneState* pNewSceneState )
void CVABinauralClusteringRenderer::UpdateScene( CVASceneState* pNewSceneState )
{
assert( pNewSceneState );
......@@ -257,7 +257,7 @@ void VABinauralClusteringRenderer::UpdateScene( CVASceneState* pNewSceneState )
}
void VABinauralClusteringRenderer::UpdateSoundSources( CVASceneStateDiff* diff )
void CVABinauralClusteringRenderer::UpdateSoundSources( CVASceneStateDiff* diff )
{
typedef std::vector< int >::const_iterator icit_t;
......@@ -315,7 +315,7 @@ void VABinauralClusteringRenderer::UpdateSoundSources( CVASceneStateDiff* diff )
}
}
void VABinauralClusteringRenderer::UpdateSoundReceivers( CVASceneStateDiff* diff )
void CVABinauralClusteringRenderer::UpdateSoundReceivers( CVASceneStateDiff* diff )
{
typedef std::vector< int >::const_iterator icit_t;
......@@ -371,7 +371,7 @@ void VABinauralClusteringRenderer::UpdateSoundReceivers( CVASceneStateDiff* diff
}
}
void VABinauralClusteringRenderer::CreateSoundSource( const int sourceID, const CVASoundSourceState* sourceState )
void CVABinauralClusteringRenderer::CreateSoundSource( const int sourceID, const CVASoundSourceState* sourceState )
{
CVABinauralWaveFrontBase* source = dynamic_cast< CVABinauralWaveFrontBase* >( _sourcePool->RequestObject() ); // Reference = 1
......@@ -393,7 +393,7 @@ void VABinauralClusteringRenderer::CreateSoundSource( const int sourceID, const
m_pClusterEngine->AddWaveFront( sourceID, source );
}
void VABinauralClusteringRenderer::DeleteSoundSource( int sourceID )
void CVABinauralClusteringRenderer::DeleteSoundSource( int sourceID )
{
// remove local source reference
std::map< int, CVABinauralWaveFrontBase* >::iterator it = m_mWaveFronts.find( sourceID );
......@@ -405,7 +405,7 @@ void VABinauralClusteringRenderer::DeleteSoundSource( int sourceID )
source->RemoveReference();
}
void VABinauralClusteringRenderer::CreateSoundReceiver( int listenerID, const CVAReceiverState* recevierState )
void CVABinauralClusteringRenderer::CreateSoundReceiver( int listenerID, const CVAReceiverState* recevierState )
{
CVABinauralClusteringDirectionReceiver* listener = dynamic_cast< CVABinauralClusteringDirectionReceiver* >( _listenerPool->RequestObject() ); // Reference = 1
......@@ -429,7 +429,7 @@ void VABinauralClusteringRenderer::CreateSoundReceiver( int listenerID, const CV
m_pClusterEngine->AddReceiver( listenerID, listener, config );
}
void VABinauralClusteringRenderer::DeleteSoundReceiver( int listenerID )
void CVABinauralClusteringRenderer::DeleteSoundReceiver( int listenerID )
{
// remove local listener reference
std::map< int, CVABinauralClusteringDirectionReceiver* >::iterator it = m_mBinauralReceivers.find( listenerID );
......@@ -445,7 +445,7 @@ void VABinauralClusteringRenderer::DeleteSoundReceiver( int listenerID )
}
void VABinauralClusteringRenderer::UpdateMotionStates()
void CVABinauralClusteringRenderer::UpdateMotionStates()
{
// Neue Quellendaten bernehmen
for( std::map< int, CVABinauralWaveFrontBase* >::iterator it = m_mWaveFronts.begin(); it != m_mWaveFronts.end(); ++it )
......@@ -467,7 +467,7 @@ void VABinauralClusteringRenderer::UpdateMotionStates()
}
}
void VABinauralClusteringRenderer::UpdateTrajectories( double time )
void CVABinauralClusteringRenderer::UpdateTrajectories( double time )
{
for( auto const& sourceIt : m_mWaveFronts )
{
......
......@@ -18,11 +18,11 @@
* @note To use the clustering engine for another render implementation, derive BinauralWaveFrontBase and ovverride the Update() and Process() methods.
*
*/
class VABinauralClusteringRenderer : public IVAAudioRenderer, public ITADatasourceRealization
class CVABinauralClusteringRenderer : public IVAAudioRenderer, public ITADatasourceRealization
{
public:
VABinauralClusteringRenderer( const CVAAudioRendererInitParams& );
~VABinauralClusteringRenderer();
CVABinauralClusteringRenderer( const CVAAudioRendererInitParams& );
~CVABinauralClusteringRenderer();
inline void LoadScene( const std::string& ) {};
......
......@@ -2,6 +2,10 @@
#include "../VARelationMetrics.h"
#include "../VAConfig.h"
#include "../../../../Motion/VAMotionModelBase.h"
#include "../../../../Motion/VASharedMotionModel.h"
#include "../../../../Scene/VAScene.h"
#include <ITAVariableDelayLine.h>
#include <ITASampleBuffer.h>
......
......@@ -5,24 +5,43 @@
#include <VA.h>
#include <VAPoolObject.h>
#include "../../../../Motion/VAMotionModelBase.h"
#include "../../../../Motion/VASharedMotionModel.h"
#include "../../../../Scene/VAScene.h"
class ITASampleBuffer;
// Forwards
class CVASoundSourceState;
class CVASoundSourceDesc;
class CVASharedMotionModel;
class CITAVariableDelayLine;
class ITASampleBuffer;
//! Abstract interface class for binaural wave fronts
class IVABinauralWaveFront
{
public:
inline IVABinauralWaveFront() {};
virtual inline ~IVABinauralWaveFront() {};
//! Represents a wave front emitted from a sound source.
virtual void GetOutput( ITASampleBuffer* pfLeftChannel, ITASampleBuffer* pfRightChannel ) = 0;
virtual void SetClusteringPose( const VAVec3& v3Pos, const VAVec3& v3View, const VAVec3& v3Up ) = 0;
//! Returns true, if the wave front has a valid position (in 3D space, can happen that a newly created wave front has not been placed yet)
virtual bool GetValidTrajectory() const = 0;
virtual VAVec3 GetPosition() = 0;
//! For object pooling
virtual inline int AddReference() { return -1; };
virtual inline int RemoveReference() { return -1; };
};
//! Represents a wave front emitted from a sound source for a free-field clustering approach
/**
* Base class for instances subject to wave front clustering / direction clustering by the clustering engine.
* Derive and override the implementation of GetOutput() if you want to use it in another rendering module.
* Create class derived from abstract interface if you want to use it in another rendering module.
*
* @sa BinauralClusteringDirection
*
* @todo jst: rename header and source file
*
*/
class CVABinauralWaveFrontBase : public CVAPoolObject
class CVABinauralWaveFrontBase : public IVABinauralWaveFront, public CVAPoolObject
{
public:
struct Config
......@@ -42,7 +61,7 @@ public:
bool hasValidTrajectory;
const Config oConf;
CVASoundSourceState* pState; // @todo jst: move to dedicated class derived from this
CVASoundSourceState* pState;
CVASoundSourceDesc* pData;
CVASharedMotionModel* pMotionModel;
......@@ -60,9 +79,28 @@ public:
void PreRequest();
void PreRelease();
virtual void GetOutput( ITASampleBuffer* pfLeftChannel, ITASampleBuffer* pfRightChannel );
void GetOutput( ITASampleBuffer* pfLeftChannel, ITASampleBuffer* pfRightChannel );
void SetClusteringPose( const VAVec3& v3Pos, const VAVec3& v3View, const VAVec3& v3Up );
virtual bool GetValidTrajectory() const
{
return hasValidTrajectory;
};
inline VAVec3 GetPosition()
{
return v3PredictedPos;
};
virtual inline int AddReference()
{
return CVAPoolObject::AddReference();
};
virtual inline int RemoveReference()
{
return CVAPoolObject::RemoveReference();
};
private:
double m_dCreationTimeStamp;
......
#include "VABinauralWaveFrontPoolFactory.h"
VABinauralSoundSourcePoolFactory::VABinauralSoundSourcePoolFactory( CVABinauralWaveFrontBase::Config oConf ) :
CVABinauralWaveFrontPoolFactory::CVABinauralWaveFrontPoolFactory( CVABinauralWaveFrontBase::Config oConf ) :
m_oConf( oConf )
{
}
VABinauralSoundSourcePoolFactory::~VABinauralSoundSourcePoolFactory()
CVABinauralWaveFrontPoolFactory::~CVABinauralWaveFrontPoolFactory()
{
}
CVAPoolObject* VABinauralSoundSourcePoolFactory::CreatePoolObject()
CVAPoolObject* CVABinauralWaveFrontPoolFactory::CreatePoolObject()
{
return new CVABinauralWaveFrontBase( m_oConf );
}
......@@ -4,12 +4,12 @@
// Utils
#include "VABinauralWaveFront.h"
class VABinauralSoundSourcePoolFactory : public IVAPoolObjectFactory
class CVABinauralWaveFrontPoolFactory : public IVAPoolObjectFactory
{
public:
VABinauralSoundSourcePoolFactory( CVABinauralWaveFrontBase::Config oConf );
~VABinauralSoundSourcePoolFactory();
CVAPoolObject* VABinauralSoundSourcePoolFactory::CreatePoolObject();
CVABinauralWaveFrontPoolFactory( CVABinauralWaveFrontBase::Config oConf );
~CVABinauralWaveFrontPoolFactory();
CVAPoolObject* CVABinauralWaveFrontPoolFactory::CreatePoolObject();
private:
const CVABinauralWaveFrontBase::Config m_oConf;
......
......@@ -16,75 +16,83 @@
#if VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE
// VA includes
// VA Includes
#include <VA.h>
#include <VAObjectPool.h>
#include "../../VAAudioRenderer.h"
#include "../../VAAudioRendererRegistry.h"
#include "../../VAOutdoorNoiseAudioRenderer.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
#include "../../../Scene/VAScene.h"
#include "../../../VASourceListenerMetrics.h"
#include "../../../core/core.h"
// ITA includes
#include <ITADataSourceRealization.h>
#include <ITASampleBuffer.h>
#include <ITAVariableDelayLine.h>
// 3rdParty includes
#include <tbb/concurrent_queue.h>
// STL Includes
#include <list>
#include <set>
// Other
#include "../Clustering/Engine/VABinauralClusteringEngine.h"
#include "../Clustering/WaveFront/VABinauralWaveFront.h"
#include "../Clustering/Receiver/VABinauralClusteringDirectionReceiver.h"
// VA forwards
class CVASceneState;
class CVASceneStateDiff;
class CVASignalSourceManager;
class CVASoundSourceDesc;
class CVABinauralOutdoorWaveFront;
// Internal forward declarations
class CVABATNSoundPath;
class CVABATNSoundPathFactory;
//! Air Traffic Noise Audio Renderer (VATSS project)
//! A binaural outdoor noise renderer that handles propagation paths efficiently
/**
* Manages sound pathes from jet plane sound sources to a
* binaural receiver including multiple audio effects:
* - Directivity
* - Doppler-Shifts
* - Air-Absorption [TODO?!]
* - 1/r-Distance-Law
*
*
*/
class CVABinauralOutdoorNoiseAudioRenderer : public CVAOutdoorNoiseAudioRenderer, public ITADatasourceRealization
class CVABinauralOutdoorNoiseRenderer : public IVAAudioRenderer, public ITADatasourceRealization
{
public:
CVABinauralOutdoorNoiseAudioRenderer( const CVAAudioRendererInitParams& oParams );
virtual ~CVABinauralOutdoorNoiseAudioRenderer();
//! Render output sample blocks
/**
* This method renders the sound propagation based on the binaural approach
* by evaluating the abstract incidence waves at receiver, which are convolved
* using an HRTF for each direction.
*/
CVABinauralOutdoorNoiseRenderer( const CVAAudioRendererInitParams& );
~CVABinauralOutdoorNoiseRenderer();
inline void LoadScene( const std::string& ) {};
void ProcessStream( const ITAStreamInfo* pStreamInfo );
//! Returns the renderers output stream datasource
//! Handles scene updates for clustering stages
void UpdateScene( CVASceneState* pNewSceneState );
void Reset();
void UpdateGlobalAuralizationMode( int iGlobalAuralizationMode );
ITADatasource* GetOutputDatasource();
private: