test_sdk/hw/gtl_hw_player.h

53 lines
1.3 KiB
C++

#ifndef PLAYER_H
#define PLAYER_H
#include "hw_global.h"
#include "hw/gtl_hw_device.h"
#include "hw/gtl_hw_generator_analog_input.h"
#include "hw/gtl_hw_player_file.h"
namespace gtl
{
namespace hw
{
class HW_EXPORT player : public device
{
Q_OBJECT
public:
player(QObject* parent = nullptr);
virtual QString type() const override;
virtual bool start(QString id, qreal rate) override;
// virtual
virtual void save(QDomElement& root_element) override;
player_file* file() const;
private:
virtual void run() override;
bool get_data(int &idx, int& samples, bool is_cyclic, std::back_insert_iterator<std::vector<qreal>>);
qreal total_time();
private:
player_file* _file;
bool _is_suspended;
bool _is_cyclic;
qreal _time;
qreal _pos;
qreal _speed_factor;
int _sampling;
std::vector<std::pair<int, int>> _ranges_indices;
std::vector<qreal> _buffer_tmp;
public slots:
virtual void get_parameter(int idx, QVariant &value) override;
virtual void set_parameter(int idx, const QVariant &value) override;
};
}
}
#endif // PLAYER_H