[SCM] calf/master: + DSSI: implemented marshalling of line_graph_iface over OSC (apart from having stub implementation of cairo_iface it seems to work just fine), no background thread yet
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:38:56 UTC 2013
The following commit has been merged in the master branch:
commit aa30b898763be6c644453ae3d32cab859efed97d
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Wed Jan 21 23:28:49 2009 +0000
+ DSSI: implemented marshalling of line_graph_iface over OSC (apart from having stub implementation of cairo_iface it seems to work just fine), no background thread yet
diff --git a/src/calf/giface.h b/src/calf/giface.h
index e82bc5d..445f5fc 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -356,17 +356,32 @@ public:
extern bool check_for_message_context_ports(parameter_properties *parameters, int count);
extern bool check_for_string_ports(parameter_properties *parameters, int count);
-extern void send_graph_via_osc(osctl::osc_client &client, const std::string &address, line_graph_iface *graph);
#if USE_DSSI
+
+enum line_graph_item
+{
+ LGI_END = 0,
+ LGI_GRAPH,
+ LGI_SUBGRAPH,
+ LGI_LEGEND,
+ LGI_DOT,
+ LGI_END_ITEM,
+};
+
/// A class to send status updates via OSC
struct dssi_feedback_sender
{
+ /// OSC client object used to send updates
osctl::osc_client *client;
+ /// Background thread handle
pthread_t bg_thread;
+ /// Quit flag (used to terminate the thread)
bool quit;
+ /// Indices of graphs to send
+ std::vector<int> indices;
- dssi_feedback_sender(const char *URI);
+ dssi_feedback_sender(const char *URI, line_graph_iface *graph, calf_plugins::parameter_properties *props, int num_params);
~dssi_feedback_sender();
};
#endif
diff --git a/src/calf/ladspa_wrap.h b/src/calf/ladspa_wrap.h
index b341146..e2becd2 100644
--- a/src/calf/ladspa_wrap.h
+++ b/src/calf/ladspa_wrap.h
@@ -120,17 +120,19 @@ struct ladspa_instance: public Module, public plugin_ctl_iface
}
virtual char *configure(const char *key, const char *value)
{
- printf("%s = %s\n", key, value);
#if USE_DSSI
if (!strcmp(key, "OSC:FEEDBACK_URI"))
{
+ line_graph_iface *lgi = dynamic_cast<line_graph_iface *>(this);
+ if (!lgi)
+ return NULL;
if (*value)
{
if (feedback_sender) {
delete feedback_sender;
feedback_sender = NULL;
}
- feedback_sender = new dssi_feedback_sender(value);
+ feedback_sender = new dssi_feedback_sender(value, lgi, get_param_props(0), get_param_count());
}
else
{
diff --git a/src/dssigui.cpp b/src/dssigui.cpp
index 40de558..64552c9 100644
--- a/src/dssigui.cpp
+++ b/src/dssigui.cpp
@@ -156,7 +156,7 @@ static struct option long_options[] = {
GMainLoop *mainloop;
-static bool osc_debug = false;
+static bool osc_debug = true;
struct dssi_osc_server: public osc_server, public osc_message_sink<osc_strstream>
{
diff --git a/src/giface.cpp b/src/giface.cpp
index 6a40d84..bb9d78a 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -235,20 +235,81 @@ bool calf_plugins::check_for_string_ports(parameter_properties *parameters, int
return false;
}
-void calf_plugins::send_graph_via_osc(osctl::osc_client &client, const std::string &address, line_graph_iface *graph)
+struct osc_cairo_control: public cairo_iface
+{
+ osctl::osc_inline_typed_strstream &os;
+
+ osc_cairo_control(osctl::osc_inline_typed_strstream &_os) : os(_os) {}
+ virtual void set_source_rgba(float r, float g, float b, float a = 1.f)
+ {
+ // os << some control stuff
+ }
+ virtual void set_line_width(float width)
+ {
+ // os << some control stuff
+ }
+};
+
+static void send_graph_via_osc(osctl::osc_client &client, const std::string &address, line_graph_iface *graph, std::vector<int> ¶ms)
{
osctl::osc_inline_typed_strstream os;
- os << (uint32_t)10;
+ osc_cairo_control cairoctl(os);
+ for (size_t i = 0; i < params.size(); i++)
+ {
+ int index = params[i];
+ os << (uint32_t)LGI_GRAPH;
+ os << (uint32_t)index;
+ for (int j = 0; ; j++)
+ {
+ float data[128];
+ if (graph->get_graph(index, j, data, 128, &cairoctl))
+ {
+ os << (uint32_t)LGI_SUBGRAPH;
+ os << (uint32_t)128;
+ for (int p = 0; p < 128; p++)
+ os << data[i];
+ }
+ else
+ break;
+ }
+ for (int j = 0; ; j++)
+ {
+ float x, y;
+ int size;
+ if (graph->get_dot(index, j, x, y, size, &cairoctl))
+ os << (uint32_t)LGI_DOT << x << y << (uint32_t)size;
+ else
+ break;
+ }
+ for (int j = 0; ; j++)
+ {
+ float pos = 0;
+ bool vertical = false;
+ string legend;
+ if (graph->get_gridline(index, j, pos, vertical, legend, &cairoctl))
+ os << (uint32_t)LGI_LEGEND << pos << (uint32_t)(vertical ? 1 : 0) << legend;
+ else
+ break;
+ }
+ os << (uint32_t)LGI_END_ITEM;
+ }
+ os << (uint32_t)LGI_END;
client.send(address, os);
}
#if USE_DSSI
-calf_plugins::dssi_feedback_sender::dssi_feedback_sender(const char *URI)
+calf_plugins::dssi_feedback_sender::dssi_feedback_sender(const char *URI, line_graph_iface *graph, calf_plugins::parameter_properties *props, int num_params)
{
client = new osctl::osc_client;
client->bind("0.0.0.0", 0);
client->set_url(URI);
client->send("/iAmHere");
+ for (int i = 0; i < num_params; i++)
+ {
+ if (props[i].flags & PF_PROP_GRAPH)
+ indices.push_back(i);
+ }
+ send_graph_via_osc(*client, "/lineGraph", graph, indices);
}
calf_plugins::dssi_feedback_sender::~dssi_feedback_sender()
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list