#ifndef __SPEEXDSP_H__
#define __SPEEXDSP_H__

#include <cstdint>

typedef struct SpeexEchoState_ SpeexEchoState;
typedef struct SpeexPreprocessState_ SpeexPreprocessState;

class SpeexDsp {
public:
    ~SpeexDsp();
    void start(int sampleRate, int channels, int period);
    void close();
    void preprocess(int16_t *pcm);

    void echoCancellation(const int16_t *record, const int16_t *play, int16_t *out);

    void echoPlayback(const int16_t *play);
    void echoCapture(const int16_t *record, int16_t *out);
    void reset();

private:
    SpeexEchoState *m_echoState = nullptr;
    SpeexPreprocessState *m_preprocessState = nullptr;
};

#endif // __SPEEXDSP_H__