2018-07-09 18:05:31 +00:00
|
|
|
#ifndef AMUSE_SAMPLE_EDITOR_HPP
|
|
|
|
#define AMUSE_SAMPLE_EDITOR_HPP
|
|
|
|
|
2018-07-14 06:06:33 +00:00
|
|
|
#include "EditorWidget.hpp"
|
2018-07-30 06:20:03 +00:00
|
|
|
#include "ProjectModel.hpp"
|
|
|
|
|
|
|
|
class SampleView : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
qreal m_samplesPerPx = 100.0;
|
|
|
|
amuse::ObjToken<ProjectModel::SampleNode> m_node;
|
|
|
|
amuse::ObjToken<amuse::SampleEntryData> m_sample;
|
|
|
|
const unsigned char* m_sampleData = nullptr;
|
|
|
|
qreal m_curSamplePos = 0.0;
|
|
|
|
int16_t m_prev1 = 0;
|
|
|
|
int16_t m_prev2 = 0;
|
|
|
|
void seekToSample(qreal sample);
|
|
|
|
std::pair<std::pair<qreal, qreal>, std::pair<qreal, qreal>> iterateSampleInterval(qreal interval);
|
|
|
|
public:
|
|
|
|
explicit SampleView(QWidget* parent = Q_NULLPTR);
|
|
|
|
void loadData(ProjectModel::SampleNode* node);
|
|
|
|
void unloadData();
|
|
|
|
ProjectModel::INode* currentNode() const;
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent* ev);
|
|
|
|
void mousePressEvent(QMouseEvent* ev);
|
|
|
|
void mouseReleaseEvent(QMouseEvent* ev);
|
|
|
|
void mouseMoveEvent(QMouseEvent* ev);
|
|
|
|
};
|
2018-07-09 18:05:31 +00:00
|
|
|
|
2018-07-14 06:06:33 +00:00
|
|
|
class SampleEditor : public EditorWidget
|
2018-07-09 18:05:31 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-07-30 06:20:03 +00:00
|
|
|
SampleView* m_sampleView;
|
2018-07-09 18:05:31 +00:00
|
|
|
public:
|
|
|
|
explicit SampleEditor(QWidget* parent = Q_NULLPTR);
|
2018-07-29 03:37:06 +00:00
|
|
|
bool loadData(ProjectModel::SampleNode* node);
|
2018-07-30 06:20:03 +00:00
|
|
|
void unloadData();
|
|
|
|
ProjectModel::INode* currentNode() const;
|
2018-07-09 18:05:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //AMUSE_SAMPLE_EDITOR_HPP
|