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)
ITADSP
Commits
fa7d59c0
Commit
fa7d59c0
authored
Jun 14, 2018
by
Dipl.-Ing. Jonas Stienen
Browse files
Introducing ITABaser namespace, starting with data classes
parent
a8bc3328
Changes
7
Hide whitespace changes
Inline
Side-by-side
include/ITAThirdOctaveFIRFilterGenerator.h
View file @
fa7d59c0
...
...
@@ -62,7 +62,7 @@ public:
void
SetDumpFilename
(
const
std
::
string
&
sFilename
);
// Filter erzeugen
void
GenerateFilter
(
const
C
ITAThirdOctaveGainMagnitudeSpectrum
&
oTOMagnitudes
,
float
*
pfFilterCoeffs
);
void
GenerateFilter
(
const
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
&
oTOMagnitudes
,
float
*
pfFilterCoeffs
);
private:
double
m_dSamplerate
;
// Abtastrate der Ausgabefilter [Hz]
...
...
include/ITAThirdOctaveFilterbank.h
View file @
fa7d59c0
...
...
@@ -62,7 +62,7 @@ public:
*/
virtual
inline
void
SetIdentity
(
const
bool
bSmoothChangeover
=
true
)
{
C
ITAThirdOctaveGainMagnitudeSpectrum
oIdentity
;
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
oIdentity
;
oIdentity
.
SetIdentity
();
SetMagnitudes
(
oIdentity
,
bSmoothChangeover
);
};
...
...
@@ -72,7 +72,7 @@ public:
* \param oGains Neue Verstärkungsfaktoren
* \param bSmoothChangeover Überbenden (default, true) oder direktes Umschalten (false)
*/
virtual
void
SetMagnitudes
(
const
C
ITAThirdOctaveGainMagnitudeSpectrum
&
oGains
,
const
bool
bSmoothChangeover
=
true
)
=
0
;
virtual
void
SetMagnitudes
(
const
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
&
oGains
,
const
bool
bSmoothChangeover
=
true
)
=
0
;
//! Latenz (Verzögerung) der Filterbank zurückgeben
/**
...
...
include/ITAThirdOctaveFilterbankFIR.h
View file @
fa7d59c0
...
...
@@ -70,7 +70,7 @@ public:
pFilter
->
Release
();
// Auto-release
}
inline
virtual
void
SetMagnitudes
(
const
C
ITAThirdOctaveGainMagnitudeSpectrum
&
oMags
,
const
bool
bSmoothChangeover
=
true
)
inline
virtual
void
SetMagnitudes
(
const
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
&
oMags
,
const
bool
bSmoothChangeover
=
true
)
{
m_pGenerator
->
GenerateFilter
(
oMags
,
m_pfFilter
);
ITAUPFilter
*
pFilter
=
m_pConvolver
->
RequestFilter
();
...
...
include/ITAThirdOctaveFilterbankIIR.h
View file @
fa7d59c0
...
...
@@ -52,7 +52,7 @@ public:
* @param[in] oMagnitudes Filter magnitudes (dB)
* @param[in] bSmoothChangeover If true, switching is smoothed
*/
void
SetMagnitudes
(
const
C
ITAThirdOctaveGainMagnitudeSpectrum
&
oMagnitudes
,
const
bool
bSmoothChangeover
=
true
);
void
SetMagnitudes
(
const
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
&
oMagnitudes
,
const
bool
bSmoothChangeover
=
true
);
//! Clear all internal accumulators
void
Clear
();
...
...
@@ -69,7 +69,7 @@ private:
class
MagnitudeUpdate
{
public:
C
ITAThirdOctaveGainMagnitudeSpectrum
oMags
;
//! New magnitudes
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
oMags
;
//! New magnitudes
int
iBlendSamples
;
//!< Anzahl Samples zum Überblenden
};
...
...
@@ -79,7 +79,7 @@ private:
int
m_nBiquadsPerBand
;
//!< Anzahl von Biqads pro Band
std
::
vector
<
CITABiquad
>
m_vBiquads
;
//!< Biquads, access: [Band][BiquadNummer]
tbb
::
strict_ppl
::
concurrent_queue
<
CITAThirdOctaveFilterbankIIR
::
MagnitudeUpdate
>
m_vMagnitudesQueue
;
//!< Liste von neuen Verstärkungsfaktoren
C
ITAThirdOctaveGainMagnitudeSpectrum
m_oMagnitudesInternal
;
//!< Interne Verstärkungsfaktoren
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
m_oMagnitudesInternal
;
//!< Interne Verstärkungsfaktoren
ITASampleBuffer
m_sfTempFilterBuf
;
//!< Intermediate buffer for filter
ITASampleBuffer
m_pfTempOutputBuf
;
//!< Intermediate buffer for output assembly
};
...
...
src/ITAThirdOctaveFIRFilterGenerator.cpp
View file @
fa7d59c0
...
...
@@ -8,6 +8,8 @@
#include <spline.h>
using
namespace
ITABase
;
CITAThirdOctaveFIRFilterGenerator
::
CITAThirdOctaveFIRFilterGenerator
(
const
double
dSampleRate
,
const
int
iFilterLength
)
:
m_dSamplerate
(
dSampleRate
)
,
m_iFilterLength
(
iFilterLength
)
...
...
@@ -18,11 +20,11 @@ CITAThirdOctaveFIRFilterGenerator::CITAThirdOctaveFIRFilterGenerator( const doub
,
m_pfBuf2
(
nullptr
)
,
m_bWindow
(
false
)
{
m_iInputFreqs
=
C
ITA
ThirdOctaveMagnitudeSpectrum
::
GetNumBands
()
+
2
;
m_iInputFreqs
=
CThirdOctaveMagnitudeSpectrum
::
GetNumBands
()
+
2
;
m_pfInputFreqs
=
fm_falloc
(
m_iInputFreqs
,
true
);
m_pfInputFreqs
[
0
]
=
0
;
// Left margin
for
(
int
i
=
0
;
i
<
C
ITA
ThirdOctaveMagnitudeSpectrum
::
GetNumBands
();
i
++
)
m_pfInputFreqs
[
i
+
1
]
=
C
ITA
ThirdOctaveMagnitudeSpectrum
::
GetCenterFrequencies
()[
i
];
for
(
int
i
=
0
;
i
<
CThirdOctaveMagnitudeSpectrum
::
GetNumBands
();
i
++
)
m_pfInputFreqs
[
i
+
1
]
=
CThirdOctaveMagnitudeSpectrum
::
GetCenterFrequencies
()[
i
];
m_pfInputFreqs
[
m_iInputFreqs
-
1
]
=
(
float
)
dSampleRate
/
2
;
// Right margin: Nyquist frequency
m_pfInputData
=
fm_falloc
(
m_iInputFreqs
,
true
);
...
...
@@ -78,7 +80,7 @@ void CITAThirdOctaveFIRFilterGenerator::SetDumpFilename( const std::string& sFil
m_sDumpFilename
=
sFilename
;
}
void
CITAThirdOctaveFIRFilterGenerator
::
GenerateFilter
(
const
C
ITAThirdOctaveGainMagnitudeSpectrum
&
oTOGainMagnitudes
,
float
*
pfFilterCoeffs
)
void
CITAThirdOctaveFIRFilterGenerator
::
GenerateFilter
(
const
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
&
oTOGainMagnitudes
,
float
*
pfFilterCoeffs
)
{
m_sw
.
start
();
...
...
@@ -100,7 +102,7 @@ void CITAThirdOctaveFIRFilterGenerator::GenerateFilter( const CITAThirdOctaveGai
// 1st step: Interpolate the magnitudes
m_pfInputData
[
0
]
=
1.0
f
;
for
(
int
i
=
0
;
i
<
C
ITA
ThirdOctaveMagnitudeSpectrum
::
GetNumBands
();
i
++
)
for
(
int
i
=
0
;
i
<
CThirdOctaveMagnitudeSpectrum
::
GetNumBands
();
i
++
)
m_pfInputData
[
1
+
i
]
=
float
(
oTOGainMagnitudes
[
i
]
);
m_pfInputData
[
m_iInputFreqs
-
1
]
=
0.0
f
;
// @todo jst: check if this is good
...
...
src/ITAThirdOctaveFilterbank.cpp
View file @
fa7d59c0
...
...
@@ -5,7 +5,7 @@
#include <cassert>
CITAThirdOctaveFilterbank
*
CITAThirdOctaveFilterbank
::
Create
(
const
double
dSampleRate
,
const
int
iBlockLength
,
const
int
iMethod
)
CITAThirdOctaveFilterbank
*
CITAThirdOctaveFilterbank
::
Create
(
const
double
dSampleRate
,
const
int
iBlockLength
,
const
int
iMethod
)
{
switch
(
iMethod
)
{
...
...
src/ITAThirdOctaveFilterbankIIR.cpp
View file @
fa7d59c0
...
...
@@ -19,7 +19,7 @@ CITAThirdOctaveFilterbankIIR::CITAThirdOctaveFilterbankIIR( const double dSample
if
(
dSampleRate
!=
ITADSPThirdOctaveFilterbankIIR
::
dSamplingFrequency
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Filterbank does not support this samplingrate"
);
if
(
m_nBandsInternal
!=
C
ITAThirdOctaveGainMagnitudeSpectrum
::
GetNumBands
()
)
if
(
m_nBandsInternal
!=
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
::
GetNumBands
()
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Filterbank does not match third octave band number"
);
// Initialize biquads
...
...
@@ -51,7 +51,7 @@ int CITAThirdOctaveFilterbankIIR::GetLatency() const
return
0
;
}
void
CITAThirdOctaveFilterbankIIR
::
SetMagnitudes
(
const
C
ITAThirdOctaveGainMagnitudeSpectrum
&
oMagnitudes
,
const
bool
bSmoothChangeover
)
void
CITAThirdOctaveFilterbankIIR
::
SetMagnitudes
(
const
ITA
Base
::
C
ThirdOctaveGainMagnitudeSpectrum
&
oMagnitudes
,
const
bool
bSmoothChangeover
)
{
CITAThirdOctaveFilterbankIIR
::
MagnitudeUpdate
oUpdate
;
oUpdate
.
oMags
=
oMagnitudes
;
...
...
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