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
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VACORE_BINAURAL_OUTDOOR_NOISE_AUDIO_RENDERER
#define IW_VACORE_BINAURAL_OUTDOOR_NOISE_AUDIO_RENDERER
#if VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE
// 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 "../../../VACoreImpl.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>
// VA forwards
class CVASceneState;
class CVASceneStateDiff;
class CVASignalSourceManager;
class CVASoundSourceDesc;
// Internal forward declarations
class CVABATNSoundPath;
class CVABATNSoundPathFactory;
//! Air Traffic Noise Audio Renderer (VATSS project)
/**
* 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
{
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.
*/
void ProcessStream( const ITAStreamInfo* pStreamInfo );
//! Returns the renderers output stream datasource
ITADatasource* GetOutputDatasource();
private:
int m_iHRIRFilterLength; //!< Length of the HRIR filter DSP module
//! Not for use, avoid C4512
inline CVABinauralOutdoorNoiseAudioRenderer operator=( const CVABinauralOutdoorNoiseAudioRenderer & ) { VA_EXCEPT_NOT_IMPLEMENTED; };
};
#endif // VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE
#endif // IW_VACORE_BINAURAL_OUTDOOR_NOISE_AUDIO_RENDERER
set( RelativeDir "src/Rendering/Binaural/OutdoorNoise" )
set( RelativeSourceGroup "Source Files\\Rendering\\Binaural\\OutdoorNoise" )
set( DirFiles
VABinauralOutdoorNoiseAudioRenderer.cpp
VABinauralOutdoorNoiseAudioRenderer.h
_SourceFiles.cmake
)
set( DirFiles_SourceGroup "${RelativeSourceGroup}" )
set( LocalSourceGroupFiles )
foreach( File ${DirFiles} )
list( APPEND LocalSourceGroupFiles "${RelativeDir}/${File}" )
list( APPEND ProjectSources "${RelativeDir}/${File}" )
endforeach()
source_group( ${DirFiles_SourceGroup} FILES ${LocalSourceGroupFiles} )
......@@ -2,7 +2,7 @@
set( RelativeDir "src/Rendering/Binaural" )
set( RelativeSourceGroup "Source Files\\Rendering\\Binaural" )
set( SubDirs AirTrafficNoise ArtificialReverb FreeField RoomAcoustics )
set( SubDirs AirTrafficNoise ArtificialReverb FreeField OutdoorNoise RoomAcoustics )
set( DirFiles
_SourceFiles.cmake
......
This diff is collapsed.
/*
* --------------------------------------------------------------------------------------------
*
* 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
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VACORE_OUTDOOR_NOISE_AUDIO_RENDERER
#define IW_VACORE_OUTDOOR_NOISE_AUDIO_RENDERER
// VA includes
#include <VA.h>
#include <VAObjectPool.h>
#include "VAAudioRenderer.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
#include "../../../Scene/VAScene.h"
#include "../../../VASourceListenerMetrics.h"
#include "../../../VACoreImpl.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>
// VA forwards
class CVASceneState;
class CVASceneStateDiff;
class CVASignalSourceManager;
class CVASoundSourceDesc;
// Internal forward declarations
class CVABATNSoundPath;
class CVABATNSoundPathFactory;
//! Outdoor Noise Audio Renderer (base class with generic receiver signals)
/**
* Manages sound pathes from sound sources to a
* generic receiver including multiple audio effects:
* - Directivity
* - Doppler-Shifts
* - Air-Absorption
* - 1/r-Distance-Law
* - Reflection
* - Diffraction
*
*/
class CVAOutdoorNoiseAudioRenderer : public IVAAudioRenderer
{
public:
CVAOutdoorNoiseAudioRenderer( const CVAAudioRendererInitParams& oParams );
virtual ~CVAOutdoorNoiseAudioRenderer();
//! Reset scene
void Reset();
//! Dummy
inline void LoadScene( const std::string& ) {};
//! Handle a scene state change
/**
* This method updates the internal representation of the VA Scene
* by setting up or deleting the sound path entities as well as
* modifying existing ones that have changed their state, i.e.
* pose or dataset
*/
void UpdateScene( CVASceneState* pNewSceneState );
//! Handle a state change in global auralisation mode
/**
* This method updates internal settings for the global auralisation
* mode affecting the activation/deactivation of certain components
* of the sound path entities
*/
void UpdateGlobalAuralizationMode( int iGlobalAuralizationMode );
//! Render incidence sample blocks for receivers
/**
* This method renders the sound propagation based on the binaural approach
* by evaluating motion and events that are retarded in time, i.e. it switches
* filter parts and magnitudes of the HRIR or Directivity. It also considers
* the effective auralisation mode.
*/
void Process( const double dReceiverTime );
void GetIncidenceDirectionIDs( const int iReceiverID, const std::vector< int >& viIncidenceDirectionIDs ) const;
void GetReceiverIncidenceBuffer( const int iReceiverID, const int iIncidenceDirectionID, const ITASampleBuffer* pSamples ) const;
CVAStruct GetParameters( const CVAStruct& oArgs );
void SetParameters( const CVAStruct& oArgs );
protected:
const CVAAudioRendererInitParams m_oParams; //!< Create a const copy of the init params
//! Interne Beschreibung einer Schallquelle
class CVAONSoundSource : public CVAPoolObject
{
public:
class Config
{
public:
double dMotionModelWindowSize;
double dMotionModelWindowDelay;
int iMotionModelNumHistoryKeys;
};
inline CVAONSoundSource( const Config& oConf_ )
: oConf( oConf_ )
{};
const Config oConf;
CVASoundSourceDesc* pData; //!< (Unversioned) Source description
CVASharedMotionModel* pMotionModel;
bool bDeleted;
VAVec3 vPredPos; //!< Estimated position
VAVec3 vPredView; //!< Estimated Orientation (View-Vektor)
VAVec3 vPredUp; //!< Estimated Orientation (Up-Vektor)
bool bValidTrajectoryPresent; //!< Estimation possible -> valid trajectory present
// Pool-Konstruktor
inline void PreRequest()
{
pData = nullptr;
CVABasicMotionModel::Config oDefaultConfig;
oDefaultConfig.dWindowDelay = oConf.dMotionModelWindowDelay;
oDefaultConfig.dWindowSize = oConf.dMotionModelWindowSize;
oDefaultConfig.iNumHistoryKeys = oConf.iMotionModelNumHistoryKeys;
pMotionModel = new CVASharedMotionModel( new CVABasicMotionModel( oDefaultConfig ), true );
bValidTrajectoryPresent = false;
};
inline void PreRelease()
{
delete pMotionModel;
pMotionModel = nullptr;
};
inline double GetCreationTimestamp() const
{
return m_dCreationTimeStamp;
};
private:
double m_dCreationTimeStamp; //!< Date of creation within streaming context
};
//! Internal receiver representation
class CVAONSoundReceiver : public CVAPoolObject
{
public:
class Config
{
public:
double dMotionModelWindowSize;
double dMotionModelWindowDelay;
int iMotionModelNumHistoryKeys;
};
inline CVAONSoundReceiver( CVACoreImpl* pCore, const Config& oConf )
: pCore( pCore ), oConf( oConf )
{};
CVACoreImpl* pCore;
const Config oConf;
CVAListenerDesc* pData; //!< (Unversioned) Listener description
CVASharedMotionModel* pMotionModel;
bool bDeleted;
VAVec3 vPredPos; //!< Estimated position
VAVec3 vPredView; //!< Estimated Orientation (View-Vektor)
VAVec3 vPredUp; //!< Estimated Orientation (Up-Vektor)
bool bValidTrajectoryPresent; //!< Estimation possible -> valid trajectory present
//! Abstract spatial audio stream representation for receiver point
class CIncidenceDirection
{
public:
int iID;
VAQuat qDirectionFromReceiver;
ITASampleBuffer* psbBuffer;
inline CIncidenceDirection() : iID( -1 ), psbBuffer( NULL ) {};
};
std::vector< CIncidenceDirection > voIncidenceDirections; //!< Abstract directional data at receiver point
inline void PreRequest()
{
pData = nullptr;
CVABasicMotionModel::Config oListenerMotionConfig;
oListenerMotionConfig.dWindowDelay = oConf.dMotionModelWindowDelay;
oListenerMotionConfig.dWindowSize = oConf.dMotionModelWindowSize;
oListenerMotionConfig.iNumHistoryKeys = oConf.iMotionModelNumHistoryKeys;
pMotionModel = new CVASharedMotionModel( new CVABasicMotionModel( oListenerMotionConfig ), true );
bValidTrajectoryPresent = false;
};
// Pool-Destruktor
inline void PreRelease()
{
delete pMotionModel;
pMotionModel = nullptr;
};
};
protected:
CVACoreImpl* m_pCore; //!< Pointer to VACore
CVASceneState* m_pCurSceneState;
CVASceneState* m_pNewSceneState;
int m_iCurGlobalAuralizationMode;
IVAObjectPool* m_pSoundPathPool;
CVABATNSoundPathFactory* m_pSoundPathFactory;
std::list< CVABATNSoundPath* > m_lSoundPaths;
IVAObjectPool* m_pSourcePool;
IVAObjectPool* m_pListenerPool;
std::map< int, CVAONSoundSource* > m_mSources;
std::map< int, CVAONSoundReceiver* > m_mReceivers;
int m_iDefaultVDLSwitchingAlgorithm;
CVAONSoundReceiver::Config m_oDefaultReceiverConf; //!< Default listener config for factory object creation
CVAONSoundSource::Config m_oDefaultSourceConf; //!< Default source config for factory object creation
class CVABATNUpdateMessage : public CVAPoolObject
{
public:
std::list< CVAONSoundSource* > vNewSources;
std::list< CVAONSoundSource* > vDelSources;
std::list< CVAONSoundReceiver* > vNewListeners;
std::list< CVAONSoundReceiver* > vDelListeners;
std::list< CVABATNSoundPath* > vNewPaths;
std::list< CVABATNSoundPath* > vDelPaths;
inline void PreRequest()
{
vNewSources.clear();
vDelSources.clear();
vNewListeners.clear();
vDelListeners.clear();
vNewPaths.clear();
vDelPaths.clear();
}
};
IVAObjectPool* m_pUpdateMessagePool; // really necessary?
CVABATNUpdateMessage* m_pUpdateMessage;
//! Data in context of audio process
struct
{
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< 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
ITAAtomicInt m_iStatus; //!< Current status flag: 0=stopped, 1=running
} ctxAudio;
void Init( const CVAStruct& oArgs );
void ManageSoundPaths( const CVASceneState* pCurScene, const CVASceneState* pNewScene, const CVASceneStateDiff* pDiff );
void UpdateSources();
CVABATNSoundReceiver* CreateSoundReceiver( int iID, const CVAReceiverState* );
void DeleteListener( int iID );
CVABATNSource* CreateSoundSource( int iID, const CVASoundSourceState* );
void DeleteSource( int iID );
CVABATNSoundPath* CreateSoundPath( CVABATNSource*, CVABATNSoundReceiver* );
void DeleteSoundPath( CVABATNSoundPath* );
void UpdateTrajectories();
void UpdateSoundPaths();
void SampleTrajectoriesInternal( double dTime );
void SyncInternalData();
void ResetInternalData();
friend class CVABATNSoundPath;
friend class CVABATNSoundReceiverPoolFactory;
friend class CVABATNSourcePoolFactory;
//! Not for use, avoid C4512
inline CVABinauralAirTrafficNoiseAudioRenderer operator=( const CVABinauralAirTrafficNoiseAudioRenderer & ) { VA_EXCEPT_NOT_IMPLEMENTED; };
};
#endif // IW_VACORE_OUTDOOR_NOISE_AUDIO_RENDERER
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