Adding signal source jet engine implementation and rudimentary RPM control via...

Adding signal source jet engine implementation and rudimentary RPM control via prototype interface call (SetParameters : rmp)
parent 940c26aa
......@@ -4,6 +4,9 @@
#include "../core/core.h"
#include "../VAAudiostreamTracker.h"
// ITADSP includes
#include <ITADSP/PD/JetEngine.h>
// STL includes
......@@ -11,11 +14,18 @@ CVAJetEngineSignalSource::CVAJetEngineSignalSource( const Config& oConf )
: m_pAssociatedCore(nullptr)
{
m_sbBuffer.Init( oConf.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize, true );
double dSampleRate = oConf.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
float fRPMInit = oConf.fRPMInit;
bool bColdStart = oConf.bColdStart;
m_pJetEngine = new ITADSP::PD::CJetEngine( dSampleRate, fRPMInit, bColdStart );
m_bHoldOn = oConf.bDelayedStart;
}
CVAJetEngineSignalSource::~CVAJetEngineSignalSource()
{
delete m_pJetEngine;
}
void CVAJetEngineSignalSource::HandleRegistration( IVAInterface* pParentCore )
......@@ -30,17 +40,28 @@ void CVAJetEngineSignalSource::HandleUnregistration( IVAInterface* pParentCore )
std::vector< const float* > CVAJetEngineSignalSource::GetStreamBlock( const CVAAudiostreamState* pStreamInfo )
{
m_sbBuffer.Zero();
if( !m_bHoldOn )
m_pJetEngine->Process( m_sbBuffer.GetData(), m_sbBuffer.GetLength() );
std::vector< const float* > vpfBuffer = { m_sbBuffer.GetData() };
return vpfBuffer;
}
CVAStruct CVAJetEngineSignalSource::GetParameters( const CVAStruct & ) const
{
return CVAStruct();
CVAStruct oRetVals;
return oRetVals;
}
void CVAJetEngineSignalSource::SetParameters( const CVAStruct& oIn )
{
if( oIn.HasKey( "rpm" ) )
{
double dRPM = oIn[ "rpm" ];
m_pJetEngine->SetRPM( (float) dRPM );
}
if( oIn.HasKey( "start" ) )
{
m_bHoldOn = false;
}
}
......@@ -10,6 +10,13 @@
#include <ITASampleBuffer.h>
class CVACoreImpl;
namespace ITADSP
{
namespace PD
{
class CJetEngine;
}
}
/**
* Jet engine signal source based on the
......@@ -21,8 +28,19 @@ public:
class Config
{
public:
std::map< double, double > lFreqModesSpectrum; //!< Mode spectrum [Hz], Amplitude
//std::map< double, double > lFreqModesSpectrum; //!< Mode spectrum [Hz], Amplitude
bool bColdStart;
float fRPMInit;
bool bDelayedStart;
CVACoreImpl* pCore;
inline Config()
: pCore( NULL )
{
bColdStart = true;
fRPMInit = 1000.0f;
bDelayedStart = false;
};
};
CVAJetEngineSignalSource( const Config& );
......@@ -42,6 +60,9 @@ private:
IVAInterface* m_pAssociatedCore;
ITASampleBuffer m_sbBuffer;
ITADSP::PD::CJetEngine *m_pJetEngine;
bool m_bHoldOn; //!< Used to delay start
void HandleRegistration( IVAInterface* pParentCore );
void HandleUnregistration( IVAInterface* pParentCore );
};
......
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