#ifndef _FilterBank_h_
#define _FilterBank_h_
/* David Weenink, 20010609  */

#ifndef _Matrix_h_
	#include "Matrix.h"
#endif
#ifndef _Graphics_h_
	#include "Graphics.h"
#endif
#ifndef _TableOfReal_h_
	#include "TableOfReal.h"
#endif
#ifndef _Spectrum_h_
	#include "Spectrum.h"
#endif
#ifndef _MFCC_h_
	#include "MFCC.h"
#endif
#ifndef _Intensity_h_
	#include "Intensity.h"
#endif

#define HZTOBARK(x) NUMhertzToBark2(x)
#define HZTOMEL(x)	NUMhertzToMel2(x)
#define BARKTOHZ(x) NUMbarkToHertz2(x)
#define MELTOHZ(x)	NUMmelToHertz2(x)

#define FilterBank_DBREF 4e-10
#define FilterBank_DBFAC 1
#define FilterBank_DBFLOOR -20

#define BarkFilter_members Matrix_members
#define BarkFilter_methods Matrix_methods
class_create (BarkFilter, Matrix)

/*
Interpretatie:
	xmin, xmax, x1, dx, nx als Sampled.
	ymin, ymax laagste en hoogste frequentie in Barks.
    y1 midden eerste filter (bark).
    dy de afstand van de filters (bark).
    ny het aantal filters.
 */

void FilterBank_drawTimeSlice (I, Graphics g, double t, double fmin, double fmax,
	double min, double max, char *xlabel, int garnish);
 
BarkFilter BarkFilter_create (double tmin, double tmax, long nt, double dt,
	double t1, double fmin, double fmax, long nf, double df, long f1);

BarkFilter Matrix_to_BarkFilter (I);


#define MelFilter_members Matrix_members
#define MelFilter_methods Matrix_methods
class_create (MelFilter, Matrix)

/*
Interpretatie:
	xmin, xmax, x1, dx, nx als Sampled.
	ymin, ymax laagste en hoogste frequentie in mels.
    y1 midden eerste filter (mels).
    dy de afstand van de filters (mel).
    ny het aantal filters.
 */

MelFilter MelFilter_create (double tmin, double tmax, long nt, double dt,
	double t1, double fmin, double fmax, long nf, double df, double f1);

MelFilter Matrix_to_MelFilter (I);

MFCC MelFilter_to_MFCC (MelFilter me, long numberOfCoefficients);

#define FormantFilter_members Matrix_members
#define FormantFilter_methods Matrix_methods
class_create (FormantFilter, Matrix)

FormantFilter FormantFilter_create (double tmin, double tmax, long nt, 
	double dt, double t1, double fmin, double fmax, long nf, double df, 
	double f1);

FormantFilter Matrix_to_FormantFilter (I);

void FilterBank_equalizeIntensities (I, double intensity_db);

Matrix FilterBank_to_Matrix (I);
/* Generieke ...Filters_to_Matrix */

Spectrum FormantFilter_to_Spectrum_slice (FormantFilter me, double t);
/*
	Calculate amplitude spectrum at time t.
	power[i] = ref * 10 ^ (my z[i][t] / 10)
	spec->z[1][i] = sqrt(power[i]) = sqrt(ref) * 10 ^ (my z[i][t] / (2*10))
	spec->z[2][i] = 0
*/

Intensity FilterBank_to_Intensity (I);

#endif /* _FilterBank_h_ */
