test_sdk/hw/gtl_hw_audio_input_device.h

35 lines
815 B
C
Raw Permalink Normal View History

#ifndef AUIDIO_INPUT_DEVICE_H
#define AUIDIO_INPUT_DEVICE_H
#include <QIODevice>
#include "hw_global.h"
namespace gtl
{
namespace hw
{
class HW_EXPORT audio_input_device : public QIODevice
{
Q_OBJECT
public:
explicit audio_input_device(QObject *parent = nullptr);
void set_buffer(qreal rate, int frame_bytes);
void get_data(std::back_insert_iterator<std::vector<char> > buffer);
protected:
qint64 readData(char *data, qint64 maxSize) override;
qint64 writeData(const char *data, qint64 maxSize) override;
private:
std::vector<char> _buffer;
int _ptr_recv;
int _ptr_send;
int _frame_bytes;
};
}
}
#endif // AUIDIO_INPUT_DEVICE_H