summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-22 03:48:28 +0000
committerDavid Robillard <d@drobilla.net>2007-10-22 03:48:28 +0000
commite9d99340c9ac29aaa7912db0554a88820c4a776a (patch)
tree2bb49de8b90d861330e8db50919a8137b10cc913 /src/libs/client
parent5ae4d4d5e805e828b51b98767ac51da24c3b21f1 (diff)
downloadingen-e9d99340c9ac29aaa7912db0554a88820c4a776a.tar.gz
ingen-e9d99340c9ac29aaa7912db0554a88820c4a776a.tar.bz2
ingen-e9d99340c9ac29aaa7912db0554a88820c4a776a.zip
Rework plugin design (engine side) to be less crap.
Use LADSPA labels instead of munged friendly names to generate OSC paths. Separate OSC paths/names from human friendly names (conceptually, still needs UI exposing). git-svn-id: http://svn.drobilla.net/lad/ingen@898 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/OSCClientReceiver.cpp6
-rw-r--r--src/libs/client/PluginModel.cpp4
-rw-r--r--src/libs/client/PluginModel.hpp39
-rw-r--r--src/libs/client/SigClientInterface.hpp6
-rw-r--r--src/libs/client/Store.cpp4
-rw-r--r--src/libs/client/Store.hpp2
-rw-r--r--src/libs/client/ThreadedSigClientInterface.hpp6
7 files changed, 34 insertions, 33 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index bd0b5db9..6573c9bf 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -143,7 +143,7 @@ OSCClientReceiver::setup_callbacks()
lo_server_thread_add_method(_st, "/ingen/ok", "i", response_ok_cb, this);
lo_server_thread_add_method(_st, "/ingen/error", "is", response_error_cb, this);
lo_server_thread_add_method(_st, "/ingen/num_plugins", "i", num_plugins_cb, this);
- lo_server_thread_add_method(_st, "/ingen/plugin", "sss", plugin_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/plugin", "ssss", plugin_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_patch", "si", new_patch_cb, this);
lo_server_thread_add_method(_st, "/ingen/destroyed", "s", destroyed_cb, this);
lo_server_thread_add_method(_st, "/ingen/patch_enabled", "s", patch_enabled_cb, this);
@@ -380,8 +380,8 @@ OSCClientReceiver::_num_plugins_cb(const char* path, const char* types, lo_arg**
int
OSCClientReceiver::_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- assert(argc == 3 && !strcmp(types, "sss"));
- new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s); // type, uri
+ assert(argc == 4 && !strcmp(types, "ssss"));
+ new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s, &argv[3]->s); // uri, type, symbol, name
return 0;
}
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index e819d04b..8a9ecc7d 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -38,14 +38,14 @@ Raul::RDF::World* PluginModel::_rdf_world = NULL;
string
PluginModel::default_node_name(SharedPtr<PatchModel> parent)
{
- string default_name = Raul::Path::nameify(_name);
+ string default_name = Raul::Path::nameify(_symbol);
string name;
char num_buf[3];
for (uint i=0; i < 99; ++i) {
name = default_name;
if (i != 0) {
- snprintf(num_buf, 3, "%d", i+1);
+ snprintf(num_buf, 4, "_%d", i+1);
name += num_buf;
}
if (!parent->find_child(name))
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index ce268a06..56b33723 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -45,36 +45,36 @@ class NodeModel;
class PluginModel : public Ingen::Shared::Plugin
{
public:
- PluginModel(const string& uri, const string& type_uri, const string& name)
- : _uri(uri)
+ PluginModel(const string& uri, const string& type_uri, const string& symbol, const string& name)
+ : _type(type_from_uri(type_uri))
+ , _uri(uri)
+ , _symbol(symbol)
, _name(name)
{
- set_type_from_uri(type_uri);
#ifdef HAVE_SLV2
_slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, uri.c_str());
#endif
}
- Type type() const { return _type; }
- void type(Type t) { _type = t; }
- const string& uri() const { return _uri; }
- void uri(const string& s) { _uri = s; }
- const string& name() const { return _name; }
- void name(const string& s) { _name = s; }
+ Type type() const { return _type; }
+ const string& uri() const { return _uri; }
+ const string& name() const { return _name; }
/** DEPRECATED */
- void set_type(const string& type_string) {
- if (type_string == "LV2") _type = LV2;
- else if (type_string == "LADSPA") _type = LADSPA;
- else if (type_string == "Internal") _type = Internal;
- else if (type_string == "Patch") _type = Patch;
+ Type type_from_string(const string& type_string) {
+ if (type_string == "LV2") return LV2;
+ else if (type_string == "LADSPA") return LADSPA;
+ else if (type_string == "Internal") return Internal;
+ else if (type_string == "Patch") return Patch;
+ else return Internal; // ?
}
- void set_type_from_uri(const string& type_uri) {
+ Type type_from_uri(const string& type_uri) {
if (type_uri.substr(0, 6) != "ingen:") {
cerr << "INVALID TYPE STRING!" << endl;
+ return Plugin::Internal; // ?
} else {
- set_type(type_uri.substr(6));
+ return type_from_string(type_uri.substr(6));
}
}
@@ -99,9 +99,10 @@ public:
static Raul::RDF::World* rdf_world() { return _rdf_world; }
private:
- Type _type;
- string _uri;
- string _name;
+ const Type _type;
+ const string _uri;
+ const string _symbol;
+ const string _name;
#ifdef HAVE_SLV2
static SLV2World _slv2_world;
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index cefc3176..4e57a7ec 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -50,7 +50,7 @@ public:
sigc::signal<void> signal_bundle_end;
sigc::signal<void, string> signal_error;
sigc::signal<void, uint32_t> signal_num_plugins;
- sigc::signal<void, string, string, string> signal_new_plugin;
+ sigc::signal<void, string, string, string, string> signal_new_plugin;
sigc::signal<void, string, uint32_t> signal_new_patch;
sigc::signal<void, string, string, bool, uint32_t> signal_new_node;
sigc::signal<void, string, string, bool> signal_new_port;
@@ -98,8 +98,8 @@ protected:
void error(const string& msg)
{ if (_enabled) signal_error.emit(msg); }
- void new_plugin(const string& uri, const string& type_uri, const string& name)
- { if (_enabled) signal_new_plugin.emit(uri, type_uri, name); }
+ void new_plugin(const string& uri, const string& type_uri, const string& symbol, const string& name)
+ { if (_enabled) signal_new_plugin.emit(uri, type_uri, symbol, name); }
void new_patch(const string& path, uint32_t poly)
{ if (_enabled) signal_new_patch.emit(path, poly); }
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index b118b4e4..3068295a 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -399,9 +399,9 @@ Store::rename_event(const Path& old_path, const Path& new_path)
}
void
-Store::new_plugin_event(const string& uri, const string& type_uri, const string& name)
+Store::new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name)
{
- SharedPtr<PluginModel> p(new PluginModel(uri, type_uri, name));
+ SharedPtr<PluginModel> p(new PluginModel(uri, type_uri, symbol, name));
add_plugin(p);
resolve_plugin_orphans(p);
}
diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp
index 2849afc3..5dd4f34e 100644
--- a/src/libs/client/Store.hpp
+++ b/src/libs/client/Store.hpp
@@ -97,7 +97,7 @@ private:
// Slots for SigClientInterface signals
void destruction_event(const Path& path);
void rename_event(const Path& old_path, const Path& new_path);
- void new_plugin_event(const string& uri, const string& type_uri, const string& name);
+ void new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name);
void new_patch_event(const Path& path, uint32_t poly);
void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports);
void new_port_event(const Path& path, const string& data_type, bool is_output);
diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp
index 0f300703..e5ec2741 100644
--- a/src/libs/client/ThreadedSigClientInterface.hpp
+++ b/src/libs/client/ThreadedSigClientInterface.hpp
@@ -90,8 +90,8 @@ public:
void error(const string& msg)
{ push_sig(sigc::bind(error_slot, msg)); }
- void new_plugin(const string& uri, const string& type_uri, const string& name)
- { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, name)); }
+ void new_plugin(const string& uri, const string& type_uri, const string& symbol, const string& name)
+ { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, symbol, name)); }
void new_patch(const string& path, uint32_t poly)
{ push_sig(sigc::bind(new_patch_slot, path, poly)); }
@@ -159,7 +159,7 @@ private:
sigc::slot<void, int32_t> response_ok_slot;
sigc::slot<void, int32_t, string> response_error_slot;
sigc::slot<void, string> error_slot;
- sigc::slot<void, string, string, string> new_plugin_slot;
+ sigc::slot<void, string, string, string, string> new_plugin_slot;
sigc::slot<void, string, uint32_t> new_patch_slot;
sigc::slot<void, string, string, bool, int> new_node_slot;
sigc::slot<void, string, string, bool> new_port_slot;