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

Starting AirTrafficNoise renderer refactoring

parent 8748798c
......@@ -270,7 +270,7 @@ if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS} )
endif( RAVENNET_FOUND )
endif( )
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE=1" )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE" )
endif( )
if( ${ITA_VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_MONAURAL_FREE_FIELD=1" )
......
......@@ -1001,9 +1001,6 @@ public:
inline void getNoiseMagnitudes( CITAThirdOctaveMagnitudeSpectrum& oDest )
{
float c = ( float ) db10_to_ratio( -m_fOffsetDecibel );
float a = ( float ) db10_to_ratio( m_fStrengthDecibel );
assert( CITAThirdOctaveMagnitudeSpectrum::GetNumBands() == VA_TEMPORALNOISE_NUM_BANDS );
for( int i = 0; i < VA_TEMPORALNOISE_NUM_BANDS; i++ ) {
......@@ -1011,10 +1008,6 @@ public:
}
m_iCursor = ( ++m_iCursor ) % VA_TEMPORALNOISE_NUM_SAMPLES;
/*VA_DEBUG_PRINTF("Temporal noise magnitudes [dB]:\n");
VA_DEBUG_PRINTF(FloatVecToString(vfData, 1).c_str());
VA_DEBUG_PRINTF("\n");*/
}
private:
......
......@@ -1236,21 +1236,6 @@ CVAStruct CVAAmbisonicsFreeFieldAudioRenderer::CallObject( const CVAStruct& oArg
return oReturn;
}
if( ( pStruct = oArgs.GetValue( "DIFFRACTION" ) ) != nullptr )
{
if( pStruct->GetDatatype() != CVAStructValue::STRING )
VA_EXCEPT2( INVALID_PARAMETER, "Configuration command must be a string" );
std::string sDiffractionCommand = toUppercase( *pStruct );
if( sDiffractionCommand == "SETPOS" )
{
VAVec3 vPos( oArgs[ "X" ], oArgs[ "Y" ], oArgs[ "Z" ] );
return oReturn;
}
}
CVAConfigInterpreter oConfig( oArgs );
std::string sCommandOrg;
oConfig.ReqNonEmptyString( "Command", sCommandOrg );
......
......@@ -14,7 +14,7 @@
#ifndef IW_VACORE_BINAURALAIRTRAFFICNOISEAUDIORENDERER
#define IW_VACORE_BINAURALAIRTRAFFICNOISEAUDIORENDERER
#if ( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
#if VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE
// VA includes
#include <VA.h>
......@@ -59,20 +59,20 @@ class CVABATNSoundPathFactory;
* - Doppler-Shifts
* - Air-Absorption [TODO?!]
* - 1/r-Distance-Law
*
*
*/
class CVABinauralAirTrafficNoiseAudioRenderer : public IVAAudioRenderer, public ITADatasourceRealization
class CVABinauralAirTrafficNoiseAudioRenderer : public IVAAudioRenderer, public ITADatasourceRealization
{
public:
CVABinauralAirTrafficNoiseAudioRenderer(const CVAAudioRendererInitParams& oParams);
CVABinauralAirTrafficNoiseAudioRenderer( const CVAAudioRendererInitParams& oParams );
virtual ~CVABinauralAirTrafficNoiseAudioRenderer();
//! Reset scene
void Reset();
//! Dummy
void LoadScene( const std::string& ) {};
inline void LoadScene( const std::string& ) {};
//! Handle a scene state change
/**
* This method updates the internal representation of the VA Scene
......@@ -89,7 +89,7 @@ public:
* of the sound path entities
*/
void UpdateGlobalAuralizationMode( int iGlobalAuralizationMode );
//! Render output sample blocks
/**
* This method renders the sound propagation based on the binaural approach
......@@ -102,12 +102,15 @@ public:
//! Returns the renderers output stream datasource
ITADatasource* GetOutputDatasource();
CVAStruct GetParameters( const CVAStruct& oArgs );
void SetParameters( const CVAStruct& oArgs );
private:
const CVAAudioRendererInitParams m_oParams; //!< Create a const copy of the init params
//! Interne Beschreibung einer Schallquelle
class CVABATNSource : public CVAPoolObject
class CVABATNSource : public CVAPoolObject
{
public:
class Config
......@@ -119,7 +122,7 @@ private:
int iMotionModelNumHistoryKeys;
};
CVABATNSource( const Config& oConf_ )
inline CVABATNSource( const Config& oConf_ )
: oConf( oConf_ )
{};
......@@ -133,8 +136,8 @@ private:
bool bValidTrajectoryPresent; //!< Estimation possible -> valid trajectory present
// Pool-Konstruktor
void PreRequest()
{
inline void PreRequest()
{
pData = nullptr;
CVABasicMotionModel::Config oDefaultConfig;
......@@ -146,15 +149,15 @@ private:
bValidTrajectoryPresent = false;
};
void PreRelease()
inline void PreRelease()
{
delete pMotionModel;
pMotionModel = nullptr;
};
double GetCreationTimestamp() const
{
return m_dCreationTimeStamp;
inline double GetCreationTimestamp() const
{
return m_dCreationTimeStamp;
};
private:
......@@ -163,7 +166,7 @@ private:
//! Internal listener representation
class CVABATNListener : public CVAPoolObject
class CVABATNSoundReceiver : public CVAPoolObject
{
public:
class Config
......@@ -175,8 +178,8 @@ private:
int iMotionModelNumHistoryKeys;
};
CVABATNListener( CVACoreImpl* pCore, const Config& oConf )
: pCore( pCore ), oConf( oConf )
inline CVABATNSoundReceiver( CVACoreImpl* pCore, const Config& oConf )
: pCore( pCore ), oConf( oConf )
{};
CVACoreImpl* pCore;
......@@ -190,10 +193,10 @@ private:
VAVec3 vPredUp; //!< Estimated Orientation (Up-Vektor)
bool bValidTrajectoryPresent; //!< Estimation possible -> valid trajectory present
ITASampleFrame* psfOutput; //!< Accumulated listener output signals
void PreRequest()
{
ITASampleFrame* psfOutput; //!< Accumulated listener output signals @todo check if sample frame is also deleted after usage
inline void PreRequest()
{
pData = nullptr;
CVABasicMotionModel::Config oListenerMotionConfig;
......@@ -201,14 +204,14 @@ private:
oListenerMotionConfig.dWindowSize = oConf.dMotionModelWindowSize;
oListenerMotionConfig.iNumHistoryKeys = oConf.iMotionModelNumHistoryKeys;
pMotionModel = new CVASharedMotionModel( new CVABasicMotionModel( oListenerMotionConfig ), true );
bValidTrajectoryPresent = false;
psfOutput = nullptr;
};
// Pool-Destruktor
void PreRelease()
inline void PreRelease()
{
delete pMotionModel;
pMotionModel = nullptr;
......@@ -223,7 +226,7 @@ private:
CVASceneState* m_pNewSceneState;
int m_iCurGlobalAuralizationMode;
IVAObjectPool* m_pSoundPathPool;
CVABATNSoundPathFactory* m_pSoundPathFactory; //!< Erzeuger fr Schallpfade als Pool-Objekte
std::list< CVABATNSoundPath* > m_lSoundPaths; //!< Liste aller Schallpfade (im Thread-Kontext: VACore)
......@@ -232,16 +235,16 @@ private:
IVAObjectPool* m_pListenerPool;
std::map< int, CVABATNSource* > m_mSources; //!< Interne Abbildung der verfgbaren Quellen
std::map< int, CVABATNListener* > m_mListeners; //!< Interne Abbildung der verfgbaren Hrer
std::map< int, CVABATNSoundReceiver* > m_mListeners; //!< Interne Abbildung der verfgbaren Hrer
double m_dSpeedOfSound; //!< Schallgeschwindigkeit zur Berechnung von Verzgerungen
double m_dGroundPlanePosition; //!< Position of ground plane (height) for reflection calculation
int m_iHRIRFilterLength; //!< Length of the HRIR filter DSP module
int m_iDefaultVDLSwitchingAlgorithm; //!< Umsetzungsalgorithmus der Variablen Verzgerungsleitung
CVABATNListener::Config m_oDefaultListenerConf; //!< Default listener config for factory object creation
CVABATNSoundReceiver::Config m_oDefaultListenerConf; //!< Default listener config for factory object creation
CVABATNSource::Config m_oDefaultSourceConf; //!< Default source config for factory object creation
class CVABATNUpdateMessage : public CVAPoolObject
......@@ -249,12 +252,12 @@ private:
public:
std::list< CVABATNSource* > vNewSources;
std::list< CVABATNSource* > vDelSources;
std::list< CVABATNListener* > vNewListeners;
std::list< CVABATNListener* > vDelListeners;
std::list< CVABATNSoundReceiver* > vNewListeners;
std::list< CVABATNSoundReceiver* > vDelListeners;
std::list< CVABATNSoundPath* > vNewPaths;
std::list< CVABATNSoundPath* > vDelPaths;
void PreRequest()
inline void PreRequest()
{
vNewSources.clear();
vDelSources.clear();
......@@ -274,7 +277,7 @@ private:
tbb::concurrent_queue< CVABATNUpdateMessage* > m_qpUpdateMessages; //!< Update messages list
std::list< CVABATNSoundPath* > m_lSoundPaths; //!< List of sound paths
std::list< CVABATNSource* > m_lSources; //!< List of sources
std::list< CVABATNListener* > m_lListener; //!< List of listeners
std::list< CVABATNSoundReceiver* > m_lListener; //!< List of listeners
ITASampleBuffer m_sbTempBufD; //!< Temporally used buffer to store a block of samples during processing (direct sound)
ITASampleBuffer m_sbTempBufR; //!< Temporally used buffer to store a block of samples during processing (reflected sound)
ITAAtomicInt m_iResetFlag; //!< Reset status flag: 0=normal_op, 1=reset_request, 2=reset_ack
......@@ -283,17 +286,15 @@ private:
void Init( const CVAStruct& oArgs );
void ManageSoundPaths( const CVASceneState* pCurScene,
const CVASceneState* pNewScene,
const CVASceneStateDiff* pDiff );
void ManageSoundPaths( const CVASceneState* pCurScene, const CVASceneState* pNewScene, const CVASceneStateDiff* pDiff );
void UpdateSources();
CVABATNListener* CreateListener( int iID, const CVAListenerState* );
CVABATNSoundReceiver* CreateSoundReceiver( int iID, const CVAListenerState* );
void DeleteListener( int iID );
CVABATNSource* CreateSource( int iID, const CVASoundSourceState* );
CVABATNSource* CreateSoundSource( int iID, const CVASoundSourceState* );
void DeleteSource( int iID );
CVABATNSoundPath* CreateSoundPath( CVABATNSource*, CVABATNListener* );
CVABATNSoundPath* CreateSoundPath( CVABATNSource*, CVABATNSoundReceiver* );
void DeleteSoundPath( CVABATNSoundPath* );
void UpdateTrajectories();
void UpdateSoundPaths();
......@@ -303,10 +304,10 @@ private:
void ResetInternalData();
friend class CVABATNSoundPath;
friend class CVABATNListenerPoolFactory;
friend class CVABATNSoundReceiverPoolFactory;
friend class CVABATNSourcePoolFactory;
};
#endif // ( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
#endif // VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE
#endif // IW_VACORE_BINAURALAIRTRAFFICNOISEAUDIORENDERER
......@@ -82,9 +82,9 @@ void CVAAudioRendererRegistry::RegisterInternalCoreFactoryMethods()
#if( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
RegisterRendererDefaultFactory< CVABinauralFreeFieldAudioRenderer >( "BinauralFreeField" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
#if( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
#ifdef VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE
RegisterRendererDefaultFactory< CVABinauralAirTrafficNoiseAudioRenderer >( "BinauralAirTrafficNoise" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
#endif // VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE
#if( VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB == 1 )
RegisterRendererDefaultFactory< CVABinauralArtificialReverbAudioRenderer >( "BinauralArtificialReverb" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB == 1 )
......
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