2#include "ZeroconfMinuitListener.hpp"
3#include "ZeroconfOscqueryListener.hpp"
5#include <ossia/detail/safe_vec.hpp>
6#include <ossia/network/common/websocket_log_sink.hpp>
7#include <ossia/network/generic/generic_device.hpp>
9#include <ossia-pd/src/attribute.hpp>
10#include <ossia-pd/src/client.hpp>
11#include <ossia-pd/src/device.hpp>
12#include <ossia-pd/src/model.hpp>
13#include <ossia-pd/src/parameter.hpp>
14#include <ossia-pd/src/remote.hpp>
15#include <ossia-pd/src/view.hpp>
18#include <cicm_wrapper.h>
23struct websocket_threaded_connection;
27struct pd_log_sink final :
public spdlog::sinks::sink
29 void log(
const spdlog::details::log_msg& msg)
override
31 std::string s(msg.payload.data(), msg.payload.size());
34 case spdlog::level::warn:
35 case spdlog::level::err: {
36 error(
"%s", s.c_str());
41 post(
"%s", s.c_str());
46 void flush()
override { }
48 void set_pattern(
const std::string& pattern)
override { }
49 void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter)
override { }
52extern "C" void setup_ossia0x2eassert(
void);
53extern "C" void setup_ossia0x2eattribute(
void);
54extern "C" void setup_ossia0x2eclient(
void);
55extern "C" void setup_ossia0x2edevice(
void);
56extern "C" void setup_ossia0x2eexplorer(
void);
57extern "C" void setup_ossia0x2elogger(
void);
58extern "C" void setup_ossia0x2emodel(
void);
59extern "C" void setup_ossia0x2eparam(
void);
60extern "C" void setup_ossia0x2eremote(
void);
61extern "C" void setup_ossia0x2eview(
void);
66 static ossia_pd& instance();
67 static ossia::net::generic_device* get_default_device()
69 return &instance().m_device;
71 static void register_nodes(
void* x);
72 static void discover_network_devices(ossia_pd* x);
74 void set_log_level(t_symbol* log_sym)
76 std::vector<spdlog::string_view_t> vec = SPDLOG_LEVEL_NAMES;
77 auto it = std::find(vec.begin(), vec.end(), log_sym->s_name);
80 int level = it - vec.begin();
81 m_log_sink.get()->set_level(
static_cast<spdlog::level::level_enum
>(level));
85 error(
"Unknown log level : %s", log_sym->s_name);
89 static t_eclass* attribute_class;
90 static t_eclass* client_class;
91 static t_eclass* device_class;
92 static t_eclass* explorer_class;
93 static t_eclass* logger_class;
94 static t_eclass* model_class;
95 static t_eclass* param_class;
96 static t_eclass* remote_class;
97 static t_eclass* view_class;
98 static t_eclass* ossia_class;
100 static t_symbol* o_sym_attribute;
101 static t_symbol* o_sym_client;
102 static t_symbol* o_sym_device;
103 static t_symbol* o_sym_logger;
104 static t_symbol* o_sym_model;
105 static t_symbol* o_sym_param;
106 static t_symbol* o_sym_remote;
107 static t_symbol* o_sym_view;
108 static t_symbol* o_sym_ossia;
109 static t_symbol* o_sym_set;
110 static t_symbol* o_sym_address;
112 ossia::safe_vector<attribute*> attributes;
113 ossia::safe_vector<parameter*> parameters;
114 ossia::safe_vector<remote*> remotes;
115 ossia::safe_vector<model*> models;
116 ossia::safe_vector<view*> views;
117 ossia::safe_vector<device*> devices;
118 ossia::safe_vector<client*> clients;
120 ossia::safe_vector<t_select_clock*> select_clocks;
122 ossia::safe_set<attribute*> attribute_quarantine;
123 ossia::safe_set<model*> model_quarantine;
124 ossia::safe_set<view*> view_quarantine;
125 ossia::safe_set<parameter*> parameter_quarantine;
126 ossia::safe_set<remote*> remote_quarantine;
130 struct root_descriptor
132 bool is_loadbanged{};
133 unsigned long count{};
135 unsigned long inc() {
return ++count; }
136 unsigned long dec() {
return --count; }
139 typedef std::map<t_canvas*, root_descriptor> RootMap;
141 RootMap m_root_patcher{};
142 t_clock* m_reg_clock{};
143 static t_clock* browse_clock;
147 static ZeroconfOscqueryListener zeroconf_oscq_listener;
148 static ZeroconfMinuitListener zeroconf_minuit_listener;
155 ossia::net::generic_device m_device;
156 string_map<std::shared_ptr<ossia::websocket_threaded_connection>> m_connections;
157 std::shared_ptr<pd_log_sink> m_log_sink;
A protocol used to expose a local application's data through multiple other protocols.
Definition local.hpp:22