#ifndef __MAIN_H__ #define __MAIN_H__ #include "RkAudio.h" #include #include class SpeexDsp; class WebRtcAecm; enum Dsp { Vqe, Speex, AecMobile, Aec3, }; class Task { public: virtual void run() = 0; virtual ~Task() { } }; class RecorderTask : public Task { public: void run() final; private: std::shared_ptr m_input; std::shared_ptr m_ofs; }; class PlayerTask : public Task { public: void setChannels(int channels); void setPath(const std::string &path); void run() final; protected: void play(); private: int m_channels = 2; std::string m_path; std::vector m_buffer; std::shared_ptr m_ifs; std::shared_ptr m_output; }; class EchoRecordPrivate; class EchoRecordTask : public Task { public: EchoRecordTask(); ~EchoRecordTask(); void setDsp(Dsp dsp); void setChannels(int channels); void run() final; private: int m_channels = 2; Dsp m_dsp = Vqe; std::shared_ptr m_output; std::shared_ptr m_input; std::shared_ptr m_speex; std::shared_ptr m_webRtcAecm; std::vector m_outBuffer; std::vector m_nearendBuffer; std::vector m_farendBuffer; EchoRecordPrivate *m_d = nullptr; }; Dsp dspFromString(const std::string &dsp); std::string dspToString(Dsp dsp); #endif // __MAIN_H__