2#include <ossia/dataflow/dataflow_fwd.hpp>
3#include <ossia/dataflow/graph/graph_interface.hpp>
4#include <ossia/dataflow/value_vector.hpp>
5#include <ossia/detail/lockfree_queue.hpp>
6#include <ossia/detail/ptr_set.hpp>
7#include <ossia/network/base/device.hpp>
8#if defined(OSSIA_SMALL_VECTOR)
9#include <libremidi/message.hpp>
28struct local_pull_visitor;
29struct global_pull_visitor;
30struct state_exec_visitor;
31struct execution_state_policy;
32struct OSSIA_EXPORT execution_state :
public Nano::Observer
35 execution_state(
const execution_state&) =
delete;
36 execution_state(execution_state&&) =
delete;
37 execution_state& operator=(
const execution_state&) =
delete;
38 execution_state& operator=(execution_state&&) =
delete;
41 void set_policy(
const tick_setup_options&);
45 void unregister_device(net::device_base* d);
47 const ossia::small_vector<ossia::net::device_base*, 4>& edit_devices() const noexcept
49 return m_devices_edit;
53 void register_port(
const ossia::inlet& port);
54 void register_port(
const ossia::outlet& port);
55 void unregister_port(
const ossia::inlet& port);
56 void unregister_port(
const ossia::outlet& port);
58 const ossia::small_vector<ossia::net::device_base*, 4>& exec_devices() const noexcept
60 return m_devices_exec;
65 for(
auto dev : m_devices_exec)
67 if(
auto res = ossia::net::find_node(dev->get_root_node(), name))
74 auto get_value_or(std::string_view v,
const T& val)
noexcept
76 if(
auto node = find_node(v))
77 return ossia::convert<T>(node->get_parameter()->value());
86 void advance_tick(std::size_t);
87 void apply_device_changes();
94 void insert(ossia::audio_parameter& dest,
const audio_port& v);
95 void insert(ossia::net::midi::midi_parameter& dest,
const midi_port& v);
101 int sampleRate{44100};
103 double modelToSamplesRatio{1.};
104 double samplesToModelRatio{1.};
105 int64_t samples_since_start{};
109#if !defined(OSSIA_TESTING)
112 void init_midi_timings();
113 void get_new_values();
117 void register_midi_parameter(net::midi::midi_protocol& p);
118 void unregister_midi_parameter(net::midi::midi_protocol& p);
119 ossia::small_vector<ossia::net::device_base*, 4> m_devices_edit;
120 ossia::small_vector<ossia::net::device_base*, 4> m_devices_exec;
121 struct device_operation
130 ossia::spsc_queue<device_operation> m_device_change_queue;
132 std::list<message_queue> m_valueQueues;
134 ossia::ptr_map<ossia::net::parameter_base*, value_vector<ossia::value>>
137 struct received_midi_state
139 value_vector<libremidi::ump> messages;
140 int64_t last_buffer_start{};
141 int64_t current_buffer_start{};
145 ossia::ptr_map<ossia::net::midi::midi_protocol*, received_midi_state> m_receivedMidi;
147 friend struct local_pull_visitor;
148 friend struct global_pull_visitor;
149 friend struct global_pull_node_visitor;
150 friend struct state_exec_visitor;
152 std::unique_ptr<execution_state_policy> m_policy;
Root of a device tree.
Definition ossia/network/base/device.hpp:58
The node_base class.
Definition node.hpp:48
The parameter_base class.
Definition ossia/network/base/parameter.hpp:48