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

Adding missing files for TO FB Burg

parent 59cfbeab
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2019
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef IW_ITA_DSP_THIRD_OCTAVE_FILTERBANK_IIR_BURG
#define IW_ITA_DSP_THIRD_OCTAVE_FILTERBANK_IIR_BURG
#include <ITADSPDefinitions.h>
#include <ITAThirdOctaveFilterbank.h>
#include <vector>
#include <tbb/concurrent_queue.h>
class CITAIIRFilterEngine;
class CITAThirdOctaveFIRFilterGenerator;
namespace ITADSP
{
namespace ThirdOctaveFilterbank
{
//! Third-octave filterbank realisation using IIR filter structur und Burg coefficient design
/**
* Diese Klasse realisiert eine Terzfilterbank (#CVAThirdOctaveFilterbank) mit der Methode der direct form II
* für Verstärkungsfaktoren eines Terzbank-Betragsspektrums (#CVAThirdOctaveMagnitudes).
*
*/
class ITA_DSP_API CIIRBurg : public CITAThirdOctaveFilterbank
{
public:
//! Konstruktor mit Samplerate und Blocklänge
/**
* \param dSamplerate Samplingrate
* \param iBlocklength Blocklänge
*/
CIIRBurg( const double dSampleRate, const int iBlockLength, const int iFilterOrder = 4 );
//! Destruktor
virtual ~CIIRBurg();
//! Verstärkungen (Gains) setzen
/**
* \param oGains Verstärkungsfaktoren
* \param bSmoothChangeover Wenn true, dann überblenden (default), sonst sofort internen Gain umschalten
*/
void SetMagnitudes( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oGains, const bool );
//! Alle internen Zustände zurücksetzen (Akkumulatoren der Biquads)
void Clear();
//! Verarbeite Samples (Filtern)
/**
* \param pfInputSamples Eingabesamples (Anzahl = Blocklänge)
* \param pfOutputSamples Ausgabesamples (Anzahl = Blocklänge)
*/
void Process( const float* pfInputSamples, float* pfOutputSamples );
private:
int m_iBlockLength; //!< Blocklänge
CITAIIRFilterEngine* m_pFilterEngine;
CITAThirdOctaveFIRFilterGenerator* m_pFilterGenerator;
};
}
}
#endif // IW_ITA_DSP_THIRD_OCTAVE_FILTERBANK_IIR_BURG
#include <ITADSP/ThirdOctaveFilterbank/IIRBurg.h>
#include <ITAIIRFilterEngine.h>
#include <ITAIIRFilterGenerator.h>
#include <ITAThirdOctaveFIRFilterGenerator.h>
using namespace ITADSP::ThirdOctaveFilterbank;
CIIRBurg::CIIRBurg( const double dSampleRate, const int iBlockLength, const int iFilterOrder /* = 4 */ )
: m_iBlockLength( iBlockLength )
{
m_pFilterEngine = new CITAIIRFilterEngine( iFilterOrder );
m_pFilterGenerator = new CITAThirdOctaveFIRFilterGenerator( dSampleRate, (std::max)( 2 * iFilterOrder, 32 ) );
}
CIIRBurg::~CIIRBurg()
{
delete m_pFilterGenerator;
delete m_pFilterEngine;
}
void CIIRBurg::SetMagnitudes( const ITABase::CThirdOctaveGainMagnitudeSpectrum& oGains, const bool )
{
ITABase::CFiniteImpulseResponse oIR( m_pFilterGenerator->GetFilterLength(), (float) m_pFilterGenerator->GetSampleRate(), true );
m_pFilterGenerator->GenerateFilter( oGains, oIR.GetData(), false );
CFilterCoefficients oCoeffs( m_pFilterEngine->GetOrder() );
ITADSP::IIRFilterGenerator::Burg( oIR, oCoeffs );
m_pFilterEngine->SetCoefficients( oCoeffs );
}
void CIIRBurg::Clear()
{
m_pFilterEngine->ClearAccumulators();
}
void ITADSP::ThirdOctaveFilterbank::CIIRBurg::Process( const float* pfInputSamples, float* pfOutputSamples )
{
m_pFilterEngine->Process( pfInputSamples, pfOutputSamples, m_iBlockLength );
}
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