Loading...
Searching...
No Matches
PdExecutor.hpp
1#pragma once
2#include <Process/Execution/ProcessComponent.hpp>
3#include <Process/ExecutionContext.hpp>
4
5#include <Explorer/DeviceList.hpp>
6
7#include <Pd/PdInstance.hpp>
8#include <Pd/PdProcess.hpp>
9
10#include <score/document/DocumentContext.hpp>
11#include <score/document/DocumentInterface.hpp>
12
13#include <ossia/dataflow/graph_node.hpp>
14#include <ossia/detail/string_view.hpp>
15#include <ossia/editor/scenario/time_process.hpp>
16#include <ossia/editor/scenario/time_value.hpp>
17
18#include <boost/circular_buffer.hpp>
19
20#include <QString>
21
22#include <memory>
23
24namespace Pd
25{
26
27class ProcessModel;
28
29class PdGraphNode final : public ossia::graph_node
30{
31public:
33 std::shared_ptr<Instance> instance, ossia::string_view folder,
34 ossia::string_view file, const Execution::Context& ctx, std::size_t audio_inputs,
35 std::size_t audio_outputs, Process::Inlets inmess, Process::Outlets outmess,
36 const Pd::PatchSpec& spec, bool midi_in = true, bool midi_out = true);
37
39 [[nodiscard]] std::string label() const noexcept override
40 {
41 return "puredata (" + m_file + ")";
42 }
43
44 ossia::outlet* get_outlet(const char* str) const;
45
46 ossia::value_port* get_value_port(const char* str) const;
47
48 ossia::midi_port* get_midi_in() const;
49 ossia::midi_port* get_midi_out() const;
50
51 void run(const ossia::token_request& t, ossia::exec_state_facade e) noexcept override;
52 void add_dzero(std::string& s) const;
53
54 std::shared_ptr<Instance> m_instance;
55
56 std::size_t m_audioIns{};
57 std::size_t m_audioOuts{};
58 std::vector<Process::Port*> m_inport, m_outport;
59 std::vector<std::string> m_inmess, m_outmess;
60
61 std::vector<float> m_inbuf, m_outbuf;
62 std::vector<boost::circular_buffer<float>> m_prev_outbuf;
63 std::size_t m_firstInMessage{}, m_firstOutMessage{};
64 ossia::audio_port* m_audio_inlet{};
65 ossia::audio_port* m_audio_outlet{};
66 ossia::midi_port* m_midi_inlet{};
67 ossia::midi_port* m_midi_outlet{};
68 std::string m_file;
69};
70
72{
73 COMPONENT_METADATA("78657f42-3a2a-4b80-8736-8736463442b4")
74
75public:
77 Component(Pd::ProcessModel& element, const Execution::Context& ctx, QObject* parent);
78
79 ~Component();
80};
81
83}
Definition Process/Execution/ProcessComponent.hpp:119
Definition Process/Execution/ProcessComponent.hpp:48
Definition PdExecutor.hpp:72
Definition PdExecutor.hpp:30
Definition PdProcess.hpp:40
Definition ExecutionContext.hpp:76
Definition PdProcess.hpp:24
Definition PortForward.hpp:23
Definition PortForward.hpp:27