#ifndef AUDIOCAPTURE_H
#define AUDIOCAPTURE_H

#include <QObject>
#include <QtMultimedia/QAudioInput>

class CCycleBuffer;

class AudioCapture : public QObject
{
    Q_OBJECT
public:
    explicit AudioCapture(CCycleBuffer *buf);
    ~AudioCapture();

    int capture_init(const QAudioDeviceInfo &deviceInfo, int nsamplerate, int nchannels, int nsamplesize);
    void capture_deinit();
    void set_volume(qreal Volume);
    qreal volume();

    QAudioInput *audioInput;
    QIODevice *device;
    QAudioFormat m_format;

    CCycleBuffer *m_audio_buf;
    bool m_audio_click;
public slots:
    void read_data();

Q_SIGNALS:

private:
    char m_buf[8*1024];

};

#endif // AUDIOCAPTURE_H
