Commit 375fccc2 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Temporary fixes in room acoustics renderer, out-of-room detection not working...

Temporary fixes in room acoustics renderer, out-of-room detection not working correctly. Could be RavenNet issue
parent 54a72bd5
......@@ -646,7 +646,7 @@ void ComplexSoundPath::UpdateDirectSound( const bool bDirectSoundAudible )
{
const double dSpeedOfSound = m_pRenderer->GetSpeedOfSound();
const double dSampleRate = m_pRenderer->GetSampleRate();
if( bDirectSoundAudible && pSource->pData )
{
// Neuen HRIR Datensatz in den Zwischenspeicher kopieren (sfHRIR)
......@@ -790,6 +790,14 @@ void ComplexSoundPath::UpdateDiffuseDecay( const int iLeadingZeroOffset, const I
float fFilterEnergy[ 2 ] = { 0, 0 };
for( int i = 0; i < iFilterPartLength; i++ )
{
if( std::isnan( ( *psfFilterPart )[ 0 ][ i ] ) || std::isnan( ( *psfFilterPart )[ 1 ][ i ] ) )
{
VA_WARN( "RoomAcousticsUpdateDiffuseDecay", "Received a filter that has NAN samples in diffuse decay part. Will refuse this update." );
oProfiler.uiCyclesUpdateDD++;
return;
}
fFilterEnergy[ 0 ] += pow( ( *psfFilterPart )[ 0 ][ i ], 2.0f );
fFilterEnergy[ 1 ] += pow( ( *psfFilterPart )[ 1 ][ i ], 2.0f );
}
......@@ -798,7 +806,7 @@ void ComplexSoundPath::UpdateDiffuseDecay( const int iLeadingZeroOffset, const I
fFilterEnergy[ 1 ] = sqrt( fFilterEnergy[ 1 ] );
float fFilterEnergyMax = max( fFilterEnergy[ 0 ], fFilterEnergy[ 1 ] );
float fFilterEnergyMaximum = 15;
float fFilterEnergyMaximum = 100;
if( fFilterEnergy[ 0 ] > fFilterEnergyMaximum || fFilterEnergy[ 1 ] > fFilterEnergyMaximum )
{
VA_WARN( "ComplexSoundPath", " SKIPPING diffuse decay filter update, energy of update #"
......@@ -809,7 +817,6 @@ void ComplexSoundPath::UpdateDiffuseDecay( const int iLeadingZeroOffset, const I
writeAudiofile( "ComplexSoundPath_corrupt_RT_filter.wav", psfFilterPart, dSampleRate, ITAQuantization::ITA_FLOAT );
oProfiler.uiCyclesUpdateDD++;
return;
}
......@@ -820,14 +827,13 @@ void ComplexSoundPath::UpdateDiffuseDecay( const int iLeadingZeroOffset, const I
oProfiler.uiCyclesUpdateDD++;
VA_VERBOSE( "ComplexSoundPath", "Diffuse Decay Update" );
VA_VERBOSE( "RoomAcousticsComplexSoundPath", "Diffuse Decay Update" );
return;
}
void ComplexSoundPath::ExchangeFilter()
{
oProfiler.uiCyclesUpdateTotal++;
// Assemble new BRIR
......@@ -892,21 +898,25 @@ void ComplexSoundPath::ExchangeFilter()
float* pfRIRDataCh0 = sfRIRTemp[ 0 ].data();
float* pfRIRDataCh1 = sfRIRTemp[ 1 ].data();
int iCount = ( std::min )( sfRIRTemp.length(), pRIRConvolverCh0->GetMaxFilterlength() );
pRIRFilterCh0->Load( pfRIRDataCh0, iCount );
pRIRFilterCh1->Load( pfRIRDataCh1, iCount );
pRIRConvolverCh0->ExchangeFilter( pRIRFilterCh0 );
pRIRConvolverCh1->ExchangeFilter( pRIRFilterCh1 );
pRIRConvolverCh0->ReleaseFilter( pRIRFilterCh0 );
pRIRConvolverCh1->ReleaseFilter( pRIRFilterCh1 );
bool bPathMuted = pSource->pData->bMuted || !bEntitiesInSameRoom;
bool bPathMuted = pSource->pData->bMuted || !bEntitiesInSameRoom && false;
if( bPathMuted )
VA_WARN( "RoomAcousticsFilterExchange", "Source is muted, or room acoustic simulation reports that entities are not in same room. Will mute them now." );
pRIRConvolverCh0->SetGain( bPathMuted ? 0.0f : 1.0f );
pRIRConvolverCh1->SetGain( bPathMuted ? 0.0f : 1.0f );
m_csRIRFilterAssemblyLock.leave();
return;
......@@ -2130,7 +2140,6 @@ int CVARoomAcousticsAudioRenderer::PreTaskStart( IRavenSimulationSchedulerInterf
int CVARoomAcousticsAudioRenderer::PostTaskFinished( IRavenSimulationSchedulerInterface* pScheduler, const CRavenSimulationTask* pTask, CRavenSimulationResult* pSimulationResult )
{
assert( pSimulationResult->vcspResult.size() == 1 ); // Exactly one result expected
CRavenSimulationResult::ComplexSimulationSoundPath* pResultSimulationPath = pSimulationResult->vcspResult[ 0 ];
const ITASampleFrame* psfResult = pResultSimulationPath->psfResult;
......@@ -2743,4 +2752,4 @@ CVAStruct CVARoomAcousticsAudioRenderer::CallObjectConfigGet( const std::string&
return oRet;
}
#endif // (VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS==1)
#endif // VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS
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