Commit 188a745c authored by Lucas Moesch's avatar Lucas Moesch

Added integration in VA renderers.

parent cfdeb920
......@@ -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 )
......
......@@ -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);
......
......@@ -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();
......
......@@ -42,7 +42,6 @@ public:
VABinauralListener(const CVACoreImpl* core, const config_t& conf);
virtual
~VABinauralListener();
void
......
......@@ -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;
}
......@@ -101,7 +103,35 @@ VABinauralRealTimeRenderer::init( const CVAStruct& oArgs )
}
void
VABinauralRealTimeRenderer::processStream(const ITAStreamInfo* streamInfo)
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)
{
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);
......
......@@ -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
......
......@@ -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" )
......@@ -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();
......
#include <VA.h>
#include <VACore.h>
#include <VistaBase/VistaTimeUtils.h>
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
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