Commit fa7d59c0 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Introducing ITABaser namespace, starting with data classes

parent a8bc3328
......@@ -62,7 +62,7 @@ public:
void SetDumpFilename( const std::string& sFilename );
// Filter erzeugen
void GenerateFilter( const CITAThirdOctaveGainMagnitudeSpectrum& oTOMagnitudes, float* pfFilterCoeffs );
void GenerateFilter( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oTOMagnitudes, float* pfFilterCoeffs );
private:
double m_dSamplerate; // Abtastrate der Ausgabefilter [Hz]
......
......@@ -62,7 +62,7 @@ public:
*/
virtual inline void SetIdentity( const bool bSmoothChangeover = true )
{
CITAThirdOctaveGainMagnitudeSpectrum oIdentity;
ITABase::CThirdOctaveGainMagnitudeSpectrum 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 CITAThirdOctaveGainMagnitudeSpectrum& oGains, const bool bSmoothChangeover = true ) = 0;
virtual void SetMagnitudes( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oGains, const bool bSmoothChangeover = true ) = 0;
//! Latenz (Verzögerung) der Filterbank zurückgeben
/**
......
......@@ -70,7 +70,7 @@ public:
pFilter->Release(); // Auto-release
}
inline virtual void SetMagnitudes( const CITAThirdOctaveGainMagnitudeSpectrum& oMags, const bool bSmoothChangeover = true )
inline virtual void SetMagnitudes( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oMags, const bool bSmoothChangeover = true )
{
m_pGenerator->GenerateFilter( oMags, m_pfFilter );
ITAUPFilter* pFilter = m_pConvolver->RequestFilter();
......
......@@ -52,7 +52,7 @@ public:
* @param[in] oMagnitudes Filter magnitudes (dB)
* @param[in] bSmoothChangeover If true, switching is smoothed
*/
void SetMagnitudes( const CITAThirdOctaveGainMagnitudeSpectrum& oMagnitudes, const bool bSmoothChangeover = true );
void SetMagnitudes( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oMagnitudes, const bool bSmoothChangeover = true );
//! Clear all internal accumulators
void Clear();
......@@ -69,7 +69,7 @@ private:
class MagnitudeUpdate
{
public:
CITAThirdOctaveGainMagnitudeSpectrum oMags; //! New magnitudes
ITABase::CThirdOctaveGainMagnitudeSpectrum 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
CITAThirdOctaveGainMagnitudeSpectrum m_oMagnitudesInternal; //!< Interne Verstärkungsfaktoren
ITABase::CThirdOctaveGainMagnitudeSpectrum m_oMagnitudesInternal; //!< Interne Verstärkungsfaktoren
ITASampleBuffer m_sfTempFilterBuf; //!< Intermediate buffer for filter
ITASampleBuffer m_pfTempOutputBuf; //!< Intermediate buffer for output assembly
};
......
......@@ -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 = CITAThirdOctaveMagnitudeSpectrum::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 < CITAThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
m_pfInputFreqs[ i + 1 ] = CITAThirdOctaveMagnitudeSpectrum::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 CITAThirdOctaveGainMagnitudeSpectrum& oTOGainMagnitudes, float* pfFilterCoeffs )
void CITAThirdOctaveFIRFilterGenerator::GenerateFilter( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oTOGainMagnitudes, float* pfFilterCoeffs )
{
m_sw.start();
......@@ -100,7 +102,7 @@ void CITAThirdOctaveFIRFilterGenerator::GenerateFilter( const CITAThirdOctaveGai
// 1st step: Interpolate the magnitudes
m_pfInputData[ 0 ] = 1.0f;
for( int i = 0; i < CITAThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
for( int i = 0; i < CThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
m_pfInputData[ 1 + i ] = float( oTOGainMagnitudes[ i ] );
m_pfInputData[ m_iInputFreqs - 1 ] = 0.0f; // @todo jst: check if this is good
......
......@@ -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 )
{
......
......@@ -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 != CITAThirdOctaveGainMagnitudeSpectrum::GetNumBands() )
if( m_nBandsInternal != ITABase::CThirdOctaveGainMagnitudeSpectrum::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 CITAThirdOctaveGainMagnitudeSpectrum& oMagnitudes, const bool bSmoothChangeover )
void CITAThirdOctaveFilterbankIIR::SetMagnitudes( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oMagnitudes, const bool bSmoothChangeover )
{
CITAThirdOctaveFilterbankIIR::MagnitudeUpdate oUpdate;
oUpdate.oMags = oMagnitudes;
......
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