FaceAccess/Record/main.h

49 lines
901 B
C
Raw Normal View History

2024-09-04 17:57:23 +08:00
#ifndef __MAIN_H__
#define __MAIN_H__
#include "RkAudio.h"
#include <fstream>
#include <memory>
class Task {
public:
virtual void run() = 0;
};
class RecorderTask : public Task {
public:
void run() final;
private:
std::shared_ptr<RkAudio::Input> m_input;
std::shared_ptr<std::ofstream> m_ofs;
};
class PlayerTask : public Task {
public:
void setPath(const std::string &path);
void run() final;
protected:
void play();
private:
std::string m_path;
std::shared_ptr<std::ifstream> m_ifs;
std::shared_ptr<RkAudio::Output> m_output;
};
class EchoRecordTask : public Task {
public:
void setVqeEnabled(bool enabled);
void setChannels(int channels);
void run() final;
private:
int m_channels = 2;
bool m_vqeEnabled = false;
std::shared_ptr<RkAudio::Output> m_output;
std::shared_ptr<RkAudio::Input> m_input;
};
#endif // __MAIN_H__