Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
f796164b
Commit
f796164b
authored
Dec 11, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Progress on RMS detector
parent
70eb7f34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
48 deletions
+34
-48
CMakeLists.txt
CMakeLists.txt
+3
-1
include/ITARMSDetector.h
include/ITARMSDetector.h
+28
-29
src/ITARMSDetector.cpp
src/ITARMSDetector.cpp
+3
-18
No files found.
CMakeLists.txt
View file @
f796164b
...
...
@@ -132,7 +132,9 @@ target_link_libraries( ITADataSources ${VISTA_USE_PACKAGE_LIBRARIES} )
#target_compile_features(ITADataSources PRIVATE cxx_range_for)
add_definitions
(
-std=c++11
)
if
(
NOT WIN32
add_definitions
(
-std=c++11
)
endif
()
set
(
BUILD_SHARED_LIBS
${
BUILD_SHARED_LIBS_TEMP
}
)
...
...
include/ITARMSDetector.h
View file @
f796164b
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2016
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2016
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_RMS_DETECTOR
#define INCLUDE_WATCHER_ITA_RMS_DETECTOR
...
...
@@ -28,7 +28,7 @@
//! Detector for RMS values
/**
*
* \note
Die Klasse ist T
hread-safe
* \note
not t
hread-safe
*/
class
ITA_DATA_SOURCES_API
ITARMSDetector
:
public
ITADatasource
{
...
...
@@ -41,11 +41,10 @@ public:
};
void
Reset
();
void
GetOverallRMS
(
float
*
pf
Peak
,
unsigned
int
*
puiChannel
=
0
,
bool
bReset
=
true
);
void
GetOverallRMSDecibel
(
double
*
pd
Peak
Decibel
,
unsigned
int
*
puiChannel
=
0
,
bool
bReset
=
true
);
void
GetOverallRMS
(
float
*
pf
RMS
,
unsigned
int
*
puiChannel
=
0
,
bool
bReset
=
true
);
void
GetOverallRMSDecibel
(
double
*
pd
RMS
Decibel
,
unsigned
int
*
puiChannel
=
0
,
bool
bReset
=
true
);
float
GetRMS
(
unsigned
int
uiChannel
,
bool
bReset
=
true
);
double
GetRMSDecibel
(
unsigned
int
uiChannel
,
bool
bReset
=
true
);
void
GetRMSs
(
float
*
pfDest
,
bool
bReset
=
true
);
void
GetRMSs
(
std
::
vector
<
float
>&
vfDest
,
bool
bReset
=
true
);
void
GetRMSsDecibel
(
std
::
vector
<
double
>&
vdDestDecibel
,
bool
bReset
=
true
);
...
...
@@ -61,21 +60,21 @@ public:
inline
double
GetSampleRate
()
const
{
return
m_dSample
r
ate
;
return
m_dSample
R
ate
;
};
virtual
const
float
*
GetBlockPointer
(
unsigned
int
uiChannel
,
const
ITAStreamInfo
*
pStreamInfo
);
virtual
void
IncrementBlockPointer
();
protected:
ITADatasource
*
m_pDataSource
;
// Angeschlossene Datenquelle
double
m_dSample
r
ate
;
// Abtastrate [Hz]
unsigned
int
m_uiChannels
;
// Anzahl Kanle
unsigned
int
m_uiBlocklength
;
// Streaming Puffergre [Samples]
ITACriticalSection
m_cs
;
// Sichert exklusiven Zugriff auf die Daten (s.u.)
float
*
m_pfRMSs
;
// Spitzenwerte der einzelnen Kanle
float
m_fOverallRMS
;
// Spitzenwert ber alle Kanle
unsigned
int
m_uiOverallRMSChannel
;
// Kanal in dem der Spitzenwert auftrat
ITADatasource
*
m_pDataSource
;
double
m_dSample
R
ate
;
unsigned
int
m_uiChannels
;
unsigned
int
m_uiBlocklength
;
ITACriticalSection
m_cs
;
float
*
m_pfRMSs
;
float
m_fOverallRMS
;
unsigned
int
m_uiOverallRMSChannel
;
};
#endif // INCLUDE_WATCHER_ITA_RMS_DETECTOR
\ No newline at end of file
src/ITARMSDetector.cpp
View file @
f796164b
...
...
@@ -8,12 +8,12 @@
ITARMSDetector
::
ITARMSDetector
(
ITADatasource
*
pDataSource
)
:
m_pDataSource
(
pDataSource
)
{
m_dSample
r
ate
=
pDataSource
->
GetSampleRate
();
m_dSample
R
ate
=
pDataSource
->
GetSampleRate
();
m_uiChannels
=
pDataSource
->
GetNumberOfChannels
();
m_uiBlocklength
=
pDataSource
->
GetBlocklength
();
m_pfRMSs
=
0
;
if
(
(
m_uiBlocklength
==
0
)
||
(
m_uiChannels
==
0
)
||
(
m_dSample
r
ate
==
0
)
)
if
(
(
m_uiBlocklength
==
0
)
||
(
m_uiChannels
==
0
)
||
(
m_dSample
R
ate
==
0
)
)
ITA_EXCEPT0
(
INVALID_PARAMETER
);
m_pfRMSs
=
new
float
[
m_uiChannels
];
...
...
@@ -96,22 +96,7 @@ double ITARMSDetector::GetRMSDecibel( unsigned int uiChannel, bool bReset )
return
ratio_to_db20
(
GetRMS
(
uiChannel
,
bReset
)
);
}
void
ITARMSDetector
::
GetRMSs
(
float
*
pfDest
,
bool
bReset
)
{
if
(
!
pfDest
)
ITA_EXCEPT0
(
INVALID_PARAMETER
);
m_cs
.
enter
();
for
(
unsigned
int
c
=
0
;
c
<
m_uiChannels
;
c
++
)
{
pfDest
[
c
]
=
m_pfRMSs
[
c
];
if
(
bReset
)
m_pfRMSs
[
c
]
=
0
;
}
m_cs
.
leave
();
}
void
ITARMSDetector
::
GetRMSs
(
std
::
vector
<
float
>&
vfDest
,
bool
bReset
)
void
ITARMSDetector
::
GetRMSs
(
std
::
vector
<
float
>&
vfDest
,
bool
bReset
)
{
if
(
(
(
unsigned
int
)
vfDest
.
size
()
)
<
m_uiChannels
)
vfDest
.
resize
(
m_uiChannels
);
...
...
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