Adding feature to give a base folder an a file name for recording of rendering...

Adding feature to give a base folder an a file name for recording of rendering and reproduction streams. Both parameters will be made modifiable during runtime in the future.
parent 172ff723
......@@ -37,7 +37,8 @@ public:
const CVAStruct* pConfig; //!< Renderer configuration
std::vector< std::string > vsReproductions; //!< Renderer outputs (e.g. Output:HP, Reproduction:CTC4)
bool bRecordOutputEnabled; //!< Renderer output recording and storing flag
std::string sRecordOutputFilePath; //!< Renderer output recording and storing file path
std::string sRecordOutputFileName; //!< Renderer output recording and storing file (base) name
std::string sRecordOutputBaseFolder; //!< Renderer output recording and storing folder name (absolute or relative, will be created if non-existent)
bool bOutputLevelMeterEnabled; //!< Renderer output level meter will be used (uses a little bit CPU resources)
bool bOfflineRendering; //!< Offline rendering indicator (using a virtual audio device and external trigger)
};
......
......@@ -36,8 +36,10 @@ public:
bool bOutputDetectorEnabled;
bool bRecordInputEnabled;
bool bRecordOutputEnabled;
std::string sRecordInputInputFilePath;
std::string sRecordOutputInputFilePath;
std::string sRecordInputFileName;
std::string sRecordInputBaseFolder;
std::string sRecordOutputFileName;
std::string sRecordOutputBaseFolder;
};
/**
......
......@@ -203,7 +203,7 @@ CVAStruct VACore::LoadCoreConfigFromFile( const std::string& sConfigFilePath )
VistaFileSystemFile oConfigFile( sConfigFilePath );
std::list< VistaFileSystemFile > voConfigFiles;
std::vector< VistaFileSystemDirectory > voIncludePaths;
if( oConfigFile.Exists() && oConfigFile.GetParentDirectory().empty() == false )
voIncludePaths.push_back( oConfigFile.GetParentDirectory() );
......@@ -2055,7 +2055,7 @@ int CVACoreImpl::DeleteSoundSource( const int iSoundSourceID )
return 0;
}
VA_FINALLY
VA_FINALLY
{
if( !bSync )
UnlockUpdate();
......@@ -4471,14 +4471,65 @@ void CVACoreImpl::InitializeAudioRenderers()
conf.OptBool( "OutputDetectorEnabled", oParams.bOutputLevelMeterEnabled, false );
// Set up rendering output recording
conf.OptBool( "RecordOutputEnabled", oParams.bRecordOutputEnabled, false );
if( oParams.bRecordOutputEnabled )
{
std::string sFilePathRAW;
conf.ReqString( "RecordOutputFilePath", sFilePathRAW );
oParams.sRecordOutputFilePath = m_oCoreConfig.mMacros.SubstituteMacros( sFilePathRAW );
VistaFileSystemFile oRecordOutputFile( "renderer.wav" );
VistaFileSystemDirectory oRecordOutputBaseFolder( "./" );
std::string sFilePathRAWDeprecated;
conf.OptString( "RecordOutputFilePath", sFilePathRAWDeprecated );
if( !sFilePathRAWDeprecated.empty() )
{
VA_WARN( "Core", "The renderer configuration key 'RecordOutputFilePath' is deprecated. Use 'RecordOutputBaseFolder' (optional) and 'RecordOutputFileName' instead." );
std::string sDummy;
if( conf.OptString( "RecordOutputBaseFolder", sDummy ) || conf.OptString( "RecordOutputFileName", sDummy ) )
VA_EXCEPT2( INVALID_PARAMETER, "You have combined old rendering configuration key 'RecordOutputFilePath' with one of the new keys 'RecordOutputBaseFolder' (optional) or 'RecordOutputFileName'. Please use new key only." );
std::string sRecordOutputFilePath = m_oCoreConfig.mMacros.SubstituteMacros( sFilePathRAWDeprecated );
oRecordOutputFile.SetName( sRecordOutputFilePath );
oRecordOutputBaseFolder.SetName( oRecordOutputFile.GetParentDirectory() );
}
else
{
std::string sFileNameRAW;
conf.ReqString( "RecordOutputFileName", sFileNameRAW );
std::string sFileName = m_oCoreConfig.mMacros.SubstituteMacros( sFileNameRAW );
oRecordOutputFile.SetName( sFileName );
std::string sBaseFolderRAW;
conf.ReqString( "RecordOutputBaseFolder", sBaseFolderRAW );
std::string sBaseFolder = m_oCoreConfig.mMacros.SubstituteMacros( sBaseFolderRAW );
oRecordOutputBaseFolder.SetName( sBaseFolder );
}
if( !oRecordOutputBaseFolder.Exists() )
{
if( oRecordOutputBaseFolder.CreateWithParentDirectories() )
{
VA_INFO( "Core", "Created renderer record output base folder " << oRecordOutputBaseFolder.GetName() << " with parent directories" );
}
else
{
VA_EXCEPT2( INVALID_PARAMETER, "Could not create non-existent renderer record base folder '" + oRecordOutputBaseFolder.GetName() + "'" );
}
}
if( oRecordOutputFile.Exists() )
{
VA_INFO( "Core", "Rendering record file '" << oRecordOutputFile.GetName() << "' exists, will overwrite" );
}
oParams.sRecordOutputFileName = oRecordOutputFile.GetLocalName();
oParams.sRecordOutputBaseFolder = oRecordOutputFile.GetParentDirectory();
}
// Get factory method to create requested rendering module (if available from registry)
IVAAudioRendererFactory* pFactory = pRegistry->FindFactory( sClass );
if( !pFactory )
......@@ -4495,8 +4546,11 @@ void CVACoreImpl::InitializeAudioRenderers()
ITADatasource* pRendererOutputTail = pRenderer->GetOutputDatasource();;
if( oParams.bRecordOutputEnabled )
{
oRendererDesc.pOutputRecorder = new ITAStreamProbe( pRendererOutputTail, oParams.sRecordOutputFilePath );
std::string sFilePath = oParams.sRecordOutputBaseFolder + "/" + oParams.sRecordOutputFileName;
VistaFileSystemFile oFile( sFilePath );
oRendererDesc.pOutputRecorder = new ITAStreamProbe( pRendererOutputTail, oFile.GetName() );
pRendererOutputTail = oRendererDesc.pOutputRecorder;
VA_TRACE( "Core", "Rendering module will record output to file '" << oFile.GetName() << "'" );
}
if( oParams.bOutputLevelMeterEnabled )
......@@ -4587,22 +4641,125 @@ void CVACoreImpl::InitializeReproductionModules()
conf.OptBool( "InputDetectorEnabled", oParams.bInputDetectorEnabled, false );
conf.OptBool( "OutputDetectorEnabled", oParams.bOutputDetectorEnabled, false );
// Set up reproduction output recording
conf.OptBool( "RecordInputEnabled", oParams.bRecordInputEnabled, false );
if( oParams.bRecordInputEnabled )
{
std::string sFilePathRAW;
conf.ReqString( "RecordInputFilePath", sFilePathRAW );
oParams.sRecordInputInputFilePath = m_oCoreConfig.mMacros.SubstituteMacros( sFilePathRAW );
VistaFileSystemFile oRecordInputFile( "reproduction.wav" );
VistaFileSystemDirectory oRecordInputFolder( "./" );
std::string sFilePathRAWDeprecated;
conf.OptString( "RecordInputFilePath", sFilePathRAWDeprecated );
if( !sFilePathRAWDeprecated.empty() )
{
VA_WARN( "Core", "The reproduction configuration key 'RecordInputFilePath' is deprecated. Use 'RecordInputBaseFolder' (optional) and 'RecordInputFileName' instead." );
std::string sDummy;
if( conf.OptString( "RecordInputBaseFolder", sDummy ) || conf.OptString( "RecordInputFileName", sDummy ) )
VA_EXCEPT2( INVALID_PARAMETER, "You have combined old reproduction configuration key 'RecordInputFilePath' with one of the new keys 'RecordInputBaseFolder' (optional) or 'RecordInputFileName'. Please use new key only." );
std::string sRecordInputFilePath = m_oCoreConfig.mMacros.SubstituteMacros( sFilePathRAWDeprecated );
oRecordInputFile.SetName( sRecordInputFilePath );
oRecordInputFolder.SetName( oRecordInputFile.GetParentDirectory() );
}
else
{
std::string sFileNameRAW;
conf.ReqString( "RecordInputFileName", sFileNameRAW );
std::string sFileName = m_oCoreConfig.mMacros.SubstituteMacros( sFileNameRAW );
oRecordInputFile.SetName( sFileName );
std::string sBaseFolderRAW;
conf.ReqString( "RecordInputBaseFolder", sBaseFolderRAW );
std::string sBaseFolder = m_oCoreConfig.mMacros.SubstituteMacros( sBaseFolderRAW );
oRecordInputFolder.SetName( sBaseFolder );
}
if( !oRecordInputFolder.Exists() )
{
if( oRecordInputFolder.CreateWithParentDirectories() )
{
VA_INFO( "Core", "Created reproduction input record base folder " << oRecordInputFolder.GetName() << " with parent directories" );
}
else
{
VA_EXCEPT2( INVALID_PARAMETER, "Could not create non-existent reproduction input record base folder '" + oRecordInputFolder.GetName() + "'" );
}
}
if( oRecordInputFile.Exists() )
{
VA_INFO( "Core", "Reproduction input record file '" << oRecordInputFile.GetName() << "' exists, will overwrite" );
}
oParams.sRecordInputFileName = oRecordInputFile.GetLocalName();
oParams.sRecordInputBaseFolder = oRecordInputFile.GetParentDirectory();
}
// Set up reproduction output recording
conf.OptBool( "RecordOutputEnabled", oParams.bRecordOutputEnabled, false );
if( oParams.bRecordOutputEnabled )
{
std::string sFilePathRAW;
conf.ReqString( "RecordOutputFilePath", sFilePathRAW );
oParams.sRecordOutputInputFilePath = m_oCoreConfig.mMacros.SubstituteMacros( sFilePathRAW );
VistaFileSystemFile oRecordOutputFile( "reproduction.wav" );
VistaFileSystemDirectory oRecordOutputFolder( "./" );
std::string sFilePathRAWDeprecated;
conf.OptString( "RecordOutputFilePath", sFilePathRAWDeprecated );
if( !sFilePathRAWDeprecated.empty() )
{
VA_WARN( "Core", "The reproduction configuration key 'RecordOutputFilePath' is deprecated. Use 'RecordOutputBaseFolder' (optional) and 'RecordOutputFileName' instead." );
std::string sDummy;
if( conf.OptString( "RecordOutputBaseFolder", sDummy ) || conf.OptString( "RecordOutputFileName", sDummy ) )
VA_EXCEPT2( INVALID_PARAMETER, "You have combined old reproduction configuration key 'RecordOutputFilePath' with one of the new keys 'RecordOutputBaseFolder' (optional) or 'RecordOutputFileName'. Please use new key only." );
std::string sRecordOutputFilePath = m_oCoreConfig.mMacros.SubstituteMacros( sFilePathRAWDeprecated );
oRecordOutputFile.SetName( sRecordOutputFilePath );
oRecordOutputFolder.SetName( oRecordOutputFile.GetParentDirectory() );
}
else
{
std::string sFileNameRAW;
conf.ReqString( "RecordOutputFileName", sFileNameRAW );
std::string sFileName = m_oCoreConfig.mMacros.SubstituteMacros( sFileNameRAW );
oRecordOutputFile.SetName( sFileName );
std::string sBaseFolderRAW;
conf.ReqString( "RecordOutputBaseFolder", sBaseFolderRAW );
std::string sBaseFolder = m_oCoreConfig.mMacros.SubstituteMacros( sBaseFolderRAW );
oRecordOutputFolder.SetName( sBaseFolder );
}
if( !oRecordOutputFolder.Exists() )
{
if( oRecordOutputFolder.CreateWithParentDirectories() )
{
VA_INFO( "Core", "Created reproduction output record base folder " << oRecordOutputFolder.GetName() << " with parent directories" );
}
else
{
VA_EXCEPT2( INVALID_PARAMETER, "Could not create non-existent reproduction output record base folder '" + oRecordOutputFolder.GetName() + "'" );
}
}
if( oRecordOutputFile.Exists() )
{
VA_INFO( "Core", "Reproduction output record file '" << oRecordOutputFile.GetName() << "' exists, will overwrite" );
}
oParams.sRecordOutputFileName = oRecordOutputFile.GetLocalName();
oParams.sRecordOutputBaseFolder = oRecordOutputFile.GetParentDirectory();
}
// Parse outputs
std::vector< std::string > vsOutputs;
conf.ReqStringListRegex( "Outputs", vsOutputs, "\\s*,\\s*" );
......@@ -4644,8 +4801,11 @@ void CVACoreImpl::InitializeReproductionModules()
}
if( oParams.bRecordInputEnabled )
{
oDesc.pInputRecorder = new ITAStreamProbe( pInputTail, oParams.sRecordInputInputFilePath );
std::string sFilePath = oParams.sRecordInputBaseFolder + "/" + oParams.sRecordInputFileName;
VistaFileSystemFile oFile( sFilePath );
oDesc.pInputRecorder = new ITAStreamProbe( pInputTail, oFile.GetName() );
pInputTail = oDesc.pInputRecorder;
VA_TRACE( "Core", "Reproduction will record input to file '" << oFile.GetName() << "'" );
}
// Assign Renderer-to-Reproduction patch bay output datasource as input for reproduction module
......@@ -4660,8 +4820,11 @@ void CVACoreImpl::InitializeReproductionModules()
}
if( oParams.bRecordOutputEnabled )
{
oDesc.pOutputRecorder = new ITAStreamProbe( pOutputTail, oParams.sRecordOutputInputFilePath );
std::string sFilePath = oParams.sRecordOutputBaseFolder + "/" + oParams.sRecordOutputFileName;
VistaFileSystemFile oFile( sFilePath );
oDesc.pOutputRecorder = new ITAStreamProbe( pOutputTail, oFile.GetName() );
pOutputTail = oDesc.pOutputRecorder;
VA_TRACE( "Core", "Reproduction will record output to file '" << oFile.GetName() << "'" );
}
// Add input in output patch bay and assign reproduction module datasource output to this input
......@@ -5167,7 +5330,7 @@ CVAStruct CVACoreImpl::CallObject( const CVAStruct& oArgs )
if( GetCoreConfig()->bRemoteShutdownAllowed )
{
VA_TRACE( "Core", "Accepting remote shutdown request, will broadcast shutdown event" );
CVAEvent ev;
ev.pSender = this;
ev.iEventType = CVAEvent::SHOTDOWN_REQUEST;
......
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