Loading...
Searching...
No Matches
PdProcess.hpp
1#pragma once
2#include <Process/Process.hpp>
3#include <Process/Script/ScriptProcess.hpp>
4#include <Process/TimeValue.hpp>
5#include <Process/WidgetLayer/WidgetLayerPresenter.hpp>
6#include <Process/WidgetLayer/WidgetLayerView.hpp>
7#include <Process/WidgetLayer/WidgetProcessFactory.hpp>
8
9#include <Pd/PdInstance.hpp>
10#include <Pd/PdMetadata.hpp>
11
12#include <score/model/Identifier.hpp>
13#include <score/selection/Selection.hpp>
14#include <score/serialization/VisitorInterface.hpp>
15
16#include <ossia/network/dataspace/dataspace.hpp>
17#include <ossia/network/domain/domain.hpp>
18namespace Pd
19{
20
21const QString& locatePdBinary() noexcept;
22
24{
25 struct Control
26 {
27 QString name; // Pretty name
28 QString remote; // Name used for send/receive
29 QString type;
30 QString widget;
31 QString unit;
32 ossia::value defaultv;
33 ossia::domain domain;
34 std::optional<ossia::val_type> deduced_type;
35 };
36 std::vector<Control> receives, sends;
37};
38
40{
41 SCORE_SERIALIZE_FRIENDS
42 PROCESS_METADATA_IMPL(Pd::ProcessModel)
43 W_OBJECT(ProcessModel)
44
45public:
47 explicit ProcessModel(
48 const TimeVal& duration, const QString& pdpatch,
49 const Id<Process::ProcessModel>& id, QObject* parent);
50
51 template <typename Impl>
52 explicit ProcessModel(Impl& vis, QObject* parent)
53 : Process::ProcessModel{vis, parent}
54 {
55 init();
56 vis.writeTo(*this);
57 }
58
59 bool hasExternalUI() const noexcept;
60
61 [[nodiscard]] Process::ScriptChangeResult setScript(const QString& script);
62 const QString& script() const;
63
64 ~ProcessModel() override;
65
66 const PatchSpec& patchSpec() const noexcept { return m_spec; }
67 int audioInputs() const;
68 int audioOutputs() const;
69 bool midiInput() const;
70 bool midiOutput() const;
71
72 void setAudioInputs(int audioInputs);
73 void setAudioOutputs(int audioOutputs);
74 void setMidiInput(bool midiInput);
75 void setMidiOutput(bool midiOutput);
76
77 void scriptChanged(QString v) W_SIGNAL(scriptChanged, v);
78 void programChanged() W_SIGNAL(programChanged);
79 void audioInputsChanged(int v) W_SIGNAL(audioInputsChanged, v);
80 void audioOutputsChanged(int v) W_SIGNAL(audioOutputsChanged, v);
81 void midiInputChanged(bool v) W_SIGNAL(midiInputChanged, v);
82 void midiOutputChanged(bool v) W_SIGNAL(midiOutputChanged, v);
83
84 W_PROPERTY(
85 int, audioInputs READ audioInputs WRITE setAudioInputs NOTIFY audioInputsChanged)
86 W_PROPERTY(
87 int,
88 audioOutputs READ audioOutputs WRITE setAudioOutputs NOTIFY audioOutputsChanged)
89 W_PROPERTY(bool, midiInput READ midiInput WRITE setMidiInput NOTIFY midiInputChanged)
90 W_PROPERTY(
91 bool, midiOutput READ midiOutput WRITE setMidiOutput NOTIFY midiOutputChanged)
92
93 PROPERTY(QString, script READ script WRITE setScript NOTIFY scriptChanged)
94 std::shared_ptr<Instance> m_instance;
95
96private:
97 QString effect() const noexcept override;
98 void loadPreset(const Process::Preset& preset) override;
99 Process::Preset savePreset() const noexcept override;
100 void init();
101 QString m_script;
102 PatchSpec m_spec;
103 int m_audioInputs{0};
104 int m_audioOutputs{0};
105 bool m_midiInput{};
106 bool m_midiOutput{};
107};
108}
Definition PdProcess.hpp:40
The Process class.
Definition score-lib-process/Process/Process.hpp:61
The id_base_t class.
Definition Identifier.hpp:57
Definition PdProcess.hpp:26
Definition PdProcess.hpp:24
Definition Preset.hpp:32
Definition ScriptProcess.hpp:14
Definition TimeValue.hpp:21