2024-09-04 17:57:23 +08:00
|
|
|
#ifndef __SPEEXDSP_H__
|
|
|
|
#define __SPEEXDSP_H__
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
typedef struct SpeexEchoState_ SpeexEchoState;
|
|
|
|
typedef struct SpeexPreprocessState_ SpeexPreprocessState;
|
|
|
|
|
|
|
|
class SpeexDsp {
|
|
|
|
public:
|
2024-09-04 20:17:15 +08:00
|
|
|
~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);
|
2024-09-04 17:57:23 +08:00
|
|
|
void reset();
|
|
|
|
|
|
|
|
private:
|
2024-09-04 20:17:15 +08:00
|
|
|
SpeexEchoState *m_echoState = nullptr;
|
|
|
|
SpeexPreprocessState *m_preprocessState = nullptr;
|
2024-09-04 17:57:23 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SPEEXDSP_H__
|