Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
33e122c1
Commit
33e122c1
authored
Dec 06, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Fixing bug in critical section usage of stream detector
parent
0c690248
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ITAStreamDetector.cpp
View file @
33e122c1
...
...
@@ -163,7 +163,10 @@ float ITAStreamDetector::GetOverallRMS( const bool bReset )
m_cs
.
enter
();
if
(
m_iRMSBlocks
==
0
)
{
m_cs
.
leave
();
return
0.0
f
;
}
double
dOverallRMSSums
=
0
;
for
(
size_t
i
=
0
;
i
<
m_vdRMSSquaredSums
.
size
();
i
++
)
...
...
@@ -220,7 +223,10 @@ void ITAStreamDetector::GetRMSs( std::vector< float >& vfDest, const bool bReset
vfDest
.
resize
(
m_vdRMSSquaredSums
.
size
(),
0.0
f
);
if
(
m_iRMSBlocks
==
0
)
{
m_cs
.
leave
();
return
;
}
for
(
size_t
c
=
0
;
c
<
m_vdRMSSquaredSums
.
size
();
c
++
)
vfDest
[
c
]
=
float
(
std
::
sqrt
(
(
m_vdRMSSquaredSums
[
c
]
/
double
(
m_iRMSBlocks
)
)
)
);
// RMS
...
...
@@ -236,9 +242,14 @@ void ITAStreamDetector::GetRMSsDecibel( std::vector< float >& vdDestDecibel, con
if
(
m_iMode
!=
ITAStreamDetector
::
RMS
&&
m_iMode
!=
ITAStreamDetector
::
PEAK_AND_RMS
)
ITA_EXCEPT1
(
MODAL_EXCEPTION
,
"Can not provide stream detector data because it is not calculated in this mode"
);
m_cs
.
enter
();
vdDestDecibel
.
resize
(
m_vdRMSSquaredSums
.
size
(),
ITAConstants
::
MINUS_INFINITY_F
);
if
(
m_iRMSBlocks
==
0
)
{
m_cs
.
leave
();
return
;
}
for
(
size_t
c
=
0
;
c
<
m_vdRMSSquaredSums
.
size
();
c
++
)
vdDestDecibel
[
c
]
=
float
(
ratio_to_db20
(
std
::
sqrt
(
m_vdRMSSquaredSums
[
c
]
/
double
(
m_iRMSBlocks
*
m_iBlocklength
)
)
)
);
// RMS
...
...
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