Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
ITAPropagationModels
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITAPropagationModels
Commits
18cef915
Commit
18cef915
authored
Jan 07, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes in tests and generate function
parent
e3a3e49f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
include/ITAPropagationModels/FilterEngine.h
include/ITAPropagationModels/FilterEngine.h
+3
-3
src/ITAPropagationModels/FilterEngine.cpp
src/ITAPropagationModels/FilterEngine.cpp
+5
-2
tests/FilterEngine/FilterEngineTest.cpp
tests/FilterEngine/FilterEngineTest.cpp
+7
-3
No files found.
include/ITAPropagationModels/FilterEngine.h
View file @
18cef915
...
...
@@ -103,14 +103,14 @@ namespace ITAPropagationModels
/**
* @todo AER
*/
void
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectra
&
oFilter
);
void
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectra
&
oFilter
,
bool
*
pbDFTDegreeTooSmall
=
NULL
);
//! Generate single-channel propagation path (for single-channel receiver directivity)
inline
void
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectrum
&
oFilter
)
inline
void
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectrum
&
oFilter
,
bool
*
pbDFTDegreeTooSmall
=
NULL
)
{
const
vector
<
ITABase
::
CHDFTSpectrum
*
>
vpSpectra
=
{
&
oFilter
};
ITABase
::
CHDFTSpectra
oTF
(
vpSpectra
);
Generate
(
oPathList
,
oTF
);
Generate
(
oPathList
,
oTF
,
pbDFTDegreeTooSmall
);
};
//! Sets a connection to the material manager
...
...
src/ITAPropagationModels/FilterEngine.cpp
View file @
18cef915
...
...
@@ -264,8 +264,11 @@ void CFilterEngine::ApplyTransmissionModel( ITAGeo::CPropagationPathList & oPath
#pragma warning( pop )
void
CFilterEngine
::
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectra
&
oHDFTSpectra
)
void
CFilterEngine
::
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectra
&
oHDFTSpectra
,
bool
*
pbDFTDegreeTooSmall
)
{
if
(
pbDFTDegreeTooSmall
)
*
pbDFTDegreeTooSmall
=
false
;
//Check for correct structur of oPathList
if
(
!
HasSameSensorAnchor
(
oPathList
)
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"The propagation path list has more than multiple sensor anchors or last anchor of paths is not a sensor."
);
...
...
@@ -360,7 +363,7 @@ void CFilterEngine::Generate( const ITAGeo::CPropagationPathList & oPathList, IT
//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
fDelayPhase
=
-
fDelaySamples
*
ITAConstants
::
TWO_PI_F
*
i
/
oHDFTSpectra
.
GetDFTSize
();
float
fDelayPhase
=
-
fDelaySamples
*
ITAConstants
::
TWO_PI_F
*
i
/
(
float
)
oHDFTSpectra
.
GetDFTSize
();
(
*
m_pTempPropPathSpectra
)[
0
]
->
SetPhasePreserveMagnitude
(
i
,
fDelayPhase
);
...
...
tests/FilterEngine/FilterEngineTest.cpp
View file @
18cef915
...
...
@@ -81,16 +81,20 @@ int main( int, char** )
CFilterEngine
oFilterEngine
;
oFilterEngine
.
SetMaterialManager
(
&
oMaterialDirectory
);
oFilterEngine
.
ApplyAcousticModels
(
oPathList
);
// 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
fSampleRate
=
44.1e3
f
;
int
iFilterLengthSamples
=
(
int
)
(
oPathList
.
GetMaxLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
*
1.5
f
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
+
4096
);
ITABase
::
CHDFTSpectra
oTransmissionFilter
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLengthSamples
);
oFilterEngine
.
Generate
(
oPathList
,
oTransmissionFilter
);
bool
bDFTDegreeTooSmallFlag
;
oFilterEngine
.
ApplyAcousticModels
(
oPathList
);
// @todo aer remove / merge into Generate()
oFilterEngine
.
Generate
(
oPathList
,
oTransmissionFilter
,
&
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)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment