Restructuring FilterEngine

parent e51635c5
......@@ -47,7 +47,7 @@
using namespace std;
using namespace ITAPropagationModels;
float g_fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F;
float g_fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F;
float g_fSampleRate = 44.1e3;
int g_iFilterLength = 64;
......
......@@ -21,7 +21,12 @@
namespace ITAPropagationModels
{
enum DiffractionModels
{
MAEKAWA_DETOUR_LAW = 1,
UNIFORM_THEORY_OF_DIFFRACTION,
BIOT_TOLSTOY_MEDWIN_SVENSSON,
};
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_BASE
......@@ -25,7 +25,8 @@
// ITA includes
#include <ITAGeo/Base.h>
#include <ITAGeo/Material//Manager.h>
#include <ITAGeo/Material/Manager.h>
#include <ITAGeo/Directivity/Manager.h>
#include <ITAHDFTSpectra.h>
#include <ITAHDFTSpectrum.h>
......@@ -47,7 +48,35 @@ namespace ITAPropagationModels
class ITA_PROPAGATION_MODELS_API CFilterEngine
{
public:
//!< Material resolutions structure (used if not determined by material)
struct MaterialResolution
{
ITAGeo::Material::IMaterial::Type iReflection = ITAGeo::Material::IMaterial::SCALAR; //!< Default reflection component resolution
ITAGeo::Material::IMaterial::Type iDiffraction = ITAGeo::Material::IMaterial::THIRD_OCTAVE; //!< Default diffraction component resolution
ITAGeo::Material::IMaterial::Type iTransmission = ITAGeo::Material::IMaterial::THIRD_OCTAVE; //!< Default transmission component resolution
} oMaterialResolution;
//! Static environment state description
struct StaticEnvironmentState
{
double dHumidity = ITAConstants::DEFAULT_HUMIDITY_D;
double dTemperature = ITAConstants::DEFAULT_TEMPERATURE_D;
float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F;
} oEnvironmentState; //!< Environment state
//! Propagation model configuration description
struct PropagationModelConfiguration
{
int iDiffractionModel = DiffractionModels::MAEKAWA_DETOUR_LAW;
} oPropagationModelConfiguration; //!< Propagation model configuration
//! Standard constructor for a filter engine
CFilterEngine();
//! Default destructor of a filter engine
~CFilterEngine();
//! Returns number of sensor channels
......@@ -76,45 +105,6 @@ namespace ITAPropagationModels
*/
static bool ValidateSameEmitter(const ITAGeo::CPropagationPathList& oPathList);
//! Applies all acoustic models like reflection diffraction models
void ApplyAcousticModels(ITAGeo::CPropagationPathList& oPathList);
inline void ApplyAcousticModels(ITAGeo::CPropagationPath& oPath)
{
ITAGeo::CPropagationPathList oPathList;
oPathList.push_back(oPath);
ApplyAcousticModels(oPathList);
};
//!Applies diffraction models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void ApplyDiffractionModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
//!Applies reflection models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void ApplyReflectionModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
//!Applies emitter models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void ApplyEmitterModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
//!Applies sensor models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void ApplySensorModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
void ApplyTransmissionModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1); // @todo
//! Generate multi-channel propagation path (for multi-channel receiver directivity)
/**
* @todo AER
......@@ -136,30 +126,25 @@ namespace ITAPropagationModels
};
//! Sets a connection to the material manager
void SetMaterialManager( std::shared_ptr< const ITAGeo::Material::IManager > );
void SetMaterialManager(std::shared_ptr< const ITAGeo::Material::IManager > pMaterialManager);
// Returns pointer to material manager or null
std::shared_ptr< const ITAGeo::Material::IManager > GetMaterialManager() const;
//! Sets a connection to the diffraction manager
void SetDirectivityManager(std::shared_ptr< const ITAGeo::Directivity::IManager > pDirectivityManager);
// Returns pointer to directivity manager or null
std::shared_ptr< const ITAGeo::Directivity::IManager > GetDirectivityManager() const;
private:
unique_ptr<ITABase::CHDFTSpectra> m_pAccumulatedSpectra; //!< Gathered propagation paths from list
unique_ptr<ITABase::CHDFTSpectra> m_pTempPropPathSpectra; //!< Single prop-path spectra
const struct DefaultResolutions //!< Default values
{
int iReflectionModel = ITAGeo::Material::IMaterial::SCALAR;
int iDiffractionModel = ITAGeo::Material::IMaterial::THIRD_OCTAVE;
int iEmitterModel = ITAGeo::Material::IMaterial::SCALAR;
int iSensorModel = ITAGeo::Material::IMaterial::SCALAR;
} m_oDefaultResolutions;
std::shared_ptr< const ITAGeo::Material::IManager > m_pMaterialManager;
const double m_dHumidity = 80.0;
const double m_dTemperature = 20.0;
const float m_fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F;
const int m_iDefaultDiffractionModel = 1;
std::shared_ptr< const ITAGeo::Directivity::IManager > m_pDirectivityManager;
};
}
......
......@@ -117,7 +117,7 @@ namespace ITAPropagationModels
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
double ITA_PROPAGATION_MODELS_API CalculateDiffractionFilterCoefficient( const double dPropagationLengthFreeField, const double dPropagationLengthOverApex, const float fFrequency, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F);
double ITA_PROPAGATION_MODELS_API CalculateDiffractionFilterCoefficient( const double dPropagationLengthFreeField, const double dPropagationLengthOverApex, const float fFrequency, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
//! Calculate diffraction factor based on the Maekawa detour method
/**
......@@ -131,7 +131,7 @@ namespace ITAPropagationModels
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
double ITA_PROPAGATION_MODELS_API CalculateDiffractionFactor(const double dPropagationLengthFreeField, const double dPropagationLengthOverApex, const float fFrequency, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F);
double ITA_PROPAGATION_MODELS_API CalculateDiffractionFactor(const double dPropagationLengthFreeField, const double dPropagationLengthOverApex, const float fFrequency, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
//! Calculate diffraction filter (frequency domain) based on the Maekawa detour method
......@@ -145,7 +145,7 @@ namespace ITAPropagationModels
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const double dPropagationLengthFreeField, const double dPropagationLengthOverApex, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F);
void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const double dPropagationLengthFreeField, const double dPropagationLengthOverApex, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
}
}
......
......@@ -49,7 +49,7 @@ namespace ITAPropagationModels
*
* @sa GetMinimumWavefrontDelayTime, GetMaximumWavefrontDelayTime
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
}
}
......
......@@ -23,6 +23,7 @@
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#include "Definitions.h"
#include "Base.h"
// Vista includes
#include <VistaBase/VistaVector3D.h>
......@@ -66,7 +67,7 @@ namespace ITAPropagationModels
* @param[out] cfFactor Complex-valued diffraction coefficient ( D( n, k,\rho, r, \phi_i, \alpha_i, \alpha_d ) )
* @param[in] iMethod Approximation algorithm
*/
bool ITA_PROPAGATION_MODELS_API CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fFrequency, complex< float >& cfCoeff, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
bool ITA_PROPAGATION_MODELS_API CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fFrequency, complex< float >& cfCoeff, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
//! Calculate diffraction factor based on the Maekawa detour method
/**
......@@ -80,7 +81,7 @@ namespace ITAPropagationModels
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
bool ITA_PROPAGATION_MODELS_API CalculateDiffractionFactor(const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fFrequency, complex< float >& cfFactor, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
bool ITA_PROPAGATION_MODELS_API CalculateDiffractionFactor(const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fFrequency, complex< float >& cfFactor, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
......@@ -95,7 +96,7 @@ namespace ITAPropagationModels
* @param[in] iMethod Approximation algorithm
* @param[in] fSpeedOfSound Sound speed
*/
void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F);
}
}
......
......@@ -49,6 +49,9 @@ bool CFilterEngine::ValidateSameSensor(const ITAGeo::CPropagationPathList& oPath
// Last anchor of the all paths must share the same sensor (pointer)
for (auto& oPath : oPathList)
{
if (oPath.empty())
ITA_EXCEPT_INVALID_PARAMETER("Detected an empty path in path list during sensor validation, aborting");
auto pLastAnchor = oPath[oPath.size() - 1];
if (pLastAnchor->iAnchorType != ITAGeo::CPropagationAnchor::ACOUSTIC_SENSOR)
......@@ -70,7 +73,10 @@ bool CFilterEngine::ValidateSameEmitter(const ITAGeo::CPropagationPathList& oPat
// Last anchor of the all paths must share the same sensor (pointer)
for (auto& oPath : oPathList)
{
auto pFirstAnchor = oPath[oPath.size() - 1];
if (oPath.empty())
ITA_EXCEPT_INVALID_PARAMETER("Detected an empty path in path list during emitter validation, aborting");
auto pFirstAnchor = oPath[0];
if (pFirstAnchor->iAnchorType != ITAGeo::CPropagationAnchor::ACOUSTIC_EMITTER)
return false;
......@@ -84,27 +90,12 @@ bool CFilterEngine::ValidateSameEmitter(const ITAGeo::CPropagationPathList& oPat
return true;
}
void CFilterEngine::ApplyAcousticModels(ITAGeo::CPropagationPathList & oPathList)
{
//Apply emitter model
ApplyEmitterModel(oPathList);
//Apply reflection model
ApplyReflectionModel(oPathList);
//Apply diffraction model
ApplyDiffractionModel(oPathList);
//Apply sensor model
ApplySensorModel(oPathList);
}
/*
void CFilterEngine::ApplyDiffractionModel(ITAGeo::CPropagationPathList & oPathList, int iModel)
{
int iDiffractionModelResolution;
if (iModel == -1)
iDiffractionModelResolution = m_oDefaultResolutions.iDiffractionModel;
iDiffractionModelResolution = oM.iDiffractionModel;
else
iDiffractionModelResolution = iModel;
......@@ -153,91 +144,9 @@ void CFilterEngine::ApplyDiffractionModel(ITAGeo::CPropagationPathList & oPathLi
}
}
}
*/
void CFilterEngine::ApplyReflectionModel(ITAGeo::CPropagationPathList & oPathList, int iModel)
{
int iReflectionModel;
if (iModel == -1)
iReflectionModel = m_oDefaultResolutions.iReflectionModel;
else
iReflectionModel = iModel;
for (auto& oPath : oPathList)
{
for (auto& pAnchor : oPath)
{
//If the anchor is a reflection and the acoustic material is not set yet, set it to default values
if ((pAnchor->iAnchorType == ITAGeo::CPropagationAnchor::SPECULAR_REFLECTION) && (pAnchor->pAcousticMaterial == NULL))
{
if (iReflectionModel == ITAGeo::Material::IMaterial::SCALAR)
{
//Set material with default values(current reflection factor: 0.7. See constructor of CScalarMaterial)
pAnchor->pAcousticMaterial = make_shared<ITAGeo::Material::CScalarMaterial>();
}
else //if (m_DefaultValues::iReflectionModel == ITAGeo::IAcousticMaterial::THIRD_OCTAVE)
{
ITA_EXCEPT_NOT_IMPLEMENTED;
}
}
}
}
}
void ITAPropagationModels::CFilterEngine::ApplyEmitterModel(ITAGeo::CPropagationPathList & oPathList, int iModel)
{
int iEmitterModel;
if (iModel == -1)
iEmitterModel = m_oDefaultResolutions.iEmitterModel;
else
iEmitterModel = iModel;
//Apply the emitter acoustic material. The emitter is always the first anchor of the propagation paths.
for (auto& oPath : oPathList)
{
//If the anchor is a reflection and the acoustic material is not set yet, set it to default values
if (oPath[0]->iAnchorType == ITAGeo::CPropagationAnchor::ACOUSTIC_EMITTER)
{
if (oPath[0]->pAcousticMaterial == NULL)
{
if( iEmitterModel == ITAGeo::Material::IMaterial::SCALAR )
{
//Set material with factor 1.0
auto pAcousticMaterial = make_shared<ITAGeo::Material::CScalarMaterial>();
pAcousticMaterial->cdTransmissionFactor = 1.0f;
pAcousticMaterial->cdReflectionFactor = 0.0f;
oPath[0]->pAcousticMaterial = pAcousticMaterial;
}
else //TODO: add cases like if (m_DefaultValues::iEmitterModel == ITAGeo::IAcousticMaterial::THIRD_OCTAVE)
{
ITA_EXCEPT_NOT_IMPLEMENTED;
}
}
}
else
{
ITA_EXCEPT1(INVALID_PARAMETER, "The propagation paths must always start with an emitter anchor.");
}
}
}
void ITAPropagationModels::CFilterEngine::ApplySensorModel(ITAGeo::CPropagationPathList & oPathList, int iModel)
{
//Check for correct structur of oPathList
if (!ValidateSameSensor(oPathList))
ITA_EXCEPT1(INVALID_PARAMETER, "The propagation path list has multiple sensor anchors or last anchor of paths is not a sensor.");
int iSensorModel;
if (iModel == -1)
iSensorModel = m_oDefaultResolutions.iSensorModel;
else
iSensorModel = iModel;
}
void ITAPropagationModels::CFilterEngine::SetMaterialManager( std::shared_ptr< const ITAGeo::Material::IManager > pMaterialManager)
void ITAPropagationModels::CFilterEngine::SetMaterialManager(std::shared_ptr< const ITAGeo::Material::IManager > pMaterialManager)
{
m_pMaterialManager = pMaterialManager;
}
......@@ -247,16 +156,15 @@ std::shared_ptr< const ITAGeo::Material::IManager > ITAPropagationModels::CFilte
return m_pMaterialManager;
}
//TODO: delete pragma warning after implementation of function
#pragma warning( push )
#pragma warning( disable : 4100)
void CFilterEngine::ApplyTransmissionModel(ITAGeo::CPropagationPathList & oPathList, int iModel)
void ITAPropagationModels::CFilterEngine::SetDirectivityManager(std::shared_ptr< const ITAGeo::Directivity::IManager > pDirectivityManager)
{
ITA_EXCEPT_NOT_IMPLEMENTED;
m_pDirectivityManager = pDirectivityManager;
}
//TODO: delete pragma warning pop after implementation of function
#pragma warning( pop )
std::shared_ptr< const ITAGeo::Directivity::IManager > ITAPropagationModels::CFilterEngine::GetDirectivityManager() const
{
return m_pDirectivityManager;
}
void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITABase::CHDFTSpectra & oHDFTSpectra, bool* pbDFTDegreeTooSmall)
{
......@@ -291,7 +199,7 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
//Air attenuation according to ISO9613-1
ITABase::CThirdOctaveFactorMagnitudeSpectrum oThirdOctAbsorption;
ITABase::ISO9613::AtmosphericAbsorption(oThirdOctAbsorption, fPathLength, m_dTemperature, m_dHumidity);
ITABase::ISO9613::AtmosphericAbsorption(oThirdOctAbsorption, fPathLength, oEnvironmentState.dTemperature, oEnvironmentState.dHumidity);
//Multiply the transmissionfactor of the air attenuation alpha: sqrt(1-|alpha|)
for (int iFrequencyIndex = 0; iFrequencyIndex < oThirdOctFactors.GetNumBands(); iFrequencyIndex++)
......@@ -359,7 +267,7 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
//Get the delay [samples] and calculate the phase shift according to the shift theorem
// DFT(x(k-Delta)) = exp(-j * omega_k * delta) * X(k) , with omega_k = 2 * pi * k / N
float fDelaySamples = fPathLength / m_fSpeedOfSound * (float)oHDFTSpectra.GetSampleRate();
float fDelaySamples = fPathLength / oEnvironmentState.fSpeedOfSound * (float)oHDFTSpectra.GetSampleRate();
float fDelayPhase = -fDelaySamples * ITAConstants::TWO_PI_F * i / (float)oHDFTSpectra.GetDFTSize();
(*m_pTempPropPathSpectra)[0]->SetPhasePreserveMagnitude(i, fDelayPhase);
......
......@@ -83,14 +83,13 @@ int main( int, char** )
oFilterEngine.SetMaterialManager( pMaterialDirectory );
// Set filter length according to the maximum path length
const float fSpeedOfSound = SPEED_OF_SOUND_F; //Approximation of speed of sound at ~20C
const float fSpeedOfSound = DEFAULT_SPEED_OF_SOUND_F; //Approximation of speed of sound at ~20C
const float fSampleRate = 44.1e3f;
int iFilterLengthSamples = ( int ) ( oPathList.GetMaxLength() / fSpeedOfSound * fSampleRate );
iFilterLengthSamples = int( iFilterLengthSamples + 4096 );
ITABase::CHDFTSpectra oTransmissionFilter( fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples );
bool bDFTDegreeTooSmallFlag;
oFilterEngine.ApplyAcousticModels( oPathList ); // @todo aer remove / merge into Generate()
oFilterEngine.Generate( oPathList, oTransmissionFilter, &bDFTDegreeTooSmallFlag );
if( bDFTDegreeTooSmallFlag )
......
......@@ -52,14 +52,13 @@ int main( int, char** )
CFilterEngine oFilterEngine;
// Set filter length according to the maximum path length
const float fSpeedOfSound = SPEED_OF_SOUND_F; // Approximation of speed of sound at ~20C
const float fSpeedOfSound = DEFAULT_SPEED_OF_SOUND_F; // Approximation of speed of sound at ~20C
const float fSampleRate = 44.1e3f;
int iFilterLengthSamples = (int)(oPathFromLeft.GetLength() / fSpeedOfSound * fSampleRate);
iFilterLengthSamples = int(iFilterLengthSamples + 4096);
ITABase::CHDFTSpectra oTransmissionFilterLeft(fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples);
bool bDFTDegreeTooSmallFlag;
oFilterEngine.ApplyAcousticModels(oPathFromLeft); // @todo aer remove / merge into Generate()
oFilterEngine.Generate(oPathFromLeft, oTransmissionFilterLeft, &bDFTDegreeTooSmallFlag);
if (bDFTDegreeTooSmallFlag)
......@@ -72,7 +71,6 @@ int main( int, char** )
iFilterLengthSamples = int(iFilterLengthSamples + 4096);
ITABase::CHDFTSpectra oTransmissionFilterRight(fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples);
oFilterEngine.ApplyAcousticModels(oPathFromRight); // @todo aer remove / merge into Generate()
oFilterEngine.Generate(oPathFromRight, oTransmissionFilterRight, &bDFTDegreeTooSmallFlag);
if (bDFTDegreeTooSmallFlag)
......
......@@ -83,14 +83,13 @@ int main( int, char** )
oFilterEngine.SetMaterialManager( pMaterialDirectory );
// Set filter length according to the maximum path length
const float fSpeedOfSound = SPEED_OF_SOUND_F; //Approximation of speed of sound at ~20C
const float fSpeedOfSound = DEFAULT_SPEED_OF_SOUND_F; //Approximation of speed of sound at ~20C
const float fSampleRate = 44.1e3f;
int iFilterLengthSamples = ( int ) ( oPathList.GetMaxLength() / fSpeedOfSound * fSampleRate );
iFilterLengthSamples = int( iFilterLengthSamples + 4096 );
ITABase::CHDFTSpectra oTransmissionFilter( fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples );
bool bDFTDegreeTooSmallFlag;
oFilterEngine.ApplyAcousticModels( oPathList ); // @todo aer remove / merge into Generate()
oFilterEngine.Generate( oPathList, oTransmissionFilter, &bDFTDegreeTooSmallFlag );
if( bDFTDegreeTooSmallFlag )
......
......@@ -37,7 +37,7 @@ using namespace ITAGeo;
using namespace ITAPropagationModels;
static const float g_fSampleRate = 44.1e3f;
static const float g_fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F;
static const float g_fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F;
//! Tests running the Svensson model functions
/**
......
......@@ -36,7 +36,7 @@ using namespace ITAPropagationModels;
static const float g_fSampleRate = 44.1e3f;
static const int g_iFilterLength = 128;
static const float g_fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F;
static const float g_fSpeedOfSound = ITAConstants::DEFAULT_SPEED_OF_SOUND_F;
//! Tests running the UTD model functions
/**
......
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