Loading...
Searching...
No Matches
plugins/score-plugin-vst/Vst/commands.hpp
1#pragma once
2#include <Dataflow/Commands/CableHelpers.hpp>
3#include <Media/Commands/MediaCommandFactory.hpp>
4
5#include <score/command/Command.hpp>
6
7namespace Process
8{
9class Port;
10class Cable;
11class Inlet;
12}
13namespace vst
14{
15class Model;
16class ControlInlet;
17const CommandGroupKey& CommandFactoryName();
18
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, int fxNum, float value);
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 int m_fxNum{};
57 float m_val{};
58};
59
60class RemoveControl final : public score::Command
61{
62 SCORE_COMMAND_DECL(CommandFactoryName(), RemoveControl, "Remove a control")
63
64public:
65 RemoveControl(const Model& obj, Id<Process::Port> id);
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 Vst/Control.hpp:19
Definition plugins/score-plugin-vst/Vst/commands.hpp:41
Definition plugins/score-plugin-vst/Vst/commands.hpp:61
Definition plugins/score-plugin-vst/Vst/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