VABinauralOutdoorNoiseAudioRenderer.h 3.62 KB
Newer Older
1 2 3 4 5 6
/*
 *  --------------------------------------------------------------------------------------------
 *
 *    VVV        VVV A           Virtual Acoustics (VA) | http://www.virtualacoustics.org
 *     VVV      VVV AAA          Licensed under the Apache License, Version 2.0
 *      VVV    VVV   AAA
7
 *       VVV  VVV     AAA        Copyright 2015-2018
8 9 10 11 12 13 14 15 16 17 18
 *        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

19
// VA Includes
20 21
#include <VA.h>
#include "../../VAAudioRenderer.h"
henryjandrew's avatar
wip  
henryjandrew committed
22 23 24
#include <ITAThirdOctaveFilterbank.h>


25 26 27 28

// ITA includes
#include <ITADataSourceRealization.h>

29 30 31 32
// Other
#include "../Clustering/Engine/VABinauralClusteringEngine.h"
#include "../Clustering/WaveFront/VABinauralWaveFront.h"
#include "../Clustering/Receiver/VABinauralClusteringDirectionReceiver.h"
33

34
class CVABinauralOutdoorWaveFront;
henryjandrew's avatar
wip  
henryjandrew committed
35
class CVABinauralOutdoorSource;
36

37
//! A binaural outdoor noise renderer that handles propagation paths efficiently
38
/**
39
  *  
40 41
  *
  */
42
class CVABinauralOutdoorNoiseRenderer : public IVAAudioRenderer, public ITADatasourceRealization
43 44
{
public:
45 46 47 48 49
	CVABinauralOutdoorNoiseRenderer( const CVAAudioRendererInitParams& );
	~CVABinauralOutdoorNoiseRenderer();

	inline void LoadScene( const std::string& ) {};

50 51
	void ProcessStream( const ITAStreamInfo* pStreamInfo );

52 53 54 55 56 57 58
	//! Handles scene updates for clustering stages
	void UpdateScene( CVASceneState* pNewSceneState );

	void Reset();

	void UpdateGlobalAuralizationMode( int iGlobalAuralizationMode );

59 60
	ITADatasource* GetOutputDatasource();

61 62 63
	void SetParameters( const CVAStruct& );
	CVAStruct GetParameters( const CVAStruct& ) const;

64
private:
65 66
	const CVAAudioRendererInitParams m_oParams;

henryjandrew's avatar
wip  
henryjandrew committed
67
	std::map< int, CVABinauralOutdoorSource* > m_mSources;
68
	std::map< int, CVABinauralClusteringDirectionReceiver* > m_mBinauralReceivers;
henryjandrew's avatar
wip  
henryjandrew committed
69 70
	std::map< int, CVABinauralOutdoorWaveFront* > m_mPaths; // All path of entire scene for all sources and receivers

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101

	CVABinauralClusteringEngine* m_pClusterEngine;

	CVACoreImpl* m_pCore;

	CVASceneState* m_pNewSceneState;
	CVASceneState* m_pCurSceneState;

	IVAObjectPool* m_pWaveFrontPool;
	IVAObjectPool* m_pReceiverPool;

	std::atomic< bool > m_bIndicateReset, m_bResetAck;

	CVABinauralClusteringDirectionReceiver::Config m_oDefaultReceiverConf; //!< Default listener config for factory object creation
	CVABinauralWaveFrontBase::Config m_oDefaultWaveFrontConf;

	int m_iDefaultVDLSwitchingAlgorithm;
	int m_iHRIRFilterLength;
	int m_iCurGlobalAuralizationMode; // @todo use in UpdateScene
	double m_dAdditionalStaticDelaySeconds;

	void Init( const CVAStruct& oArgs );

	void UpdateSoundReceivers( CVASceneStateDiff* diff );
	void UpdateSoundSources( CVASceneStateDiff* diff );

	void CreateSoundReceiver( const int iID, const CVAReceiverState* pState );
	void CreateSoundSource( const int iID, const CVASoundSourceState* pState );

	void DeleteSoundReceiver( const int iID );
	void DeleteSoundSource( const int iiD );
102

103 104
	void UpdateMotionStates();
	void UpdateTrajectories( double dTime );
henryjandrew's avatar
wip  
henryjandrew committed
105 106 107 108 109 110 111 112

	int mNumberofPaths;

	std::vector<ITABase::CThirdOctaveGainMagnitudeSpectrum> mMags; //internal vector of target magnitude spectrums for IIR filter design
	//vector elements correspond to the path number

	std::map< int, CVABinauralOutdoorWaveFront* > m_mCurrentWaveFronts;

113 114 115 116 117
};

#endif // VACORE_WITH_RENDERER_BINAURAL_OUTDOOR_NOISE

#endif // IW_VACORE_BINAURAL_OUTDOOR_NOISE_AUDIO_RENDERER