From 91cbae2196a3fcbaa60790e401d0a2be1bf16b9a Mon Sep 17 00:00:00 2001 From: "Dipl.-Ing. Jonas Stienen" Date: Wed, 17 Oct 2018 16:33:33 +0200 Subject: [PATCH] WIP --- .../VABinauralFreeFieldAudioRenderer.cpp | 6 +- src/core/core.cpp | 192 ++++++++++-------- 2 files changed, 104 insertions(+), 94 deletions(-) diff --git a/src/Rendering/Binaural/FreeField/VABinauralFreeFieldAudioRenderer.cpp b/src/Rendering/Binaural/FreeField/VABinauralFreeFieldAudioRenderer.cpp index 260ee23..8b8b7ea 100644 --- a/src/Rendering/Binaural/FreeField/VABinauralFreeFieldAudioRenderer.cpp +++ b/src/Rendering/Binaural/FreeField/VABinauralFreeFieldAudioRenderer.cpp @@ -1094,8 +1094,6 @@ void CVABinauralFreeFieldAudioRenderer::ResetInternalData() void CVABinauralFreeFieldAudioRenderer::UpdateSoundPaths() { - const int iGlobalAuralisationMode = m_iCurGlobalAuralizationMode; - // Check for new data std::list< CVABFFSoundPath* >::iterator it = m_lSoundPaths.begin(); while( it != m_lSoundPaths.end() ) @@ -1483,7 +1481,7 @@ CVAStruct CVABinauralFreeFieldAudioRenderer::CallObject( const CVAStruct& oArgs CVAConfigInterpreter oConfig( oArgs ); std::string sCommandOrg; - oConfig.ReqNonEmptyString( "Command", sCommandOrg ); + oConfig.OptString( "Command", sCommandOrg ); std::string sCommand = toUppercase( sCommandOrg ); // Command resolution @@ -1502,7 +1500,7 @@ CVAStruct CVABinauralFreeFieldAudioRenderer::CallObject( const CVAStruct& oArgs return oReturn; } - VA_EXCEPT2( INVALID_PARAMETER, "Invalid command (\"" + sCommandOrg + "\")" ); + return oReturn; } void CVABinauralFreeFieldAudioRenderer::SetParameters( const CVAStruct& oParams ) diff --git a/src/core/core.cpp b/src/core/core.cpp index f145d38..5c851e0 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -575,7 +575,7 @@ void CVACoreImpl::GetModules( std::vector< CVAModuleInfo >& viModuleInfos ) cons VA_PRINT( "'" << v[ i ].sName << "'\t\t\t" << v[ i ].sDesc ); viModuleInfos[ i ].sName = v[ i ].sName; viModuleInfos[ i ].sDesc = v[ i ].sDesc; - } + } } VA_RETHROW; @@ -1368,7 +1368,8 @@ int CVACoreImpl::CreateSoundSource( const std::string& sName ) VA_TRY { - if( ( VACORE_MAX_NUM_SOUND_SOURCES != 0 ) && m_pNewSceneState ) + int iNumSoundSource = VACORE_MAX_NUM_SOUND_SOURCES; + if( ( iNumSoundSource != 0 ) && m_pNewSceneState ) { int iSourcesRemain = VACORE_MAX_NUM_SOUND_SOURCES - m_pNewSceneState->GetNumSoundSources(); if( iSourcesRemain <= 0 ) @@ -1430,7 +1431,8 @@ int CVACoreImpl::CreateSoundSourceExplicitRenderer( const std::string& sRenderer VA_TRY { - if( ( VACORE_MAX_NUM_SOUND_SOURCES != 0 ) && m_pNewSceneState ) + int iNumSoundSource = VACORE_MAX_NUM_SOUND_SOURCES; + if( ( iNumSoundSource != 0 ) && m_pNewSceneState ) { int iSourcesRemain = VACORE_MAX_NUM_SOUND_SOURCES - m_pNewSceneState->GetNumSoundSources(); if( iSourcesRemain <= 0 ) @@ -2203,7 +2205,8 @@ int CVACoreImpl::CreateSoundReceiver( const std::string& sName ) VA_TRY { - if( ( VACORE_MAX_NUM_SOUND_RECEIVERS != 0 ) && m_pNewSceneState ) + int iNumSoundReceivers = VACORE_MAX_NUM_SOUND_RECEIVERS; + if( ( iNumSoundReceivers != 0 ) && m_pNewSceneState ) { const int iListenersRemain = VACORE_MAX_NUM_SOUND_RECEIVERS - m_pNewSceneState->GetNumListeners(); if( iListenersRemain <= 0 ) @@ -2317,7 +2320,8 @@ int CVACoreImpl::CreateSoundReceiverExplicitRenderer( const std::string& sRender VA_TRY { - if( ( VACORE_MAX_NUM_SOUND_RECEIVERS != 0 ) && m_pNewSceneState ) + int iNumSoundReceivers = VACORE_MAX_NUM_SOUND_RECEIVERS; + if( ( iNumSoundReceivers != 0 ) && m_pNewSceneState ) { int iListenersRemain = VACORE_MAX_NUM_SOUND_RECEIVERS - m_pNewSceneState->GetNumListeners(); if( iListenersRemain <= 0 ) @@ -4237,7 +4241,7 @@ void CVACoreImpl::InitializeReproductionModules() if( oFile.Exists() ) VA_INFO( "Core", "Reproduction input record file '" << oFile.GetName() << "' exists, will overwrite" ); - + oDesc.pInputRecorder = new ITAStreamProbe( pInputTail, oFile.GetName() ); pInputTail = oDesc.pInputRecorder; VA_TRACE( "Core", "Reproduction will record input to file '" << oFile.GetName() << "'" ); @@ -4260,7 +4264,7 @@ void CVACoreImpl::InitializeReproductionModules() if( oFile.Exists() ) VA_INFO( "Core", "Reproduction output record file '" << oFile.GetName() << "' exists, will overwrite" ); - + oDesc.pOutputRecorder = new ITAStreamProbe( pOutputTail, oFile.GetName() ); pOutputTail = oDesc.pOutputRecorder; VA_TRACE( "Core", "Reproduction will record output to file '" << oFile.GetName() << "'" ); @@ -4626,8 +4630,8 @@ void CVACoreImpl::SendRenderingModuleOutputDetectorsUpdateEvents() } m_pEventManager->BroadcastEvent( ev ); - } } +} void CVACoreImpl::SendReproductionModuleOIDetectorsUpdateEvents() { @@ -4800,7 +4804,7 @@ CVAStruct CVACoreImpl::CallObject( const CVAStruct& oArgs ) { VistaFileSystemFile oFile( m_oCoreConfig.sRecordDeviceInputFileName ); VistaFileSystemDirectory oFolder( m_oCoreConfig.sRecordDeviceInputBaseFolder ); - + VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); VA_INFO( "Core", "Updating record device input file path to " << oFilePath.GetName() ); @@ -5036,76 +5040,81 @@ void CVACoreImpl::SetReproductionModuleParameters( const std::string& sModuleID, if( oParams.HasKey( "RecordInputEnabled" ) ) VA_EXCEPT2( INVALID_PARAMETER, "Recording has to be enabled before streaming is active" ); - VistaFileSystemFile oFilePath( oRep.pInputRecorder->GetFilePath() ); - std::string sFileName = oFilePath.GetLocalName(); - std::string sBaseFolder = oFilePath.GetParentDirectory(); - - bool bUpdateRecordInputPath = false; - if( oParams.HasKey( "RecordInputFileName" ) ) - { - sFileName = oParams[ "RecordInputFileName" ]; - bUpdateRecordInputPath = true; - } - if( oParams.HasKey( "RecordInputBaseFolder" ) ) + if( oRep.pInputRecorder ) { - sBaseFolder = oParams[ "RecordInputBaseFolder" ]; - bUpdateRecordInputPath = true; - } + VistaFileSystemFile oFilePath( oRep.pInputRecorder->GetFilePath() ); + std::string sFileName = oFilePath.GetLocalName(); + std::string sBaseFolder = oFilePath.GetParentDirectory(); - if( bUpdateRecordInputPath ) - { - VistaFileSystemFile oFile( sFileName ); - VistaFileSystemDirectory oFolder( sBaseFolder ); + bool bUpdateRecordInputPath = false; + if( oParams.HasKey( "RecordInputFileName" ) ) + { + sFileName = oParams[ "RecordInputFileName" ]; + bUpdateRecordInputPath = true; + } + if( oParams.HasKey( "RecordInputBaseFolder" ) ) + { + sBaseFolder = oParams[ "RecordInputBaseFolder" ]; + bUpdateRecordInputPath = true; + } - VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); - VA_INFO( "Core", "Updating reproduction input recording file path to " << oFilePath.GetName() ); + if( bUpdateRecordInputPath ) + { + VistaFileSystemFile oFile( sFileName ); + VistaFileSystemDirectory oFolder( sBaseFolder ); - if( oFilePath.Exists() ) - VA_INFO( "Core", "Record reproduction input recording file path exists, will overwrite" ); + VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); + VA_INFO( "Core", "Updating reproduction input recording file path to " << oFilePath.GetName() ); - if( !oFolder.Exists() ) - if( !oFolder.CreateWithParentDirectories() ) - VA_EXCEPT2( INVALID_PARAMETER, "Could not create reproduction input recording directory " + oFolder.GetName() ); + if( oFilePath.Exists() ) + VA_INFO( "Core", "Record reproduction input recording file path exists, will overwrite" ); - oRep.pInputRecorder->SetFilePath( oFilePath.GetName() ); - } + if( !oFolder.Exists() ) + if( !oFolder.CreateWithParentDirectories() ) + VA_EXCEPT2( INVALID_PARAMETER, "Could not create reproduction input recording directory " + oFolder.GetName() ); + oRep.pInputRecorder->SetFilePath( oFilePath.GetName() ); + } + } if( oParams.HasKey( "RecordOutputEnabled" ) ) VA_EXCEPT2( INVALID_PARAMETER, "Recording has to be enabled before streaming is active" ); - oFilePath.SetName( oRep.pOutputRecorder->GetFilePath() ); - sFileName = oFilePath.GetLocalName(); - sBaseFolder = oFilePath.GetParentDirectory(); - - bool bUpdateRecordOutputPath = false; - if( oParams.HasKey( "RecordOutputFileName" ) ) - { - sFileName = oParams[ "RecordOutputFileName" ]; - bUpdateRecordOutputPath = true; - } - if( oParams.HasKey( "RecordOutputBaseFolder" ) ) + if( oRep.pOutputRecorder ) { - sBaseFolder = oParams[ "RecordOutputBaseFolder" ]; - bUpdateRecordOutputPath = true; - } + VistaFileSystemFile oFilePath( oRep.pOutputRecorder->GetFilePath() ); + std::string sFileName = oFilePath.GetLocalName(); + std::string sBaseFolder = oFilePath.GetParentDirectory(); - if( bUpdateRecordOutputPath ) - { - VistaFileSystemFile oFile( sFileName ); - VistaFileSystemDirectory oFolder( sBaseFolder ); + bool bUpdateRecordOutputPath = false; + if( oParams.HasKey( "RecordOutputFileName" ) ) + { + sFileName = oParams[ "RecordOutputFileName" ]; + bUpdateRecordOutputPath = true; + } + if( oParams.HasKey( "RecordOutputBaseFolder" ) ) + { + sBaseFolder = oParams[ "RecordOutputBaseFolder" ]; + bUpdateRecordOutputPath = true; + } - VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); - VA_INFO( "Core", "Updating reproduction output recording file path to " << oFilePath.GetName() ); + if( bUpdateRecordOutputPath ) + { + VistaFileSystemFile oFile( sFileName ); + VistaFileSystemDirectory oFolder( sBaseFolder ); + + VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); + VA_INFO( "Core", "Updating reproduction output recording file path to " << oFilePath.GetName() ); - if( oFilePath.Exists() ) - VA_INFO( "Core", "Record reproduction output recording file path exists, will overwrite" ); + if( oFilePath.Exists() ) + VA_INFO( "Core", "Record reproduction output recording file path exists, will overwrite" ); - if( !oFolder.Exists() ) - if( !oFolder.CreateWithParentDirectories() ) - VA_EXCEPT2( INVALID_PARAMETER, "Could not create reproduction output recording directory " + oFolder.GetName() ); + if( !oFolder.Exists() ) + if( !oFolder.CreateWithParentDirectories() ) + VA_EXCEPT2( INVALID_PARAMETER, "Could not create reproduction output recording directory " + oFolder.GetName() ); - oRep.pOutputRecorder->SetFilePath( oFilePath.GetName() ); + oRep.pOutputRecorder->SetFilePath( oFilePath.GetName() ); + } } // Propagate parameters @@ -5163,43 +5172,46 @@ void CVACoreImpl::SetRenderingModuleParameters( const std::string& sModuleID, co if( oParams.HasKey( "RecordOutputEnabled" ) ) VA_EXCEPT2( INVALID_PARAMETER, "Recording has to be enabled before streaming is active" ); - VistaFileSystemFile oFilePath( oRend.pOutputRecorder->GetFilePath() ); - std::string sFileName = oFilePath.GetLocalName(); - std::string sBaseFolder = oFilePath.GetParentDirectory(); - - bool bUpdateRecordOutputPath = false; - if( oParams.HasKey( "RecordOutputFileName" ) ) - { - sFileName = oParams[ "RecordOutputFileName" ]; - bUpdateRecordOutputPath = true; - } - if( oParams.HasKey( "RecordOutputBaseFolder" ) ) + if( oRend.pOutputRecorder ) // If enabled ... { - sBaseFolder = oParams[ "RecordOutputBaseFolder" ]; - bUpdateRecordOutputPath = true; - } + VistaFileSystemFile oFilePath( oRend.pOutputRecorder->GetFilePath() ); + std::string sFileName = oFilePath.GetLocalName(); + std::string sBaseFolder = oFilePath.GetParentDirectory(); - if( bUpdateRecordOutputPath ) - { - VistaFileSystemFile oFile( sFileName ); - VistaFileSystemDirectory oFolder( sBaseFolder ); + bool bUpdateRecordOutputPath = false; + if( oParams.HasKey( "RecordOutputFileName" ) ) + { + sFileName = oParams[ "RecordOutputFileName" ]; + bUpdateRecordOutputPath = true; + } + if( oParams.HasKey( "RecordOutputBaseFolder" ) ) + { + sBaseFolder = oParams[ "RecordOutputBaseFolder" ]; + bUpdateRecordOutputPath = true; + } - VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); - VA_INFO( "Core", "Updating rendering output recording file path to " << oFilePath.GetName() ); + if( bUpdateRecordOutputPath ) + { + VistaFileSystemFile oFile( sFileName ); + VistaFileSystemDirectory oFolder( sBaseFolder ); + + VistaFileSystemFile oFilePath( oFolder.GetName() + "/" + oFile.GetLocalName() ); + VA_INFO( "Core", "Updating rendering output recording file path to " << oFilePath.GetName() ); - if( oFilePath.Exists() ) - VA_INFO( "Core", "Record rendering output recording file path exists, will overwrite" ); + if( oFilePath.Exists() ) + VA_INFO( "Core", "Record rendering output recording file path exists, will overwrite" ); - if( !oFolder.Exists() ) - if( !oFolder.CreateWithParentDirectories() ) - VA_EXCEPT2( INVALID_PARAMETER, "Could not create rendering output recording directory " + oFolder.GetName() ); + if( !oFolder.Exists() ) + if( !oFolder.CreateWithParentDirectories() ) + VA_EXCEPT2( INVALID_PARAMETER, "Could not create rendering output recording directory " + oFolder.GetName() ); - oRend.pOutputRecorder->SetFilePath( oFilePath.GetName() ); + oRend.pOutputRecorder->SetFilePath( oFilePath.GetName() ); + } } - + // Propagate parameters oRend.pInstance->SetParameters( oParams ); - + return; } } -- GitLab