/*-----------------------------------------------------------------------------

� 1999, Steinberg Soft und Hardware GmbH, All Rights Reserved

-----------------------------------------------------------------------------*/
#ifndef __FILTER_H
#define __FILTER_H

#include <stdint.h>

#include <public.sdk/source/vst2.x/audioeffectx.h>

class Filter : public AudioEffectX
{
public:
	Filter(audioMasterCallback audioMaster);
	~Filter();

	virtual void process(float **inputs, float **outputs, int32_t sampleFrames) override;
	virtual void processReplacing(float **inputs, float **outputs, int32_t sampleFrames) override;
	virtual void setProgramName(char *name) override;
	virtual void getProgramName(char *name) override;
	virtual void setParameter(int32_t index, float value) override;
	virtual float getParameter(int32_t index) override;
	virtual void getParameterLabel(int32_t index, char *label) override;
	virtual void getParameterDisplay(int32_t index, char *text) override;
	virtual void getParameterName(int32_t index, char *text) override;
	virtual void setSampleRate(float sampleRate) override;
	virtual void setBlockSize(int32_t blockSize) override;

protected:
	float m_fg, m_paramFg, m_smFg;
	float m_harmonicsEven, m_harmonicsOdd, m_smHarmonicsEven, m_smHarmonicsOdd;
	float m_process, m_smProcess;
	int m_audition;
	long m_filterType; float m_paramFilterType;		
	long m_filterOrder; float m_paramFilterOrder;
	float m_filterQ, m_paramFilterQ, m_smFilterQ;
	float m_paramFilterMode; int m_filterMode;
	int isFilterFgChanged, isFilterTypedChanged, isFilterOrderChanged, isSampleRateChanged;
	int isHarmonicsEvenChanged, isHarmonicsOddChanged;

	char programName[32];
	char dbgStr[80];
	IIRPARAM m_filterParms;
	IIRCOEFF m_filterCoeffEven[2][8], m_filterCoeffOdd[2][8];
	int m_nInputs, m_nOutputs;
	float **m_ppEven, **m_ppOdd, **m_ppPreFiltered, *m_pDC;
	float m_knormEven, m_knormOdd, m_keven, m_kodd;
};

#endif
