// --------------------------------------------------------------
// --------------------------------------------------------------
#ifndef _SMOOTH_H_
#define	_SMOOTH_H_

#include "synth_defs.h"

#define SMOOTH_TOL		((synth_float_t)(1E-4))
#define SMOOTH_KE		((synth_float_t)(1-exp(-1)))

// --------------------------------------------------------------
// Types
// --------------------------------------------------------------
typedef struct _ssmooth_t
{
	synth_float_t y, fs;
	synth_float_t T_r, a_r;
	synth_float_t T_f, a_f;

} smooth_t;

// --------------------------------------------------------------
#if defined(__cplusplus)
extern "C" {
#endif

// --------------------------------------------------------------
// Exported functions
// --------------------------------------------------------------
void Smooth_Init(smooth_t *pObj, synth_float_t fs, synth_float_t T_r, synth_float_t T_f, synth_float_t inital_value);
void Smooth_Free(smooth_t *pObj);
void Smooth_SetValue(smooth_t *pObj, synth_float_t value);
void Smooth_SetFS(smooth_t *pObj, synth_float_t fs);
void Smooth_SetT(smooth_t *pObj, synth_float_t T_r, synth_float_t T_f);
synth_float_t Smooth_ProcessScalar(smooth_t *pObj, synth_float_t x_hard, synth_float_t in);
void Smooth_Process_VV(smooth_t *pObj, synth_float_t x_hard, synth_float_t *pIn, synth_float_t *pOut, UINT32 len);
void Smooth_Process_V(smooth_t *pObj, synth_float_t x_hard, synth_float_t *pOut, UINT32 len);
UINT32 Smooth_is_settled(smooth_t *pObj, synth_float_t x_hard);

#if defined(__cplusplus)
}

#endif
// --------------------------------------------------------------

#endif // _SMOOTH_H_
