#ifndef RUNTIMERECORDER_H
#define RUNTIMERECORDER_H

#include <QObject>

#include <QObject>
#include <QAudioRecorder>//录音
#include <QAudioEncoderSettings>//音频编码器
#include <QAudioBuffer>//音频缓存
#include <QAudioProbe> //音频探针
#include <QUdpSocket> //UDP套接字
#include <QHostAddress> //主机地址
#include <QUrl> //文件地址
#include <QAudioEncoderSettings>

#include "msgpane.h"
#include "channelmessage.h"

class RuntimeRecorder : public QObject
{
    Q_OBJECT
public:
    explicit RuntimeRecorder(QObject *parent = nullptr);
    void startRuntimeRecord();
    void stopRuntimeRecord();

    void sendRuntimeRcord();

signals:
    void sigShowText(const QString str);

public slots:
//    //用户异步状态监测，反映录音对象的实际工作状态
//    void onStatusChanged(QMediaRecorder::Status status);
//    //录音时长监测，单位毫秒
//    void onDurationChanged(qint64 duration);

private:
    //录音对象
    QAudioRecorder *m_aRecorder = nullptr;
    //编码器对象
    QAudioEncoderSettings  m_aEncoder;
    //音频探针对象
    QAudioProbe *m_aProbe=nullptr;

    void *session=nullptr;

    void initSession();
    void closeSession();

};

#endif // RUNTIMERECORDER_H
