Commit 87791613 authored by Jonas Stienen's avatar Jonas Stienen
Browse files

Adding binaural room acoustics renderer support (uses RAVEN)

parent 2a46a2fd
......@@ -11,15 +11,18 @@ if( NOT DEFINED ITA_VACORE_INSTALL_WITH_DLLS )
set( ITA_VACORE_INSTALL_WITH_DLLS ON CACHE BOOL "Install VACore with depending DLLs (use this switch with care)" )
endif( NOT DEFINED ITA_VACORE_INSTALL_WITH_DLLS )
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm )
# Required packages
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm FIND_DEPENDENCIES )
vista_use_package( VABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITAConvolution REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITACTC REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITASampler REQUIRED FIND_DEPENDENCIES )
vista_use_package( OpenDAFF REQUIRED )
# Version
# Optional packages
vista_find_package( RavenNet QUIET )
if( NOT DEFINED ITA_VACORE_VERSION_MAJOR )
set( ITA_VACORE_VERSION_MAJOR 1 CACHE INT "VACore version major" )
......@@ -156,7 +159,12 @@ if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS=1" )
if( RAVENNET_FOUND )
vista_use_package( RavenNet REQUIRED FIND_DEPENDENCIES )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS=1" )
else( RAVENNET_FOUND )
message( "Could not find RavenNet, which is required by binaural room acoustics audio renderer" )
endif( RAVENNET_FOUND )
endif()
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE=1" )
......
......@@ -30,7 +30,7 @@
#include <ITAStringUtils.h>
#include <cassert>
#include <daff.h>
#include <DAFF.h>
#include <sstream>
CVAHRIRDatasetDAFF2D::CVAHRIRDatasetDAFF2D(const std::string& sFilename,
......@@ -42,11 +42,11 @@ CVAHRIRDatasetDAFF2D::CVAHRIRDatasetDAFF2D(const std::string& sFilename,
// Der DAFF-Reader wirft std::exceptions
m_pReader = DAFFReader::create();
int iError = m_pReader->openFile(sFilename);
int iError = m_pReader->openFile( sFilename );
if( iError != DAFF_NO_ERROR )
{
delete m_pReader;
std::string sErrorStr = std::to_string( (long double) iError );
std::string sErrorStr = DAFFUtils::StrError( iError );
VA_EXCEPT1( std::string("Could not load HRIR dataset from file \"") +
sFilename + std::string("\". ") + sErrorStr + std::string(".") );
}
......
......@@ -10,32 +10,31 @@
#include "VARoomAcousticsScheduler.h"
// VA includes
#include <Utils/VADebug.h>
#include "../../../Utils/VADebug.h"
#include <VACore.h>
#include <VACoreImpl.h>
#include <VALog.h>
#include "../../../VACoreImpl.h"
#include "../../../VALog.h"
#include <VAObjectPool.h>
#include <VALockfreeObjectPool.h>
#include <VASourceListenerMetrics.h>
#include "VADirectivity.h>
#include "VAHRIRDataset.h>
#include <Filtering/VAAtmosphere.h>
#include <Filtering/VAThirdOctaveMagnitudes.h>
#include <Filtering/VAThirdOctaveFIRFilterGenerator.h>
#include <Filtering/VAThirdOctaveFilterbank.h>
#include <Filtering/VAVariableDelayLine.h>
#include <Motion/VAMotionModelBase.h>
#include <Motion/VASampleAndHoldMotionModel.h>
#include <Motion/VASharedMotionModel.h>
#include <Utils/VADebug.h>
#include <Utils/VAUtils.h>
#include <VABaseDefinitions.h>
#include "../../../VALockfreeObjectPool.h"
#include "../../../VASourceListenerMetrics.h"
#include "../../../Data/VADirectivity.h"
#include "../../../Data/VAHRIRDataset.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Filtering/VAThirdOctaveMagnitudes.h"
#include "../../../Filtering/VAThirdOctaveFIRFilterGenerator.h"
#include "../../../Filtering/VAThirdOctaveFilterbank.h"
#include "../../../Filtering/VAVariableDelayLine.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASampleAndHoldMotionModel.h"
#include "../../../Motion/VASharedMotionModel.h"
#include "../../../Utils/VADebug.h"
#include "../../../Utils/VAUtils.h"
#include <DAFF.h>
#include <DSMBCConvolver.h>
#include <DSMBCFilter.h>
#include <DSMBCFilterPool.h>
#include <FastMath.h>
#include <ITAFastMath.h>
#include <ITAAtomicPrimitives.h>
#include <ITAAudiofileWriter.h>
#include <ITASampleFrame.h>
......@@ -45,17 +44,6 @@
#include <iostream>
#include <complex>
// Raven Libraries per Pragma hinzufgen
#ifdef _DEBUG
#pragma comment(lib,"VARavenDllD.lib")
#pragma comment(lib,"RavenNetDllD.lib")
#pragma comment(lib,"RavenGeoD.lib")
#else
#pragma comment(lib,"VARavenDll.lib")
#pragma comment(lib,"RavenNetDll.lib")
#pragma comment(lib,"RavenGeo.lib")
#endif
RG_Vector ConvertToRGVector( const VAVec3& v )
{
return RG_Vector( float( v.x ), float( v.y ), float( v.z ) );
......@@ -256,10 +244,10 @@ public:
bool bInformationPresent;
// Generelle Zeiten
ITAStopwatch swTaskRequest;
ITAStopwatch swTaskAssign;
ITAStopwatch swConvolve;
ITAStopwatch swTaskAdd;
ITAStopWatch swTaskRequest;
ITAStopWatch swTaskAssign;
ITAStopWatch swConvolve;
ITAStopWatch swTaskAdd;
// Helfer
double dLastTaskRequest;
......@@ -269,8 +257,8 @@ public:
double dLastConvProcessing;
// Zeiten Scheduler
ITAStopwatch swTaskReturnDiscarded;
ITAStopwatch swTaskReturnFinished;
ITAStopWatch swTaskReturnDiscarded;
ITAStopWatch swTaskReturnFinished;
// Aktualisierungszhler
long unsigned int uiDiscardedTasks;
......@@ -574,16 +562,16 @@ ComplexSoundPath::ComplexSoundPath( double dSamplerate, int iBlocklength, int iR
m_bCurDopplerStatusEnabled = true;
// Filter allozieren
sfRIRDirectSoundPart.init( dSamplerate, 2, iRIRFilterLength, true );
sfRIREarlyReflectionsPart.init( dSamplerate, 2, iRIRFilterLength, true );
sfRIRDiffuseDecayPart.init( dSamplerate, 2, iRIRFilterLength, true );
sfRIRTemp.init( dSamplerate, 2, iRIRFilterLength, true );
sfRIRDirectSoundPart.init( 2, iRIRFilterLength, true );
sfRIREarlyReflectionsPart.init( 2, iRIRFilterLength, true );
sfRIRDiffuseDecayPart.init( 2, iRIRFilterLength, true );
sfRIRTemp.init( 2, iRIRFilterLength, true );
const int iHRIRFilterLength = 1024;
sfHRIR.init( dSamplerate, 2, iHRIRFilterLength, false );
sfHRIR.init( 2, iHRIRFilterLength, false );
const int iTOFilterLength = 256;
m_sbTO2IRFilter.init( dSamplerate, iTOFilterLength, false );
m_sbTO2IRFilter.Init( iTOFilterLength, false );
oMagsSumCur.Identity();
......@@ -695,7 +683,7 @@ void ComplexSoundPath::UpdateDirectSound( const bool bDirectSoundAudible )
if( bMagsChanged )
{
// HRIR mit TO-Filter falten
m_sbTO2IRFilter.zero();
m_sbTO2IRFilter.Zero();
//m_sbTO2IRFilter[0] = 1;
m_pRenderer->GenerateIRFromTOMags( oMagsSumNew, m_sbTO2IRFilter );
}
......@@ -804,7 +792,8 @@ void ComplexSoundPath::UpdateDiffuseDecay( const int iLeadingZeroOffset, const I
<< oProfiler.uiCyclesUpdateDD
<< " too high (" << FloatToString(fFilterEnergyMax, 2)
<< ")! Exporting filter." );
psfFilterPart->store( "ComplexSoundPath_corrupt_RT_filter.wav" );
writeAudiofile( "ComplexSoundPath_corrupt_RT_filter.wav", psfFilterPart, dSampleRate, ITAQuantization::ITA_FLOAT );
oProfiler.uiCyclesUpdateDD++;
......@@ -1008,7 +997,7 @@ void ComplexSoundPath::UpdateHRIR()
int iNewFilterLength = pHRIRData->GetProperties()->iFilterLength;
if( sfHRIR.length() != iNewFilterLength )
{
sfHRIR.init( sfHRIR.getSamplerate(), 2, iNewFilterLength, false );
sfHRIR.init( 2, iNewFilterLength, false );
}
// Neuen Filter holen
pHRIRData->GetHRIRByIndex( &sfHRIR, oHRIRStateNew.iRecord, oHRIRStateNew.fDistance );
......@@ -1070,8 +1059,7 @@ void ComplexSoundPath::GetUpdateRates( float& fDS, float& fER, float& fDD, const
void ComplexSoundPath::ExportRIR( const std::string& sFileName, const bool bDS/*=true*/, const bool bER/*=true*/, const bool bDD/*=true*/ ) const
{
int l = sfRIRDirectSoundPart.length();
double dSampleRate = sfRIRDirectSoundPart.getSamplerate();
ITASampleFrame sfExport( dSampleRate, 2, l, true );
ITASampleFrame sfExport( 2, l, true );
if( bDS )
{
......@@ -1286,7 +1274,7 @@ CVARoomAcousticsAudioRenderer::CVARoomAcousticsAudioRenderer(const CVAAudioRende
m_oRavenConfig.SetDefaults();
m_psbVDLTempOut.init( GetSamplerate(), GetBlocklength(), false );
m_psbVDLTempOut.Init( GetBlocklength(), false );
// Config
m_fSpeedOfSound = 340.0f;
......
......@@ -31,10 +31,10 @@
#include <VABaseDefinitions.h>
#include <VACore.h>
#include <VAObject.h>
#include <Filtering/VAThirdOctaveMagnitudes.h>
#include <Rendering/VAAudioRenderer.h>
#include <Rendering/VAAudioRendererRegistry.h>
#include <Scene/VAScene.h>
#include "../../../Filtering/VAThirdOctaveMagnitudes.h"
#include "../../VAAudioRenderer.h"
#include "../../VAAudioRendererRegistry.h"
#include "../../../Scene/VAScene.h"
#include <VAStruct.h>
// ITA includes
......@@ -49,8 +49,8 @@
#include <string.h>
// Raven includes
#include <VA/R_RavenLocalScheduler.h>
#include <VA/R_RavenUtils.h>
#include <R_RavenLocalScheduler.h>
#include <R_RavenUtils.h>
// 3rdParty includes
#include <tbb/concurrent_queue.h>
......@@ -226,9 +226,9 @@ private:
double m_dDirectSoundPowerCorrectionFactor; //!< Anpassung der Direktschallenergie vs. Nachhallfilter
ITAStopwatch m_swProcessStream; //!< Zeitmessung
ITAStopwatch m_swConvolveStream; //!< Zeitmessung
ITAStopwatch m_swUpdateFilter; //!< Zeitmessung
ITAStopWatch m_swProcessStream; //!< Zeitmessung
ITAStopWatch m_swConvolveStream; //!< Zeitmessung
ITAStopWatch m_swUpdateFilter; //!< Zeitmessung
unsigned int m_uiProcNum;
......
......@@ -6,13 +6,13 @@
#include "VARoomAcousticsScheduler.h"
// VA includes
#include <VACoreImpl.h>
#include <VALog.h>
#include <Utils/VADebug.h>
#include <Utils/VAUtils.h>
#include "../../../VACoreImpl.h"
#include "../../../VALog.h"
#include "../../../Utils/VADebug.h"
#include "../../../Utils/VAUtils.h"
// ITA includes
#include <ITAStopwatch.h>
#include <ITAStopWatch.h>
#include <ITAStringUtils.h>
#include <ITAException.h>
......
......@@ -28,8 +28,8 @@
#if (VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS==1)
#include <VA/R_Raven.h>
#include <VA/R_RavenLocalScheduler.h>
#include <R_Raven.h>
#include <R_RavenLocalScheduler.h>
// ITA includes
#include <ITASampleFrame.h>
......
......@@ -6,10 +6,10 @@
#include "VARoomAcousticsScheduler.h"
// VA includes
#include <VACoreImpl.h>
#include <VALog.h>
#include <Utils/VADebug.h>
#include <Utils/VAUtils.h>
#include "../../../VACoreImpl.h"
#include "../../../VALog.h"
#include "../../../Utils/VADebug.h"
#include "../../../Utils/VAUtils.h"
// ITA includes
#include <ITAStopwatch.h>
......
......@@ -26,7 +26,7 @@
#if (VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS==1)
#include <VA/R_RavenLocalScheduler.h>
#include <R_RavenLocalScheduler.h>
// ITA includes
#include <ITASampleFrame.h>
......
......@@ -6,10 +6,10 @@
#include "VARoomAcousticsScheduler.h"
// VA includes
#include <VACoreImpl.h>
#include <VALog.h>
#include <Utils/VADebug.h>
#include <Utils/VAUtils.h>
#include "../../../VACoreImpl.h"
#include "../../../VALog.h"
#include "../../../Utils/VADebug.h"
#include "../../../Utils/VAUtils.h"
// ITA includes
#include <ITAStopwatch.h>
......
......@@ -26,7 +26,7 @@
#if (VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS==1)
#include <VA/R_Raven.h>
#include <R_Raven.h>
// ITA includes
#include <ITASampleFrame.h>
......
......@@ -28,7 +28,7 @@
#include <VAObjectPool.h>
#include <VA/R_Raven.h>
#include <R_Raven.h>
#include <ITAASCIITable.h>
#include <ITAStringUtils.h>
......
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