OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
dummy.hpp
1#pragma once
2#include <ossia/dataflow/graph_node.hpp>
3#include <ossia/dataflow/port.hpp>
4
5namespace ossia::nodes
6{
7class dummy_node : public ossia::graph_node
8{
9public:
10 dummy_node() = default;
11
12 void run(const token_request& t, exec_state_facade) noexcept override { }
13 std::string label() const noexcept override { return "dummy"; }
14};
15
16class dummy_audio_node : public ossia::graph_node
17{
18public:
19 dummy_audio_node()
20 {
21 m_inlets.push_back(new ossia::audio_inlet);
22 m_outlets.push_back(new ossia::audio_outlet);
23 }
24
25 void run(const token_request& t, exec_state_facade) noexcept override
26 {
27 auto& i = *m_inlets[0]->target<ossia::audio_port>();
28 auto& o = *m_outlets[0]->target<ossia::audio_port>();
29 o = i;
30 }
31 std::string label() const noexcept override { return "dummy_audio_node"; }
32};
33
34class dummy_midi_node : public ossia::graph_node
35{
36public:
37 dummy_midi_node()
38 {
39 m_inlets.push_back(new ossia::midi_inlet);
40 m_outlets.push_back(new ossia::midi_outlet);
41 }
42
43 void run(const token_request& t, exec_state_facade) noexcept override
44 {
45 auto i = m_inlets[0]->target<ossia::midi_port>();
46 auto o = m_outlets[0]->target<ossia::midi_port>();
47 o->messages = i->messages;
48 }
49 std::string label() const noexcept override { return "dummy_midi_node"; }
50};
51
52class dummy_value_node : public ossia::graph_node
53{
54public:
55 dummy_value_node()
56 {
57 m_inlets.push_back(new ossia::value_inlet);
58 m_outlets.push_back(new ossia::value_outlet);
59 }
60
61 void run(const token_request& t, exec_state_facade) noexcept override
62 {
63 auto i = m_inlets[0]->target<ossia::value_port>();
64 auto o = m_outlets[0]->target<ossia::value_port>();
65 o->set_data(i->get_data());
66 }
67 std::string label() const noexcept override { return "dummy_value_node"; }
68};
69
70}