diff --git a/CMakeLists.txt b/CMakeLists.txt index 536128fc115d88f16d9b8d0c0e6aaf4be3fc7e5c..d13715cf613dfea171c71e6584005c4ffa749809 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,6 +157,10 @@ 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_BINAURAL_REAL_TIME ) + set( ITA_VACORE_WITH_RENDERER_BINAURAL_REAL_TIME OFF CACHE BOOL "Build VACore with rendering module: real time renderer" ) +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" ) @@ -304,6 +308,9 @@ endif( ) if( ITA_VACORE_WITH_RENDERER_VBAP_FREE_FIELD ) add_definitions( "-DVACORE_WITH_RENDERER_VBAP_FREE_FIELD" ) endif( ) +if( ITA_VACORE_WITH_RENDERER_BINAURAL_REAL_TIME ) + add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_REAL_TIME" ) +endif( ) # Reproduction definitions if( ITA_VACORE_WITH_REPRODUCTION_TALKTHROUGH ) diff --git a/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp b/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp index 07e6084a1170a33316ff3001b15d54c9c4361209..47b56c38009817e40ba44353d18709b1aa1165f5 100644 --- a/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp +++ b/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp @@ -76,7 +76,7 @@ VABinauralCluster::getOutput() double phi = atan2(sourceToListenerPos.y, sourceToListenerPos.x); double theta = acos(sourceToListenerPos.z); - // add general distance VDL + //TODO: add general distance VDL double toaChL = _listener->toaEstimator->getTOALeft(phi, theta); double toaChR = _listener->toaEstimator->getTOARight(phi, theta); diff --git a/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp b/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp index dc223aed94ec8904a67f3704fba4436ea9cc4583..e4cadb7ffb7d40ee9afb4cc77c361687dd562fac 100644 --- a/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp +++ b/src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp @@ -92,19 +92,19 @@ VABinauralClustering::update() } // add unassigned sources - std::map< int , VABinauralSoundSource* >::iterator it; + std::map< int , VABinauralSoundSource* >::iterator sourceIt; - for (it = _unassignedSources.begin(); it != _unassignedSources.end(); ++it) + for (sourceIt = _unassignedSources.begin(); sourceIt != _unassignedSources.end(); ++sourceIt) { - state->addSource(it->first, it->second, _threshold, 0); + state->addSource(sourceIt->first, sourceIt->second, _threshold, 0); } // TODO: refinement // update source status - for (it = _unassignedSources.begin(); it != _unassignedSources.end(); ++it) + for (sourceIt = _unassignedSources.begin(); sourceIt != _unassignedSources.end(); ++it) { - _assignedSources.insert(std::pair< int, VABinauralSoundSource* >(it->first, it->second)); + _assignedSources.insert(std::pair< int, VABinauralSoundSource* >(sourceIt->first, sourceIt->second)); } _unassignedSources.clear(); diff --git a/src/Rendering/Binaural/RealTime/Utils/BinauralListener/VABinauralListener.h b/src/Rendering/Binaural/RealTime/Utils/BinauralListener/VABinauralListener.h index f2e14b9d3766bfb77d58cddcb8ced8df79bedf3c..e34f463c4a0d4f922353e4a8a853b192de4343eb 100644 --- a/src/Rendering/Binaural/RealTime/Utils/BinauralListener/VABinauralListener.h +++ b/src/Rendering/Binaural/RealTime/Utils/BinauralListener/VABinauralListener.h @@ -42,7 +42,6 @@ public: VABinauralListener(const CVACoreImpl* core, const config_t& conf); - virtual ~VABinauralListener(); void diff --git a/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp b/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp index eca383088682fc7d5dcc51b9fb6b28162b494dc4..3815def4eeb4822f9ebb3075480d888eeda10cf4 100644 --- a/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp +++ b/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp @@ -36,6 +36,8 @@ VABinauralRealTimeRenderer::VABinauralRealTimeRenderer( const CVAAudioRendererIn IVAPoolObjectFactory* sourceFactory = new VABinauralSoundSourcePoolFactory(_defaultSourceConf); _sourcePool = IVAObjectPool::Create(16, 2, sourceFactory, true); + + _curGlobalAuralizationMode = IVAInterface::VA_AURAMODE_DEFAULT; } @@ -100,8 +102,36 @@ VABinauralRealTimeRenderer::init( const CVAStruct& oArgs ) _defaultSourceConf.sampleRate = GetSampleRate(); } +void +VABinauralRealTimeRenderer::Reset() +{ + +}; + +ITADatasource* +VABinauralRealTimeRenderer::GetOutputDatasource() { + return this; +}; + +CVAStruct +VABinauralRealTimeRenderer::CallObject(const CVAStruct& oArgs){ + CVAStruct oReturn; + + return oReturn; +}; + +void VABinauralRealTimeRenderer::UpdateGlobalAuralizationMode(int iGlobalAuralizationMode) +{ + if (_curGlobalAuralizationMode == iGlobalAuralizationMode) + return; + + _curGlobalAuralizationMode = iGlobalAuralizationMode; + + return; +} + void -VABinauralRealTimeRenderer::processStream(const ITAStreamInfo* streamInfo) +VABinauralRealTimeRenderer::ProcessStream(const ITAStreamInfo* streamInfo) { ITASampleFrame* output; float* outputChL = GetWritePointer(0); @@ -133,7 +163,7 @@ VABinauralRealTimeRenderer::processStream(const ITAStreamInfo* streamInfo) } void -VABinauralRealTimeRenderer::updateScene(CVASceneState* newSceneState) +VABinauralRealTimeRenderer::UpdateScene(CVASceneState* newSceneState) { assert(newSceneState); diff --git a/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.h b/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.h index f5c261e4d6cf78101860518c70e6253c7136e0d0..50b9c70cb26f5e3b7eaab7fd397c1b26815420aa 100644 --- a/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.h +++ b/src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.h @@ -17,20 +17,32 @@ class VABinauralRealTimeRenderer : public IVAAudioRenderer, public CVAObject, pu { public: VABinauralRealTimeRenderer( const CVAAudioRendererInitParams& ); - virtual ~VABinauralRealTimeRenderer(); + ~VABinauralRealTimeRenderer(); - inline void loadScene( const std::string& ) {}; + inline void + LoadScene( const std::string& ) {}; - void processStream( const ITAStreamInfo* pStreamInfo ); + void + ProcessStream( const ITAStreamInfo* pStreamInfo ); - void updateScene( CVASceneState* newSceneState ); + void + UpdateScene( CVASceneState* newSceneState ); // Resets the renderer to it's initial state - void reset(); + void + Reset(); // Returns the renderers output stream datasource // ITADatasource* GetOutputDatasource(); + void UpdateGlobalAuralizationMode(int iGlobalAuralizationMode); + + ITADatasource* + GetOutputDatasource(); + + CVAStruct + CallObject(const CVAStruct& oArgs); + private: const CVAAudioRendererInitParams _params; @@ -56,6 +68,7 @@ private: int _defaultVDLSwitchingAlgorithm; int _hrirFilterLength; + int _curGlobalAuralizationMode; double _additionalStaticDelaySeconds; void diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 272db12becebfc0f7856422821b92bace39725bd..33285bfb4af8e06ebe0ba4a36c5647a4ea906988 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -82,3 +82,13 @@ vista_install( HATORenderingTest ) vista_create_default_info_file( HATORenderingTest ) set_property( TARGET HATORenderingTest PROPERTY FOLDER "VA/Tests/VACore" ) + + +add_executable( BinauralRealTimeRendererTest VABinauralRealTimeRendererTest.cpp ) +target_link_libraries( BinauralRealTimeRendererTest ${VISTA_USE_PACKAGE_LIBRARIES} ${VISTAINTERPROCCOMM_ADDITIONAL_DEPENDENCIES} ) + +vista_configure_app( BinauralRealTimeRendererTest ) +vista_install( BinauralRealTimeRendererTest ) +vista_create_default_info_file( BinauralRealTimeRendererTest ) + +set_property( TARGET BinauralRealTimeRendererTest PROPERTY FOLDER "VA/Tests/VACore" ) diff --git a/tests/CoreTest.cpp b/tests/CoreTest.cpp index 1945455797df776762060f94d163b7463aafdde2..eb3ce6121bfe4c38973583ee47222ce16721b34e 100644 --- a/tests/CoreTest.cpp +++ b/tests/CoreTest.cpp @@ -73,32 +73,32 @@ int main( int, char** ) { try { - va = VACore::CreateCoreInstance( "../conf/VACore.ini" ); - //va = VACore::CreateCoreInstance( GetCoreConfig() ); + //va = VACore::CreateCoreInstance( "../conf/VACore.ini" ); + va = VACore::CreateCoreInstance( GetCoreConfig() ); // Attach (register) event handler //va->AttachEventHandler( &dumper ); - va->AttachEventHandler( &rendering_controller ); + //va->AttachEventHandler( &rendering_controller ); - CVAVersionInfo ver; - va->GetVersionInfo( &ver ); - cout << ver.ToString() << endl; + //CVAVersionInfo ver; + //va->GetVersionInfo( &ver ); + //cout << ver.ToString() << endl; va->Initialize(); va->AddSearchPath( "../data" ); - /* - TestModuleInterface(); + + //TestModuleInterface(); AudioRenderers(); - AudioReproductions(); + //AudioReproductions(); - CreateHRIRs(); - CreateAudioSignals(); - CreateScene(); + //CreateHRIRs(); + //CreateAudioSignals(); + //CreateScene(); //ConnectSignals(); - TestSignalAndSourceConnections(); - */ + //TestSignalAndSourceConnections(); + bugfix_scene_pool_clearance_issue(); diff --git a/tests/VABinauralRealTimeRendererTest.cpp b/tests/VABinauralRealTimeRendererTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08292be6a8df6b7add0cd8b3cf49710a8e35d4ae --- /dev/null +++ b/tests/VABinauralRealTimeRendererTest.cpp @@ -0,0 +1,72 @@ +#include +#include + +#include + +CVAStruct GetCoreConfig() +{ + CVAStruct oConfig; + + CVAStruct oSectionDebug; + oSectionDebug["loglevel"] = 5; + oConfig["debug"] = oSectionDebug; + + CVAStruct oSectionDriver; + oSectionDriver["driver"] = "Portaudio"; + oConfig["audio driver"] = oSectionDriver; + + CVAStruct oDevice1; + oDevice1["type"] = "HP"; + oDevice1["channels"] = "1,2"; + oConfig["OutputDevice:MyHP"] = oDevice1; + + CVAStruct oOutput1; + oOutput1["devices"] = "MyHP"; + oConfig["Output:MyDesktopHP"] = oOutput1; + + CVAStruct oReproduction1; + oReproduction1["class"] = "Talkthrough"; + oReproduction1["outputs"] = "MyDesktopHP"; + oConfig["Reproduction:Talkthrough"] = oReproduction1; + + CVAStruct oRenderer1; + oRenderer1["class"] = "BinauralFreeField"; + oRenderer1["Reproductions"] = "MyTalkthroughHeadphones"; + oConfig["Renderer:BFF_CoreTest"] = oRenderer1; + + CVAStruct oRenderer2; + oRenderer2["class"] = "PrototypeGenericPath"; + oRenderer2["numchannels"] = 2; + oRenderer2["Reproductions"] = "MyTalkthroughHeadphones"; + oConfig["Renderer:PTGP_CoreTest"] = oRenderer2; + + return oConfig; +} + +IVAInterface* va = NULL; + +int main(int, char**) +{ + try + { + va = VACore::CreateCoreInstance(GetCoreConfig()); + + va->Initialize(); + + VistaTimeUtils::Sleep(60000); + + va->Finalize(); + } + catch (CVAException& e) + { + std::cerr << "Error: " << e << std::endl; + int iErrorCode = e.GetErrorCode(); + delete va; + + return iErrorCode; + } + + delete va; + + return 0; +} \ No newline at end of file