summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/Client.hpp4
-rw-r--r--src/client/ClientStore.cpp29
-rw-r--r--src/client/ClientStore.hpp5
-rw-r--r--src/client/OSCClientReceiver.cpp12
-rw-r--r--src/client/PluginModel.cpp62
-rw-r--r--src/client/PluginModel.hpp6
-rw-r--r--src/client/SigClientInterface.hpp4
-rw-r--r--src/client/ThreadedSigClientInterface.hpp4
-rw-r--r--src/common/interface/ClientInterface.hpp4
-rw-r--r--src/engine/ClientBroadcaster.cpp2
-rw-r--r--src/engine/HTTPClientSender.cpp14
-rw-r--r--src/engine/HTTPClientSender.hpp4
-rw-r--r--src/engine/InternalPlugin.cpp9
-rw-r--r--src/engine/InternalPlugin.hpp6
-rw-r--r--src/engine/LADSPAPlugin.cpp18
-rw-r--r--src/engine/LADSPAPlugin.hpp7
-rw-r--r--src/engine/LV2Plugin.cpp8
-rw-r--r--src/engine/LV2Plugin.hpp6
-rw-r--r--src/engine/OSCClientSender.cpp22
-rw-r--r--src/engine/OSCClientSender.hpp4
-rw-r--r--src/engine/events/RequestObjectEvent.cpp2
21 files changed, 120 insertions, 112 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp
index 2c681f6e..0f293c36 100644
--- a/src/bindings/Client.hpp
+++ b/src/bindings/Client.hpp
@@ -38,10 +38,6 @@ public:
virtual void error(const std::string& msg) {}
- virtual void new_plugin(const std::string& uri,
- const std::string& type_uri,
- const std::string& symbol) {}
-
void put(const URI& path,
const Resource::Properties& properties) {}
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index a8fe7c51..e4cd604e 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -45,7 +45,6 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI
emitter->signal_object_deleted.connect(sigc::mem_fun(this, &ClientStore::del));
emitter->signal_object_moved.connect(sigc::mem_fun(this, &ClientStore::move));
- emitter->signal_new_plugin.connect(sigc::mem_fun(this, &ClientStore::new_plugin));
emitter->signal_put.connect(sigc::mem_fun(this, &ClientStore::put));
emitter->signal_clear_patch.connect(sigc::mem_fun(this, &ClientStore::clear_patch));
emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connect));
@@ -264,29 +263,29 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str)
}*/
}
-void
-ClientStore::new_plugin(const URI& uri, const URI& type_uri, const Symbol& symbol)
-{
- SharedPtr<PluginModel> p(new PluginModel(uri, type_uri));
- p->set_property("lv2:symbol", Atom(Atom::STRING, symbol));
- add_plugin(p);
- //resolve_plugin_orphans(p);
-}
-
void
ClientStore::put(const URI& uri, const Resource::Properties& properties)
{
- size_t hash = uri.find("#");
- bool meta = (hash != string::npos);
- Path path(meta ? (string("/") + uri.chop_start("#")) : uri.str());
-
typedef Resource::Properties::const_iterator iterator;
- cerr << "CLIENT PUT " << uri << " (" << path << ") {" << endl;
+ cerr << "CLIENT PUT " << uri << " {" << endl;
for (iterator i = properties.begin(); i != properties.end(); ++i)
cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl;
cerr << "}" << endl;
+ bool is_path = Path::is_valid(uri.str());
+ bool is_meta = uri.substr(0, 8) == "meta:#";
+
+ if (!(is_path || is_meta)) {
+ const URI& type_uri = properties.find("rdf:type")->second.get_uri();
+ SharedPtr<PluginModel> p(new PluginModel(uri, type_uri));
+ p->set_properties(properties);
+ add_plugin(p);
+ return;
+ }
+
+ Path path(is_meta ? (string("/") + uri.chop_start("#")) : uri.str());
+
SharedPtr<ObjectModel> obj = PtrCast<ObjectModel>(object(path));
if (obj) {
obj->set_properties(properties);
diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp
index 00069701..53cb4a59 100644
--- a/src/client/ClientStore.hpp
+++ b/src/client/ClientStore.hpp
@@ -67,7 +67,6 @@ public:
void set_plugins(SharedPtr<Plugins> p) { _plugins = p; }
// CommonInterface
- void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol);
bool new_object(const Shared::GraphObject* object);
void put(const Raul::URI& path, const Shared::Resource::Properties& properties);
void move(const Raul::Path& old_path, const Raul::Path& new_path);
@@ -78,8 +77,8 @@ public:
void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
void del(const Raul::Path& path);
- sigc::signal<void, SharedPtr<ObjectModel> > signal_new_object;
- sigc::signal<void, SharedPtr<PluginModel> > signal_new_plugin;
+ sigc::signal< void, SharedPtr<ObjectModel> > signal_new_object;
+ sigc::signal< void, SharedPtr<PluginModel> > signal_new_plugin;
private:
diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp
index c552e82e..eb5eb84b 100644
--- a/src/client/OSCClientReceiver.cpp
+++ b/src/client/OSCClientReceiver.cpp
@@ -303,17 +303,5 @@ OSCClientReceiver::_response_error_cb(const char* path, const char* types, lo_ar
}
-/** A plugin info response from the server, in response to an /ingen/send_plugins
- */
-int
-OSCClientReceiver::_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- assert(argc == 3 && !strcmp(types, "sss"));
- _target->new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s); // uri, type, symbol
-
- return 0;
-}
-
-
} // namespace Client
} // namespace Ingen
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 4db79091..fd484df4 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -16,6 +16,7 @@
*/
#include <sstream>
+#include <ctype.h>
#include "ingen-config.h"
#include "raul/Path.hpp"
#include "raul/Atom.hpp"
@@ -51,11 +52,70 @@ PluginModel::PluginModel(const URI& uri, const URI& type_uri)
#endif
if (_type == Internal)
set_property("doap:name", Raul::Atom(uri.substr(uri.find_last_of("#") + 1).c_str()));
+
+ if (!get_property("lv2:symbol").is_valid()) {
+ size_t last_slash = uri.find_last_of("/");
+ size_t last_hash = uri.find_last_of("#");
+ string symbol;
+ if (last_slash == string::npos && last_hash == string::npos) {
+ size_t last_colon = uri.find_last_of(":");
+ if (last_colon != string::npos)
+ symbol = uri.substr(last_colon + 1);
+ else
+ symbol = uri.str();
+ } else if (last_slash == string::npos) {
+ symbol = uri.substr(last_hash + 1);
+ } else if (last_hash == string::npos) {
+ symbol = uri.substr(last_slash + 1);
+ } else {
+ size_t first_delim = std::min(last_slash, last_hash);
+ size_t last_delim = std::max(last_slash, last_hash);
+ if (isalpha(uri.str()[last_delim + 1]))
+ symbol = uri.str().substr(last_delim + 1);
+ else
+ symbol = uri.str().substr(first_delim + 1, last_delim - first_delim - 1);
+ }
+ set_property("lv2:symbol", Atom(Atom::STRING, symbol));
+ }
+}
+
+
+const std::string
+PluginModel::symbol()
+{
+ const Atom& val = get_property("lv2:symbol");
+ if (val.is_valid() && val.type() == Atom::STRING)
+ return val.get_string();
+
+#ifdef HAVE_SLV2
+ SLV2Value lv2_symbol_pred = slv2_value_new_uri(_slv2_world,
+ "http://lv2plug.in/ns/lv2core#symbol");
+ SLV2Values symbols = slv2_plugin_get_value(_slv2_plugin, lv2_symbol_pred);
+ for (unsigned i = 0; i < slv2_values_size(symbols); ++i) {
+ SLV2Value val = slv2_values_get_at(symbols, 0);
+ if (slv2_value_is_string(val)) {
+ cerr << uri() << " FOUND SYMBOL: " << slv2_value_as_string(val) << endl;
+ set_property("lv2:symbol", Atom(Atom::STRING, slv2_value_as_string(val)));
+ break;
+ }
+ }
+ slv2_values_free(symbols);
+ slv2_value_free(lv2_symbol_pred);
+#endif
+
+ return string_property("lv2:symbol");
+}
+
+
+const std::string
+PluginModel::name()
+{
+ return string_property("doap:name");
}
string
-PluginModel::default_node_symbol() const
+PluginModel::default_node_symbol()
{
return Raul::Path::nameify(symbol());
}
diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp
index 7013d819..19499be0 100644
--- a/src/client/PluginModel.hpp
+++ b/src/client/PluginModel.hpp
@@ -50,10 +50,10 @@ public:
Type type() const { return _type; }
- const std::string symbol() const { return string_property("lv2:symbol"); }
- const std::string name() const { return string_property("doap:name"); }
+ const std::string symbol();
+ const std::string name();
- std::string default_node_symbol() const;
+ std::string default_node_symbol();
std::string human_name();
std::string port_human_name(uint32_t index) const;
diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp
index 857c575d..6efbdd8e 100644
--- a/src/client/SigClientInterface.hpp
+++ b/src/client/SigClientInterface.hpp
@@ -50,7 +50,6 @@ public:
sigc::signal<void> signal_bundle_begin;
sigc::signal<void> signal_bundle_end;
sigc::signal<void, std::string> signal_error;
- sigc::signal<void, Raul::URI, Raul::URI, Raul::Symbol> signal_new_plugin;
sigc::signal<void, Raul::Path, uint32_t> signal_new_patch;
sigc::signal<void, Raul::Path, Raul::URI, uint32_t, bool> signal_new_port;
sigc::signal<void, Raul::URI, Shared::Resource::Properties> signal_put;
@@ -95,9 +94,6 @@ protected:
void error(const std::string& msg)
{ if (_enabled) signal_error.emit(msg); }
- void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol)
- { if (_enabled) signal_new_plugin.emit(uri, type_uri, symbol); }
-
void put(const Raul::URI& path, const Shared::Resource::Properties& properties)
{ if (_enabled) signal_put.emit(path, properties); }
diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp
index d83e3334..eda3bfb2 100644
--- a/src/client/ThreadedSigClientInterface.hpp
+++ b/src/client/ThreadedSigClientInterface.hpp
@@ -50,7 +50,6 @@ public:
, response_ok_slot(signal_response_ok.make_slot())
, response_error_slot(signal_response_error.make_slot())
, error_slot(signal_error.make_slot())
- , new_plugin_slot(signal_new_plugin.make_slot())
, new_port_slot(signal_new_port.make_slot())
, put_slot(signal_put.make_slot())
, connection_slot(signal_connection.make_slot())
@@ -89,9 +88,6 @@ public:
void error(const std::string& msg)
{ push_sig(sigc::bind(error_slot, msg)); }
- void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol)
- { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, symbol)); }
-
void put(const Raul::URI& path, const Shared::Resource::Properties& properties)
{ push_sig(sigc::bind(put_slot, path, properties)); }
diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp
index 05ecfa7a..619c48b8 100644
--- a/src/common/interface/ClientInterface.hpp
+++ b/src/common/interface/ClientInterface.hpp
@@ -54,10 +54,6 @@ public:
virtual void error(const std::string& msg) = 0;
- virtual void new_plugin(const Raul::URI& uri,
- const Raul::URI& type_uri,
- const Raul::Symbol& symbol) = 0;
-
virtual void activity(const Raul::Path& path) = 0;
};
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp
index 50a1112b..48281cf3 100644
--- a/src/engine/ClientBroadcaster.cpp
+++ b/src/engine/ClientBroadcaster.cpp
@@ -116,7 +116,7 @@ ClientBroadcaster::send_plugins_to(ClientInterface* client, const NodeFactory::P
for (NodeFactory::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) {
const PluginImpl* const plugin = i->second;
- client->new_plugin(plugin->uri(), plugin->type_uri(), plugin->symbol());
+ client->put(plugin->uri(), plugin->properties());
}
client->transfer_end();
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index 41f517cb..6735c164 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -157,20 +157,6 @@ HTTPClientSender::new_object(const Shared::GraphObject* object)
void
-HTTPClientSender::new_plugin(const URI& uri,
- const URI& type_uri,
- const Symbol& symbol)
-{
- /*lo_message m = lo_message_new();
- lo_message_add_string(m, uri.c_str());
- lo_message_add_string(m, type_uri.c_str());
- lo_message_add_string(m, symbol.c_str());
- lo_message_add_string(m, name.c_str());
- send_message("/ingen/plugin", m);*/
-}
-
-
-void
HTTPClientSender::move(const Path& old_path, const Path& new_path)
{
string msg = string(
diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp
index 9a7948ff..a9d37784 100644
--- a/src/engine/HTTPClientSender.hpp
+++ b/src/engine/HTTPClientSender.hpp
@@ -74,10 +74,6 @@ public:
//virtual bool new_object(const Shared::GraphObject* object);
- virtual void new_plugin(const Raul::URI& uri,
- const Raul::URI& type_uri,
- const Raul::Symbol& symbol);
-
virtual void put(const Raul::URI& path,
const Shared::Resource::Properties& properties);
diff --git a/src/engine/InternalPlugin.cpp b/src/engine/InternalPlugin.cpp
index e98b14ed..8ab9070b 100644
--- a/src/engine/InternalPlugin.cpp
+++ b/src/engine/InternalPlugin.cpp
@@ -25,10 +25,19 @@
#include "AudioDriver.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
+InternalPlugin::InternalPlugin(const std::string& uri, const std::string& symbol)
+ : PluginImpl(Plugin::Internal, uri)
+ , _symbol(symbol)
+{
+ set_property("rdf:type", Atom(Atom::URI, "ingen:Internal"));
+}
+
+
NodeImpl*
InternalPlugin::instantiate(const string& name,
bool polyphonic,
diff --git a/src/engine/InternalPlugin.hpp b/src/engine/InternalPlugin.hpp
index 3c0583cd..d9d6b0b2 100644
--- a/src/engine/InternalPlugin.hpp
+++ b/src/engine/InternalPlugin.hpp
@@ -44,11 +44,7 @@ class NodeImpl;
class InternalPlugin : public PluginImpl
{
public:
- InternalPlugin(const std::string& uri,
- const std::string& symbol)
- : PluginImpl(Plugin::Internal, uri)
- , _symbol(symbol)
- {}
+ InternalPlugin(const std::string& uri, const std::string& symbol);
NodeImpl* instantiate(const std::string& name,
bool polyphonic,
diff --git a/src/engine/LADSPAPlugin.cpp b/src/engine/LADSPAPlugin.cpp
index 2279da00..0b3aabdc 100644
--- a/src/engine/LADSPAPlugin.cpp
+++ b/src/engine/LADSPAPlugin.cpp
@@ -18,16 +18,34 @@
#include <cassert>
#include <ladspa.h>
#include <iostream>
+#include <raul/Symbol.hpp>
#include "LADSPAPlugin.hpp"
#include "LADSPANode.hpp"
#include "Engine.hpp"
#include "AudioDriver.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
+LADSPAPlugin::LADSPAPlugin(
+ const std::string& library_path,
+ const std::string& uri,
+ unsigned long id,
+ const std::string& label,
+ const std::string& name)
+ : PluginImpl(Plugin::LADSPA, uri, library_path)
+ , _id(id)
+ , _label(label)
+ , _name(Raul::Atom::STRING, name)
+{
+ set_property("rdf:type", Atom(Atom::URI, "ingen:LADSPAPlugin"));
+ set_property("lv2:symbol", Atom(Atom::STRING, Symbol::symbolify(label)));
+}
+
+
const Raul::Atom&
LADSPAPlugin::get_property(const Raul::URI& uri) const
{
diff --git a/src/engine/LADSPAPlugin.hpp b/src/engine/LADSPAPlugin.hpp
index 967a2fd4..0a9bbdd7 100644
--- a/src/engine/LADSPAPlugin.hpp
+++ b/src/engine/LADSPAPlugin.hpp
@@ -42,12 +42,7 @@ public:
const std::string& uri,
unsigned long id,
const std::string& label,
- const std::string& name)
- : PluginImpl(Plugin::LADSPA, uri, library_path)
- , _id(id)
- , _label(label)
- , _name(Raul::Atom::STRING, name)
- {}
+ const std::string& name);
NodeImpl* instantiate(const std::string& name,
bool polyphonic,
diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp
index c3992fb1..0736dfcb 100644
--- a/src/engine/LV2Plugin.cpp
+++ b/src/engine/LV2Plugin.cpp
@@ -30,6 +30,14 @@ using namespace Raul;
namespace Ingen {
+LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri)
+ : PluginImpl(Plugin::LV2, uri)
+ , _slv2_plugin(NULL)
+ , _lv2_info(lv2_info)
+{
+ set_property("rdf:type", Atom(Atom::URI, "lv2:Plugin"));
+}
+
const string
LV2Plugin::symbol() const
{
diff --git a/src/engine/LV2Plugin.hpp b/src/engine/LV2Plugin.hpp
index f5223d8f..29c987d4 100644
--- a/src/engine/LV2Plugin.hpp
+++ b/src/engine/LV2Plugin.hpp
@@ -46,11 +46,7 @@ class NodeImpl;
class LV2Plugin : public PluginImpl
{
public:
- LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri)
- : PluginImpl(Plugin::LV2, uri)
- , _slv2_plugin(NULL)
- , _lv2_info(lv2_info)
- {}
+ LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri);
NodeImpl* instantiate(const std::string& name,
bool polyphonic,
diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp
index 3d33c6ce..76ab0459 100644
--- a/src/engine/OSCClientSender.cpp
+++ b/src/engine/OSCClientSender.cpp
@@ -259,26 +259,4 @@ OSCClientSender::activity(const Path& path)
}
-/** \page client_osc_namespace
- * <h2>/ingen/plugin</h2>
- * \arg \b uri (string) - URI of plugin (e.g. http://example.org/filtermatic)
- * \arg \b type (string) - Type of plugin (e.g. "lv2:Plugin", "ingen:LADSPAPlugin")
- * \arg \b symbol (string) - Valid symbol for plugin (default symbol for nodes) (e.g. "adsr")
- * \arg \b name (string) - Descriptive human-readable name of plugin (e.g. "ADSR Envelope")
- *
- * Notification of the existence of a plugin.
- */
-void
-OSCClientSender::new_plugin(const URI& uri,
- const URI& type_uri,
- const Symbol& symbol)
-{
- lo_message m = lo_message_new();
- lo_message_add_string(m, uri.c_str());
- lo_message_add_string(m, type_uri.c_str());
- lo_message_add_string(m, symbol.c_str());
- send_message("/ingen/plugin", m);
-}
-
-
} // namespace Ingen
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 333fee49..58175d47 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -71,10 +71,6 @@ public:
void error(const std::string& msg);
- virtual void new_plugin(const Raul::URI& uri,
- const Raul::URI& type_uri,
- const Raul::Symbol& symbol);
-
virtual void put(const Raul::URI& path,
const Shared::Resource::Properties& properties);
diff --git a/src/engine/events/RequestObjectEvent.cpp b/src/engine/events/RequestObjectEvent.cpp
index c17e4983..a74f15d3 100644
--- a/src/engine/events/RequestObjectEvent.cpp
+++ b/src/engine/events/RequestObjectEvent.cpp
@@ -75,7 +75,7 @@ RequestObjectEvent::post_process()
if (_object)
_responder->client()->put(_uri, _object->properties());
else if (_plugin)
- _responder->client()->new_plugin(_uri, _plugin->type_uri(), _plugin->symbol());
+ _responder->client()->put(_uri, _plugin->properties());
} else {
_responder->respond_error("Unable to find client to send object.");
}