Loading...
Searching...
No Matches
/Vst3/Widgets.hpp
1#pragma once
2#include <Process/Style/ScenarioStyle.hpp>
3
4#include <Vst3/EffectModel.hpp>
5
6#include <score/graphics/GraphicWidgets.hpp>
7#include <score/graphics/TextItem.hpp>
8
9#include <ossia/dataflow/safe_nodes/port.hpp>
10
11#include <QDialog>
12
13#include <verdigris>
14
15namespace vst3
16{
18{
19 QGraphicsItem* rootItem{};
20 std::vector<std::pair<ControlInlet*, score::EmptyRectItem*>> controlItems;
21
22public:
23 VSTEffectItem(const Model& effect, const Process::Context& doc, QGraphicsItem* root);
24
25 void setupInlet(const Model& fx, ControlInlet& inlet, const Process::Context& doc);
26
27private:
28 void updateRect();
29};
30
32 : public QObject
33 , public score::QGraphicsSliderBase<VSTGraphicsSlider>
34{
35 W_OBJECT(VSTGraphicsSlider)
36 Q_INTERFACES(QGraphicsItem)
37 friend struct QGraphicsSliderBase<VSTGraphicsSlider>;
38
39 double m_value{};
40 double m_execValue{};
41 Steinberg::Vst::IEditController* fx{};
42 Steinberg::Vst::ParamID num{};
43
44private:
45 bool m_grab{};
46 bool m_hasExec{};
47
48public:
49 static const constexpr double min = 0.;
50 static const constexpr double max = 1.;
51 double init = 0.5;
52 friend struct score::DefaultControlImpl;
55 Steinberg::Vst::IEditController* fx, Steinberg::Vst::ParamID num,
56 QGraphicsItem* parent);
57
58 static double from01(double v) { return v; }
59 static double map(double v) { return v; }
60 static double unmap(double v) { return v; }
61
62 void setValue(double v);
63 double value() const;
64 void setExecutionValue(const ossia::value& v);
65 void resetExecution();
66
67 bool moving = false;
68
69public:
70 void valueChanged(double arg_1) W_SIGNAL(valueChanged, arg_1);
71 void sliderMoved() W_SIGNAL(sliderMoved);
72 void sliderReleased() W_SIGNAL(sliderReleased);
73
74private:
75 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
76 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
77 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
78 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
79 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
80 override;
81};
82
84{
85 const std::string_view name;
86
87 explicit constexpr VSTFloatSlider(const char* name)
88 : name{name}
89 {
90 }
91
92 static QWidget* make_widget(
93 Steinberg::Vst::IEditController* fx, const ControlInlet& inlet,
94 const score::DocumentContext& ctx, QWidget* parent, QObject* context);
95 static QGraphicsItem* make_item(
96 Steinberg::Vst::IEditController* fx, ControlInlet& inlet,
97 const score::DocumentContext& ctx, QGraphicsItem* parent, QObject* context);
98};
99
100}
Definition RectItem.hpp:64
Definition /Vst3/Control.hpp:19
Definition score-plugin-vst3/Vst3/EffectModel.hpp:43
Definition /Vst3/Widgets.hpp:18
Definition /Vst3/Widgets.hpp:34
Definition ProcessContext.hpp:12
Definition DefaultControlImpl.hpp:10
Definition DefaultGraphicsSliderImpl.hpp:31
Definition DocumentContext.hpp:18
Definition QGraphicsSliderBase.hpp:17
Definition /Vst3/Widgets.hpp:84