/*---------------------------------------------------------------------------*/
/*
  File: saec.h

  Acoustic echo canceller.
*/
/*---------------------------------------------------------------------------*/

#ifndef SAEC_H_
#define SAEC_H_

#include "sdsputil.h"
#include "freqaec.h"
/*
#include "fft.h"
#include "freqaecf.h"
*/

#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------*/
NAMESPACE_BEGIN

#define SAEC_MAX_PREDELAY_SIZE      2048

typedef struct softdsp_aec_s
{
    word predelay_size;
    word predelay_read_pos;
    word predelay_write_pos;
    short predelay_sample_buffer[SAEC_MAX_PREDELAY_SIZE];

    t_freqaec ec;
} t_softdsp_aec;

void softdsp_aec_init(t_softdsp_aec *p_aec, word frame_length, word tail_frames, word predelay_samples, word options,
    dword nominal_return_loss, word max_loop_gain, word noise_suppress_level);
void softdsp_aec_flush(t_softdsp_aec *p_aec, word preserve_filter_frames);
void softdsp_aec_s_exec(t_softdsp_aec *p_aec, const short *sin_samples, short *sout_samples, word sample_count);
void softdsp_aec_r_exec(t_softdsp_aec *p_aec, const short *rin_samples, short *rout_samples, word sample_count);


NAMESPACE_END
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif

#endif

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