Loading...
Searching...
No Matches
SoundView.hpp
1#pragma once
2#include <Process/LayerView.hpp>
3#include <Process/TimeValue.hpp>
4#include <Process/ZoomHelper.hpp>
5
6#include <Media/AudioArray.hpp>
7#include <Media/MediaFileHandle.hpp>
8#include <Media/Sound/WaveformComputer.hpp>
9
10#include <score/graphics/GraphicsItem.hpp>
11
12#include <ossia/detail/pod_vector.hpp>
13
14#include <verdigris>
15namespace Media
16{
17namespace Sound
18{
19class ProcessModel;
20class LayerView final
21 : public Process::LayerView
22 , public Nano::Observer
23{
24public:
25 explicit LayerView(const ProcessModel& model, QGraphicsItem* parent);
26 ~LayerView();
27
28 void setData(const std::shared_ptr<AudioFile>& data);
29 void setFrontColors(bool);
30 void setTempoRatio(double);
31 void recompute(ZoomRatio ratio);
32 void recompute() const;
33
34 void on_finishedDecoding();
35
36private:
37 void paint_impl(QPainter*) const override;
38 void mousePressEvent(QGraphicsSceneMouseEvent*) override;
39 void dragEnterEvent(QGraphicsSceneDragDropEvent* event) override;
40 void dragLeaveEvent(QGraphicsSceneDragDropEvent* event) override;
41 void dragMoveEvent(QGraphicsSceneDragDropEvent* event) override;
42 void dropEvent(QGraphicsSceneDragDropEvent* event) override;
43
44 void heightChanged(qreal) override;
45 void widthChanged(qreal) override;
46
47 void scrollValueChanged(int);
48
49 void on_newData();
50
51 std::shared_ptr<AudioFile> m_data;
52 int m_numChan{};
53 int m_sampleRate{};
54
55 ZoomRatio m_zoom{};
56 double m_tempoRatio{1.};
57
58 QVector<QImage*> m_images;
59 WaveformComputer* m_cpt{};
60
61 ComputedWaveform m_wf{};
62 const ProcessModel& m_model;
63
64 bool m_frontColors{true};
65 mutable bool m_recomputed{false};
66 mutable bool m_renderAll{true};
67};
68}
69}
Definition SoundView.hpp:23
Definition SoundModel.hpp:27
Definition LayerView.hpp:21
Definition WaveformComputer.hpp:41
Definition WaveformComputer.hpp:55