Loading...
Searching...
No Matches
plugins/score-plugin-vst3/Vst3/commands.hpp
1#pragma once
2#include <Dataflow/Commands/CableHelpers.hpp>
3
4#include <score/command/Command.hpp>
5
6#include <pluginterfaces/vst/ivsteditcontroller.h>
7
8namespace Process
9{
10class Port;
11class Cable;
12class Inlet;
13}
14namespace vst3
15{
16const CommandGroupKey& CommandFactoryName();
17class Model;
18class ControlInlet;
19class SetControl final : public score::Command
20{
21 SCORE_COMMAND_DECL(CommandFactoryName(), SetControl, "Set a control")
22
23public:
24 SetControl(const ControlInlet& obj, float newval);
25 virtual ~SetControl();
26
27 void undo(const score::DocumentContext& ctx) const final override;
28 void redo(const score::DocumentContext& ctx) const final override;
29 void update(const ControlInlet& obj, float newval);
30
31protected:
32 void serializeImpl(DataStreamInput& stream) const final override;
33 void deserializeImpl(DataStreamOutput& stream) final override;
34
35private:
36 Path<ControlInlet> m_path;
37 float m_old, m_new;
38};
39
40class CreateControl final : public score::Command
41{
42 SCORE_COMMAND_DECL(CommandFactoryName(), CreateControl, "Create a control")
43
44public:
45 CreateControl(const Model& obj, Steinberg::Vst::ParamID fxNum);
46 virtual ~CreateControl();
47 void undo(const score::DocumentContext& ctx) const final override;
48 void redo(const score::DocumentContext& ctx) const final override;
49
50protected:
51 void serializeImpl(DataStreamInput& stream) const final override;
52 void deserializeImpl(DataStreamOutput& stream) final override;
53
54private:
55 Path<Model> m_path;
56 Steinberg::Vst::ParamID m_fxNum{};
57 static_assert(sizeof(Steinberg::Vst::ParamID) == sizeof(uint32_t));
58};
59
60class RemoveControl final : public score::Command
61{
62 SCORE_COMMAND_DECL(CommandFactoryName(), RemoveControl, "Remove a control")
63
64public:
66 virtual ~RemoveControl();
67 void undo(const score::DocumentContext& ctx) const final override;
68 void redo(const score::DocumentContext& ctx) const final override;
69
70protected:
71 void serializeImpl(DataStreamInput& stream) const final override;
72 void deserializeImpl(DataStreamOutput& stream) final override;
73
74private:
75 Path<Model> m_path;
77 QByteArray m_control;
78 Dataflow::SerializedCables m_cables;
79};
80}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
The id_base_t class.
Definition Identifier.hpp:57
The Command class.
Definition Command.hpp:34
Definition /Vst3/Control.hpp:19
Definition plugins/score-plugin-vst3/Vst3/commands.hpp:41
Definition score-plugin-vst3/Vst3/EffectModel.hpp:43
Definition plugins/score-plugin-vst3/Vst3/commands.hpp:61
Definition plugins/score-plugin-vst3/Vst3/commands.hpp:20
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18