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

More namespace adaptions, now also in some tests

parent fa7d59c0
......@@ -30,7 +30,7 @@
* Sie wird durch die Realisierungsmethoden (#FilterbankRealisationMethods) mittels Factory Method
* erstellt und kann dann Eingabesamples im Process()-Schritt filtern.
*
* Die Datensätze der Terzbandspektren werden durch die Klasse \CITAThirdOctaveMagnitudeSpectrum verwaltet.
* Die Datensätze der Terzbandspektren werden durch die Klasse \CThirdOctaveMagnitudeSpectrum verwaltet.
*
*/
class ITA_DSP_API CITAThirdOctaveFilterbank
......
......@@ -20,11 +20,11 @@ CITAThirdOctaveFIRFilterGenerator::CITAThirdOctaveFIRFilterGenerator( const doub
, m_pfBuf2( nullptr )
, m_bWindow( false )
{
m_iInputFreqs = CThirdOctaveMagnitudeSpectrum::GetNumBands() + 2;
m_iInputFreqs = CThirdOctaveGainMagnitudeSpectrum::GetNumBands() + 2;
m_pfInputFreqs = fm_falloc( m_iInputFreqs, true );
m_pfInputFreqs[ 0 ] = 0; // Left margin
for( int i = 0; i < CThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
m_pfInputFreqs[ i + 1 ] = CThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ i ];
for( int i = 0; i < CThirdOctaveGainMagnitudeSpectrum::GetNumBands(); i++ )
m_pfInputFreqs[ i + 1 ] = CThirdOctaveGainMagnitudeSpectrum::GetCenterFrequencies()[ i ];
m_pfInputFreqs[ m_iInputFreqs - 1 ] = ( float ) dSampleRate / 2; // Right margin: Nyquist frequency
m_pfInputData = fm_falloc( m_iInputFreqs, true );
......@@ -102,7 +102,7 @@ void CITAThirdOctaveFIRFilterGenerator::GenerateFilter( const ITABase::CThirdOct
// 1st step: Interpolate the magnitudes
m_pfInputData[ 0 ] = 1.0f;
for( int i = 0; i < CThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
for( int i = 0; i < CThirdOctaveGainMagnitudeSpectrum::GetNumBands(); i++ )
m_pfInputData[ 1 + i ] = float( oTOGainMagnitudes[ i ] );
m_pfInputData[ m_iInputFreqs - 1 ] = 0.0f; // @todo jst: check if this is good
......
......@@ -31,8 +31,8 @@
using namespace std;
const double g_dSampleRate = 44100;
//const int g_iFilterLength = int( ceil( g_dSampleRate / CITAThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
const int g_iFilterLength = int( 10 * ceil( g_dSampleRate / CITAThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
//const int g_iFilterLength = int( ceil( g_dSampleRate / CThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
const int g_iFilterLength = int( 10 * ceil( g_dSampleRate / ITABase::CThirdOctaveGainMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
void TestThirdOctaveFilterGeneratorFIRIdentity();
void TestThirdOctaveFilterGeneratorFIRZero();
......@@ -48,7 +48,7 @@ int main( int, char** )
void TestThirdOctaveFilterGeneratorFIRIdentity()
{
CITAThirdOctaveGainMagnitudeSpectrum oMags;
ITABase::CThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetIdentity();
ITASampleBuffer oFilter( g_iFilterLength );
......@@ -63,7 +63,7 @@ void TestThirdOctaveFilterGeneratorFIRIdentity()
void TestThirdOctaveFilterGeneratorFIRZero()
{
CITAThirdOctaveGainMagnitudeSpectrum oMags;
ITABase::CThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetZero();
ITASampleBuffer oFilter( g_iFilterLength );
......@@ -78,12 +78,12 @@ void TestThirdOctaveFilterGeneratorFIRZero()
void TestThirdOctaveFilterGeneratorFIRSingleBands()
{
ITASampleFrame oFilter( CITAThirdOctaveMagnitudeSpectrum::GetNumBands(), g_iFilterLength, true );
ITASampleFrame oFilter( ITABase::CThirdOctaveGainMagnitudeSpectrum::GetNumBands(), g_iFilterLength, true );
CITAThirdOctaveFIRFilterGenerator oFilterGenerator( g_dSampleRate, g_iFilterLength );
CITAThirdOctaveGainMagnitudeSpectrum oMags;
for( int i = 0; i < CITAThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
ITABase::CThirdOctaveGainMagnitudeSpectrum oMags;
for( int i = 0; i < ITABase::CThirdOctaveGainMagnitudeSpectrum::GetNumBands(); i++ )
{
oMags.SetZero();
oMags[ i ] = 1.0f;
......
......@@ -9,11 +9,12 @@
#include <iostream>
using namespace ITABase;
using namespace std;
const double g_dSampleRate = 44100;
//const int g_iFilterLength = int( ceil( g_dSampleRate / CITAThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
const int g_iFilterLength = int( 10 * ceil( g_dSampleRate / CITAThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
//const int g_iFilterLength = int( ceil( g_dSampleRate / CThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
const int g_iFilterLength = int( 10 * ceil( g_dSampleRate / CThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
void TestThirdOctaveFilterGeneratorFIRIdentity();
void TestThirdOctaveFilterGeneratorFIRZero();
......@@ -29,7 +30,7 @@ int main( int, char** )
void TestThirdOctaveFilterGeneratorFIRIdentity()
{
CITAThirdOctaveGainMagnitudeSpectrum oMags;
CThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetIdentity();
ITASampleBuffer oFilter( g_iFilterLength );
......@@ -44,7 +45,7 @@ void TestThirdOctaveFilterGeneratorFIRIdentity()
void TestThirdOctaveFilterGeneratorFIRZero()
{
CITAThirdOctaveGainMagnitudeSpectrum oMags;
CThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetZero();
ITASampleBuffer oFilter( g_iFilterLength );
......@@ -59,12 +60,12 @@ void TestThirdOctaveFilterGeneratorFIRZero()
void TestThirdOctaveFilterGeneratorFIRSingleBands()
{
ITASampleFrame oFilter( CITAThirdOctaveMagnitudeSpectrum::GetNumBands(), g_iFilterLength, true );
ITASampleFrame oFilter( CThirdOctaveMagnitudeSpectrum::GetNumBands(), g_iFilterLength, true );
CITAThirdOctaveFIRFilterGenerator oFilterGenerator( g_dSampleRate, g_iFilterLength );
CITAThirdOctaveGainMagnitudeSpectrum oMags;
for( int i = 0; i < CITAThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
CThirdOctaveGainMagnitudeSpectrum oMags;
for( int i = 0; i < CThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
{
oMags.SetZero();
oMags[ i ] = 1.0f;
......
......@@ -29,7 +29,7 @@ void TestThirdOctaveFilterbankIIR()
ITASampleBuffer x( iSampleLength, true );
x[ 0 ] = 1.0f;
CITAThirdOctaveGainMagnitudeSpectrum oMags;
ITABase::CThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetIdentity();
pIIRFilterbank->SetMagnitudes( oMags, false );
......@@ -90,7 +90,7 @@ void TestThirdOctaveFilterbankFIR()
ITASampleBuffer x( iSampleLength );
x[ 0 ] = 1.0f;
CITAThirdOctaveGainMagnitudeSpectrum oMags;
ITABase::CThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetIdentity();
pIIRFilterbank->SetMagnitudes( oMags, false );
......
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