Adding signal source prototype from parameters creation implementation

parent d3360879
#include "VAJetEngineSignalSource.h"
// VA includes
#include <VACore.h>
#include "../core/core.h"
#include "../VAAudiostreamTracker.h"
// STL includes
......@@ -10,7 +10,7 @@
CVAJetEngineSignalSource::CVAJetEngineSignalSource( const Config& oConf )
: m_pAssociatedCore(nullptr)
{
m_sbBuffer.Init( oConf.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize, true );
}
CVAJetEngineSignalSource::~CVAJetEngineSignalSource()
......@@ -32,7 +32,7 @@ std::vector< const float* > CVAJetEngineSignalSource::GetStreamBlock( const CVAA
{
m_sbBuffer.Zero();
std::vector< const float* > vpfBuffer = { m_sbBuffer.GetData() };
return vpfBuffer;
return vpfBuffer;
}
CVAStruct CVAJetEngineSignalSource::GetParameters( const CVAStruct & ) const
......
......@@ -280,7 +280,7 @@ public:
std::string CreateSignalSourceNetworkStream( const std::string& sInterface, const int iPort, const std::string& sName = "" );
std::string CreateSignalSourceEngine( const CVAStruct& oParams, const std::string& sName = "" );
std::string CreateSignalSourceMachine( const CVAStruct& oParams, const std::string& sName = "" );
std::string CreateSignalSourceJetEngine( const CVAStruct& oParams, const std::string& sName = "" );
std::string CreateSignalSourcePrototypeFromParameters( const CVAStruct& oParams, const std::string& sName = "" );
bool DeleteSignalSource( const std::string& sID );
std::string RegisterSignalSource( IVAAudioSignalSource* pSignalSource, const std::string& sName = "" );
bool UnregisterSignalSource( IVAAudioSignalSource* pSignalSource );
......
......@@ -177,14 +177,36 @@ std::string CVACoreImpl::CreateSignalSourceMachine( const CVAStruct&, const std:
}
std::string CVACoreImpl::CreateSignalSourceJetEngine( const CVAStruct& oParams, const std::string& sName/*="" */ )
std::string CVACoreImpl::CreateSignalSourcePrototypeFromParameters( const CVAStruct& oParams, const std::string& sName/*="" */ )
{
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
std::string sID = m_pSignalSourceManager->CreateJetEngineSignalSource( sName, oParams );
if( !oParams.HasKey( "class" ) )
{
VA_EXCEPT2( INVALID_PARAMETER, "Key 'class' missing, could not create the prototype signal source from given parameters" );
}
if( !oParams.GetValue( "class" )->IsString() )
{
VA_EXCEPT2( INVALID_PARAMETER, "Key 'class' is not a string, could not create the prototype signal source from given parameters" );
}
std::string sID;
std::string sPrototypeClass = oParams[ "class" ];
if( sPrototypeClass == "jet_engine" )
{
sID = m_pSignalSourceManager->CreateJetEngineSignalSource( sName, oParams );
}
else if( sPrototypeClass == "car_engine" )
{
VA_EXCEPT2( NOT_IMPLEMENTED, "The required prototype class '" + sPrototypeClass + "' is not implemented, yet" );
}
else
{
VA_EXCEPT2( NOT_IMPLEMENTED, "The required prototype class '" + sPrototypeClass + "' is not recognized by this core version" );
}
CVAEvent ev;
ev.iEventType = CVAEvent::SIGNALSOURCE_CREATED;
......@@ -192,7 +214,7 @@ std::string CVACoreImpl::CreateSignalSourceJetEngine( const CVAStruct& oParams,
ev.sObjectID = sID;
m_pEventManager->BroadcastEvent( ev );
VA_INFO( "Core", "Created jet engine signal source (ID=" << sID << ", Name=\"" << sName << "\")" );
VA_INFO( "Core", "Created prototype signal source (ID=" << sID << ", Name=\"" << sName << "\")" );
return sID;
}
......@@ -200,7 +222,6 @@ std::string CVACoreImpl::CreateSignalSourceJetEngine( const CVAStruct& oParams,
}
bool CVACoreImpl::DeleteSignalSource( const std::string& sID )
{
VA_NO_REENTRANCE;
......
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