2 #include <Process/Dataflow/PortFactory.hpp>
3 #include <Process/Execution/ProcessComponent.hpp>
4 #include <Process/ExecutionContext.hpp>
5 #include <Process/GenericProcessFactory.hpp>
6 #include <Process/Process.hpp>
7 #include <Process/ProcessFactory.hpp>
9 #include <Control/DefaultEffectItem.hpp>
10 #include <Effect/EffectFactory.hpp>
12 #include <score/tools/IdentifierGeneration.hpp>
14 #include <ossia/dataflow/execution_state.hpp>
15 #include <ossia/dataflow/node_process.hpp>
17 #include <Faust/FaustUtils.hpp>
21 template <
typename DSP>
25 template <
typename DSP>
28 static Q_DECL_RELAXED_CONSTEXPR
const char* get() {
return "Audio"; }
30 template <
typename DSP>
33 static QStringList get()
35 QStringList lst{
"Audio"};
39 template <
typename DSP>
44 template <
typename DSP>
47 static std::vector<Process::PortType> inletDescription()
49 std::vector<Process::PortType> port;
50 port.push_back(Process::PortType::Audio);
53 static std::vector<Process::PortType> outletDescription()
55 std::vector<Process::PortType> port;
56 port.push_back(Process::PortType::Audio);
63 Process::ProcessCategory::AudioEffect,
79 template <
typename... Args>
86 void openTabBox(
const char* label)
override { t.openTabBox(label); }
87 void openHorizontalBox(
const char* label)
override { t.openHorizontalBox(label); }
88 void openVerticalBox(
const char* label)
override { t.openVerticalBox(label); }
89 void closeBox()
override { t.closeBox(); }
90 void declare(FAUSTFLOAT* zone,
const char* key,
const char* val)
override
92 t.declare(zone, key, val);
95 addSoundfile(
const char* label,
const char* filename, Soundfile** sf_zone)
override
97 t.addSoundfile(label, filename, sf_zone);
99 void addButton(
const char* label, FAUSTFLOAT* zone)
override
101 t.addButton(label, zone);
103 void addCheckButton(
const char* label, FAUSTFLOAT* zone)
override
105 t.addCheckButton(label, zone);
107 void addVerticalSlider(
108 const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
109 FAUSTFLOAT max, FAUSTFLOAT step)
override
111 t.addVerticalSlider(label, zone, init, min, max, step);
113 void addHorizontalSlider(
114 const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
115 FAUSTFLOAT max, FAUSTFLOAT step)
override
117 t.addHorizontalSlider(label, zone, init, min, max, step);
120 const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
121 FAUSTFLOAT max, FAUSTFLOAT step)
override
123 t.addNumEntry(label, zone, init, min, max, step);
125 void addHorizontalBargraph(
126 const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
override
128 t.addHorizontalBargraph(label, zone, min, max);
130 void addVerticalBargraph(
131 const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
override
133 t.addVerticalBargraph(label, zone, min, max);
137 template <
typename DSP>
140 SCORE_SERIALIZE_FRIENDS
141 PROCESS_METADATA_IMPL(
Fx)
150 m_inlets.push_back(
new Process::Inlet{getStrongId(m_inlets),
this});
151 m_inlets.back()->type = Process::PortType::Audio;
152 m_outlets.push_back(
new Process::Outlet{getStrongId(m_outlets),
this});
153 m_outlets.back()->type = Process::PortType::Audio;
154 m_outlets.back()->setPropagate(
true);
156 d.buildUserInterface(&ui);
161 template <
typename Impl>
162 Fx(Impl& vis, QObject* parent)
168 QString prettyName()
const noexcept
override
178 bool hasExternalUI()
const noexcept {
return false; }
181 template <
typename DSP>
186 static constexpr
bool is_unique =
true;
192 ossia::small_vector<std::pair<ossia::value_port*, FAUSTFLOAT*>, 8> controls;
195 m_inlets.push_back(
new ossia::audio_inlet);
196 m_outlets.push_back(
new ossia::audio_outlet);
198 dsp.buildUserInterface(&ex);
201 void run(
const ossia::token_request& tk, ossia::exec_state_facade) noexcept
override
203 ossia::nodes::faust_exec(*
this, dsp, tk);
206 std::string label()
const noexcept
override {
return "Faust"; }
208 void all_notes_off() noexcept
override { }
211 static Q_DECL_RELAXED_CONSTEXPR score::Component::Key static_key() noexcept
216 score::Component::Key key() const noexcept final
override {
return static_key(); }
218 bool key_match(score::Component::Key other)
const noexcept
final override
220 return static_key() == other || Execution::ProcessComponent::base_key_match(other);
224 :
Execution::ProcessComponent_T<Fx<DSP>, ossia::node_process>{
225 proc, ctx,
"FaustComponent", parent}
227 auto node = ossia::make_node<exec_node>(*ctx.execState);
229 this->m_ossia_process = std::make_shared<ossia::node_process>(node);
230 node->dsp.instanceInit(ctx.execState->sampleRate);
232 for(std::size_t i = 1; i < proc.inlets().size(); i++)
235 *node->controls[i - 1].second = ossia::convert<double>(inlet->value());
236 auto inl = this->node->inputs()[i];
238 inlet, &Process::ControlInlet::valueChanged,
this,
239 [
this, inl](
const ossia::value& v) {
240 this->system().executionQueue.enqueue([inl, val = v]()
mutable {
241 inl->data.template target<ossia::value_port>()->write_value(std::move(val), 0);
249 template <
typename DSP>
250 struct is_custom_serialized<FaustDSP::Fx<DSP>> : std::true_type
254 template <
typename DSP>
260 readPorts(s, eff.inlets(), eff.outlets());
268 eff.outlets(), &eff);
274 template <
typename DSP>
280 readPorts(s.obj, eff.inlets(), eff.outlets());
287 eff.outlets(), &eff);
293 template <
typename DSP>
296 template <
typename DSP>
299 template <
typename DSP>
Metadata to categorize objects: curves, audio, etc.
Definition: lib/score/tools/Metadata.hpp:61
Definition: VisitorInterface.hpp:53
Definition: DataStreamVisitor.hpp:27
Definition: DataStreamVisitor.hpp:202
Definition: Process/Execution/ProcessComponent.hpp:119
Definition: DSPWrapper.hpp:189
Definition: DSPWrapper.hpp:183
Definition: DSPWrapper.hpp:139
Definition: VisitorInterface.hpp:61
Definition: JSONVisitor.hpp:52
Definition: JSONVisitor.hpp:423
Definition: DefaultEffectItem.hpp:26
Definition: EffectFactory.hpp:66
Definition: PortFactory.hpp:74
Definition: GenericProcessFactory.hpp:15
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Metadata to retrieve the ProcessFlags of a process.
The id_base_t class.
Definition: Identifier.hpp:57
Components used for the execution of a score.
Definition: ProcessComponent.cpp:12
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
ProcessFlags
Various settings for processes.
Definition: ProcessFlags.hpp:17
Definition: ExecutionContext.hpp:76
Definition: Process/Execution/ProcessComponent.hpp:89
Definition: score-plugin-faust/Faust/Utils.hpp:23
Definition: DSPWrapper.hpp:78
Definition: score-lib-process/Process/ProcessMetadata.hpp:37
Definition: PortForward.hpp:23
Definition: PortForward.hpp:27
Definition: VisitorInterface.hpp:13
Definition: TimeValue.hpp:21