Appyling new methods from ITAGeo (coordinates, directivities)

parent fbd1cc2a
......@@ -73,7 +73,7 @@ namespace ITAPropagationModels
//! Standard constructor for a filter engine
CFilterEngine();
CFilterEngine( const ITAGeo::ECoordinateSystemConvention iConvention = ITAGeo::ECoordinateSystemConvention::ISO );
//! Default destructor of a filter engine
......@@ -145,6 +145,8 @@ namespace ITAPropagationModels
std::shared_ptr< const ITAGeo::Material::IManager > m_pMaterialManager;
std::shared_ptr< const ITAGeo::Directivity::IManager > m_pDirectivityManager;
ITAGeo::ECoordinateSystemConvention m_iCoordinateSystemConvention;
};
}
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ int main( int, char** )
oPathFromRight.push_back(pSenderRight);
oPathFromRight.push_back(pReceiver);
CFilterEngine oFilterEngine;
CFilterEngine oFilterEngine( OPENGL );
int iFilterLengthSamples = (int) ceil(Utils::EstimateFilterLengthSamples(oPathFromLeft, fSampleRate));
ITABase::CHDFTSpectra oTransmissionFilterLeft(fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples );
......
......@@ -18,82 +18,48 @@
#include <ITAPropagationModels/FilterEngine.h>
#include <ITAPropagationModels/Utils.h>
#include <ITAGeo/Base.h>
#include <ITAGeo/Material/Manager.h>
#include <ITAGeo/Directivity/Base.h>
#include <ITAGeo/Directivity/DAFF_ImpulseResponse.h>
#include <ITAGeo/Directivity/DAFF_MagnitudeSpectrum.h>
#include <ITAFFTUtils.h>
#include <ITAISO9613.h>
using namespace std;
using namespace ITABase;
using namespace ITAConstants;
using namespace ITAGeo;
using namespace ITAFFTUtils;
using namespace ITAPropagationModels;
int main( int, char** )
{
/*
|___x___|
/\
s \ r
\ /
___x___
|______|
*/
auto pSender = make_shared< CEmitter >( VistaVector3D( -2.0f, 0.0f, 0.0f ) );
auto pReceiver = make_shared< CSensor >( VistaVector3D( 2.0f, 0.0f, 0.0f ) );
auto pMaterialDirectory = std::make_shared< Material::CDirectory >( "./" );
auto pReflection = make_shared< CSpecularReflection >( VistaVector3D( 0.0f, 2.0f, 0.0f ) );
pReflection->pAcousticMaterial = pMaterialDirectory->GetMaterial( "stonewall" );
const float fSampleRate = 44.1e3f;
auto pW = std::make_shared< CITADiffractionOuterWedgeAperture >();
pW->v3AperturePoint.SetValues( 0.0f, 1.0f, 0.0f );
pW->v3MainWedgeFaceNormal.SetValues( -1.0f, 1.0f, .0f );
pW->v3MainWedgeFaceNormal.Normalize();
pW->v3OppositeWedgeFaceNormal.SetValues( 1.0f, 1.0f, .0f );
pW->v3OppositeWedgeFaceNormal.Normalize();
pW->v3VertextStart.SetValues( .0f, 1.0f, -1.0f );
pW->v3VertextEnd.SetValues( .0f, 1.0f, 1.0f );
CPropagationPath oPathDirect;
oPathDirect.push_back( pSender );
oPathDirect.push_back( pReceiver );
CPropagationPath oPathReflection;
oPathReflection.push_back( pSender );
oPathReflection.push_back( pReflection );
oPathReflection.push_back( pReceiver );
CPropagationPath oPathDiffraction;
oPathDiffraction.push_back( pSender );
oPathDiffraction.push_back( pW );
oPathDiffraction.push_back( pReceiver );
int main(int, char**)
{
shared_ptr< Directivity::CDAFF_MagnitudeSpectrum > pTrumpetDirectivity = make_shared< Directivity::CDAFF_MagnitudeSpectrum >();
pTrumpetDirectivity->LoadFromFile("Trumpet1.v17.ms.daff");
CPropagationPathList oPathList;
oPathList.push_back(oPathDirect);
oPathList.push_back(oPathReflection);
oPathList.push_back(oPathDiffraction);
auto pSender = make_shared< CEmitter >(VistaVector3D(2.0f, 1.3f, 2.0f));
pSender->pDirectivity = pTrumpetDirectivity;
CFilterEngine oFilterEngine;
oFilterEngine.SetMaterialManager( pMaterialDirectory );
auto pReceiver = make_shared< CSensor >(VistaVector3D(0.0f, 0.0f, 0.0f));
CPropagationPath oPath;
oPath.push_back(pSender);
oPath.push_back(pReceiver);
// Set filter length according to the maximum path length
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 );
CFilterEngine oFilterEngine(OPENGL);
ITABase::CHDFTSpectra oTransmissionFilter( fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples );
int iFilterLengthSamples = (int)ceil(Utils::EstimateFilterLengthSamples(oPath, fSampleRate));
CHDFTSpectra oTransmissionFilter(fSampleRate, pReceiver->GetNumChannels(), iFilterLengthSamples);
bool bDFTDegreeTooSmallFlag;
oFilterEngine.Generate( oPathList, oTransmissionFilter, &bDFTDegreeTooSmallFlag );
oFilterEngine.Generate(oPath, oTransmissionFilter, &bDFTDegreeTooSmallFlag);
if( bDFTDegreeTooSmallFlag )
if (bDFTDegreeTooSmallFlag)
cerr << "DFT lengh too small, could not include all path completely into target filter" << endl;
ITAFFTUtils::Export( &oTransmissionFilter, "FilterEngineTest.wav" ); // Exports in time domain as impulse response (IR)
Export(&oTransmissionFilter, "SourceDirectivityTest.wav"); // Exports in time domain as impulse response (IR)
}
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