summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientStore.cpp26
-rw-r--r--src/client/ClientStore.hpp8
-rw-r--r--src/client/DeprecatedLoader.cpp58
-rw-r--r--src/client/DeprecatedLoader.hpp11
-rw-r--r--src/client/HTTPClientReceiver.cpp10
-rw-r--r--src/client/HTTPEngineSender.cpp4
-rw-r--r--src/client/HTTPEngineSender.hpp2
-rw-r--r--src/client/NodeModel.cpp13
-rw-r--r--src/client/NodeModel.hpp19
-rw-r--r--src/client/ObjectModel.cpp8
-rw-r--r--src/client/ObjectModel.hpp10
-rw-r--r--src/client/PatchModel.cpp6
-rw-r--r--src/client/PatchModel.hpp4
-rw-r--r--src/client/PluginModel.cpp7
-rw-r--r--src/client/PluginModel.hpp4
-rw-r--r--src/client/PluginUI.cpp20
-rw-r--r--src/client/PortModel.cpp17
-rw-r--r--src/client/PortModel.hpp7
18 files changed, 131 insertions, 103 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index fd73c4b5..82c87e1e 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -37,8 +37,10 @@ using namespace Shared;
namespace Client {
-ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter)
- : _engine(engine)
+ClientStore::ClientStore(SharedPtr<Shared::LV2URIMap> uris,
+ SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter)
+ : _uris(uris)
+ , _engine(engine)
, _emitter(emitter)
, _plugins(new Plugins())
{
@@ -257,14 +259,12 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
bool is_path = Path::is_valid(uri.str());
bool is_meta = ResourceImpl::is_meta_uri(uri);
- const LV2URIMap& uris = Shared::LV2URIMap::instance();
-
if (!(is_path || is_meta)) {
- const Atom& type = properties.find(uris.rdf_type)->second;
+ const Atom& type = properties.find(_uris->rdf_type)->second;
if (type.type() == Atom::URI) {
const URI& type_uri = type.get_uri();
if (Plugin::type_from_uri(type_uri) != Plugin::NIL) {
- SharedPtr<PluginModel> p(new PluginModel(uri, type_uri, properties));
+ SharedPtr<PluginModel> p(new PluginModel(uris(), uri, type_uri, properties));
add_plugin(p);
return;
}
@@ -289,24 +289,24 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
bool is_patch, is_node, is_port, is_output;
PortType data_type(PortType::UNKNOWN);
- ResourceImpl::type(properties, is_patch, is_node, is_port, is_output, data_type);
+ ResourceImpl::type(uris(), properties, is_patch, is_node, is_port, is_output, data_type);
if (is_patch) {
- SharedPtr<PatchModel> model(new PatchModel(path));
+ SharedPtr<PatchModel> model(new PatchModel(uris(), path));
model->set_properties(properties);
add_object(model);
} else if (is_node) {
- const Resource::Properties::const_iterator p = properties.find(uris.rdf_instanceOf);
+ const Resource::Properties::const_iterator p = properties.find(_uris->rdf_instanceOf);
SharedPtr<PluginModel> plug;
if (p->second.is_valid() && p->second.type() == Atom::URI) {
if (!(plug = plugin(p->second.get_uri()))) {
LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl;
plug = SharedPtr<PluginModel>(
- new PluginModel(p->second.get_uri(), uris.ingen_nil, Resource::Properties()));
+ new PluginModel(uris(), p->second.get_uri(), _uris->ingen_nil, Resource::Properties()));
add_plugin(plug);
}
- SharedPtr<NodeModel> n(new NodeModel(plug, path));
+ SharedPtr<NodeModel> n(new NodeModel(uris(), plug, path));
n->set_properties(properties);
add_object(n);
} else {
@@ -315,9 +315,9 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
} else if (is_port) {
if (data_type != PortType::UNKNOWN) {
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
- const Resource::Properties::const_iterator i = properties.find(uris.lv2_index);
+ const Resource::Properties::const_iterator i = properties.find(_uris->lv2_index);
if (i != properties.end() && i->second.type() == Atom::INT) {
- SharedPtr<PortModel> p(new PortModel(path, i->second.get_int32(), data_type, pdir));
+ SharedPtr<PortModel> p(new PortModel(uris(), path, i->second.get_int32(), data_type, pdir));
p->set_properties(properties);
add_object(p);
} else {
diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp
index 35dabdcf..ac77e6ab 100644
--- a/src/client/ClientStore.hpp
+++ b/src/client/ClientStore.hpp
@@ -52,8 +52,9 @@ class ConnectionModel;
*/
class ClientStore : public Shared::Store, public Shared::CommonInterface, public sigc::trackable {
public:
- ClientStore(SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(),
- SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>());
+ ClientStore(SharedPtr<Shared::LV2URIMap> uris,
+ SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(),
+ SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>());
SharedPtr<PluginModel> plugin(const Raul::URI& uri);
SharedPtr<ObjectModel> object(const Raul::Path& path);
@@ -66,6 +67,8 @@ public:
SharedPtr<Plugins> plugins() { return _plugins; }
void set_plugins(SharedPtr<Plugins> p) { _plugins = p; }
+ Shared::LV2URIMap& uris() { return *_uris.get(); }
+
// CommonInterface
bool new_object(const Shared::GraphObject* object);
void put(const Raul::URI& path, const Shared::Resource::Properties& properties);
@@ -99,6 +102,7 @@ private:
bool attempt_connection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
+ SharedPtr<Shared::LV2URIMap> _uris;
SharedPtr<Shared::EngineInterface> _engine;
SharedPtr<SigClientInterface> _emitter;
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp
index ac71a32d..a9c7f895 100644
--- a/src/client/DeprecatedLoader.cpp
+++ b/src/client/DeprecatedLoader.cpp
@@ -212,15 +212,13 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
size_t poly = 0;
- const LV2URIMap& uris = Shared::LV2URIMap::instance();
-
/* Use parameter overridden polyphony, if given */
- GraphObject::Properties::iterator poly_param = initial_data.find(uris.ingen_polyphony);
+ GraphObject::Properties::iterator poly_param = initial_data.find(_uris->ingen_polyphony);
if (poly_param != initial_data.end() && poly_param->second.type() == Atom::INT)
poly = poly_param->second.get_int32();
- if (initial_data.find(uris.ingen_document) == initial_data.end())
- initial_data.insert(make_pair(uris.ingen_document, filename));
+ if (initial_data.find(_uris->ingen_document) == initial_data.end())
+ initial_data.insert(make_pair(_uris->ingen_document, filename));
xmlDocPtr doc = xmlParseFile(filename.c_str());
@@ -284,8 +282,8 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
// Create it, if we're not merging
if (!existing && !path.is_root()) {
Resource::Properties props;
- props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
- props.insert(make_pair(uris.ingen_polyphony, Atom((int32_t)poly)));
+ props.insert(make_pair(_uris->rdf_type, _uris->ingen_Patch));
+ props.insert(make_pair(_uris->ingen_polyphony, Atom((int32_t)poly)));
_engine->put(path, props);
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_property(path, i->first, i->second);
@@ -330,7 +328,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
for ( ; i != pm->controls().end(); ++i) {
const float value = i->value();
_engine->set_property(translate_load_path(i->port_path().str()),
- uris.ingen_value, Atom(value));
+ _uris->ingen_value, Atom(value));
}
} else {
LOG(warn) << "Unknown preset `" << pm->name() << "'" << endl;
@@ -347,7 +345,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
// _engine->set_property(subject, i->first, i->second);
if (!existing)
- _engine->set_property(path, uris.ingen_enabled, (bool)true);
+ _engine->set_property(path, _uris->ingen_enabled, (bool)true);
_load_path_translations.clear();
@@ -439,8 +437,6 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
return false;
}
- const LV2URIMap& uris = Shared::LV2URIMap::instance();
-
// Compatibility hacks for old patches that represent patch ports as nodes
if (plugin_uri.empty()) {
bool is_port = false;
@@ -450,23 +446,23 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
if (plugin_type == "Internal") {
is_port = true;
if (plugin_label == "audio_input") {
- props.insert(make_pair(uris.rdf_type, uris.lv2_AudioPort));
- props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_AudioPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort));
} else if (plugin_label == "audio_output") {
- props.insert(make_pair(uris.rdf_type, uris.lv2_AudioPort));
- props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_AudioPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort));
} else if (plugin_label == "control_input") {
- props.insert(make_pair(uris.rdf_type, uris.lv2_ControlPort));
- props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort));
} else if (plugin_label == "control_output" ) {
- props.insert(make_pair(uris.rdf_type, uris.lv2_ControlPort));
- props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort));
} else if (plugin_label == "midi_input") {
- props.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort));
- props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort));
} else if (plugin_label == "midi_output" ) {
- props.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort));
- props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort));
+ props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort));
} else {
is_port = false;
}
@@ -523,11 +519,11 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
plugin_uri = "om:" + plugin_type + ":" + library_name + ":" + plugin_label;
Resource::Properties props;
- props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
- props.insert(make_pair(uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri)));
+ props.insert(make_pair(_uris->rdf_type, _uris->ingen_Node));
+ props.insert(make_pair(_uris->rdf_instanceOf, Atom(Atom::URI, plugin_uri)));
_engine->put(path, props);
- _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic));
+ _engine->set_property(path, _uris->ingen_polyphonic, bool(polyphonic));
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_property(path, i->first, i->second);
@@ -538,10 +534,10 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
// Not deprecated
} else {
Resource::Properties props;
- props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
- props.insert(make_pair(uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri)));
+ props.insert(make_pair(_uris->rdf_type, _uris->ingen_Node));
+ props.insert(make_pair(_uris->rdf_instanceOf, Atom(Atom::URI, plugin_uri)));
_engine->put(path, props);
- _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic));
+ _engine->set_property(path, _uris->ingen_polyphonic, bool(polyphonic));
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_property(path, i->first, i->second);
return true;
@@ -562,15 +558,13 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent,
size_t poly = 0;
GraphObject::Properties initial_data;
- const LV2URIMap& uris = Shared::LV2URIMap::instance();
-
while (cur != NULL) {
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) {
name = (const char*)key;
} else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) {
- initial_data.insert(make_pair(uris.ingen_polyphony, (int)poly));
+ initial_data.insert(make_pair(_uris->ingen_polyphony, (int)poly));
} else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) {
filename = Glib::build_filename(base_filename, (const char*)key);
} else { // Don't know what this tag is, add it as variable
diff --git a/src/client/DeprecatedLoader.hpp b/src/client/DeprecatedLoader.hpp
index 79878107..1fbb0c7e 100644
--- a/src/client/DeprecatedLoader.hpp
+++ b/src/client/DeprecatedLoader.hpp
@@ -33,6 +33,9 @@
namespace Raul { class Path; }
namespace Ingen {
+
+namespace Shared { class LV2URIMap; }
+
namespace Client {
class PresetModel; // defined in DeprecatedLoader.cpp
@@ -45,8 +48,11 @@ class PresetModel; // defined in DeprecatedLoader.cpp
class DeprecatedLoader
{
public:
- DeprecatedLoader(SharedPtr<Shared::EngineInterface> engine)
- : _engine(engine)
+ DeprecatedLoader(
+ SharedPtr<Shared::LV2URIMap> uris,
+ SharedPtr<Shared::EngineInterface> engine)
+ : _uris(uris)
+ , _engine(engine)
{
assert(_engine);
}
@@ -64,6 +70,7 @@ private:
std::string nameify_if_invalid(const std::string& name);
std::string translate_load_path(const std::string& path);
+ SharedPtr<Shared::LV2URIMap> _uris;
SharedPtr<Shared::EngineInterface> _engine;
/// Translations of paths from the loading file to actual paths (for deprecated patches)
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 72d5a369..a85b3573 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -133,7 +133,7 @@ HTTPClientReceiver::close_session()
void
HTTPClientReceiver::update(const std::string& str)
{
- LOG(info) << _world->parser->parse_update(_world, _target.get(), str, _url);
+ LOG(info) << _world->parser()->parse_update(_world, _target.get(), str, _url);
}
void
@@ -188,7 +188,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
} else {
Glib::Mutex::Lock lock(me->_mutex);
me->_target->response_ok(0);
- me->_world->parser->parse_string(me->_world, me->_target.get(),
+ me->_world->parser()->parse_string(me->_world, me->_target.get(),
Glib::ustring(msg->response_body->data), me->_url);
}
@@ -198,7 +198,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
} else {
Glib::Mutex::Lock lock(me->_mutex);
me->_target->response_ok(0);
- me->_world->parser->parse_string(me->_world, me->_target.get(),
+ me->_world->parser()->parse_string(me->_world, me->_target.get(),
Glib::ustring(msg->response_body->data),
Glib::ustring("/patch/"));
}
@@ -226,9 +226,9 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
void
HTTPClientReceiver::start(bool dump)
{
- Glib::Mutex::Lock lock(_world->rdf_world->mutex());
+ Glib::Mutex::Lock lock(_world->rdf_world()->mutex());
- if (!_world->parser)
+ if (!_world->parser())
_world->load("ingen_serialisation");
SoupMessage* msg = soup_message_new("GET", (_url + "/stream").c_str());
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index dbe89b14..7c13f839 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -33,8 +33,8 @@ using namespace Shared;
namespace Client {
-HTTPEngineSender::HTTPEngineSender(const World* world, const URI& engine_url)
- : _world(*world->rdf_world)
+HTTPEngineSender::HTTPEngineSender(World* world, const URI& engine_url)
+ : _world(*world->rdf_world())
, _engine_url(engine_url)
, _id(0)
, _enabled(true)
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index 944079de..79271852 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -43,7 +43,7 @@ class HTTPClientReceiver;
class HTTPEngineSender : public Shared::EngineInterface
{
public:
- HTTPEngineSender(const Shared::World* world, const Raul::URI& engine_url);
+ HTTPEngineSender(Shared::World* world, const Raul::URI& engine_url);
~HTTPEngineSender();
Raul::URI uri() const { return _engine_url; }
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index bed43e7a..8be906d9 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -30,8 +30,8 @@ namespace Ingen {
namespace Client {
-NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path)
- : ObjectModel(path)
+NodeModel::NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, const Path& path)
+ : ObjectModel(uris, path)
, _plugin_uri(plugin->uri())
, _plugin(plugin)
, _num_values(0)
@@ -40,8 +40,8 @@ NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path)
{
}
-NodeModel::NodeModel(const URI& plugin_uri, const Path& path)
- : ObjectModel(path)
+NodeModel::NodeModel(Shared::LV2URIMap& uris, const URI& plugin_uri, const Path& path)
+ : ObjectModel(uris, path)
, _plugin_uri(plugin_uri)
, _num_values(0)
, _min_values(0)
@@ -206,14 +206,13 @@ NodeModel::default_port_value_range(SharedPtr<PortModel> port, float& min, float
void
NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) const
{
- const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();
assert(port->parent().get() == this);
default_port_value_range(port, min, max);
// Possibly overriden
- const Atom& min_atom = port->get_property(uris.lv2_minimum);
- const Atom& max_atom = port->get_property(uris.lv2_maximum);
+ const Atom& min_atom = port->get_property(_uris.lv2_minimum);
+ const Atom& max_atom = port->get_property(_uris.lv2_maximum);
if (min_atom.type() == Atom::FLOAT)
min = min_atom.get_float();
if (max_atom.type() == Atom::FLOAT)
diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp
index c1eb91e7..d13caf88 100644
--- a/src/client/NodeModel.hpp
+++ b/src/client/NodeModel.hpp
@@ -32,6 +32,9 @@
namespace Raul { class Path; }
namespace Ingen {
+
+namespace Shared { class LV2URIMap; }
+
namespace Client {
class PluginModel;
@@ -71,8 +74,8 @@ public:
protected:
friend class ClientStore;
- NodeModel(const Raul::URI& plugin_uri, const Raul::Path& path);
- NodeModel(SharedPtr<PluginModel> plugin, const Raul::Path& path);
+ NodeModel(Shared::LV2URIMap& uris, const Raul::URI& plugin_uri, const Raul::Path& path);
+ NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, const Raul::Path& path);
NodeModel(const Raul::Path& path);
void add_child(SharedPtr<ObjectModel> c);
@@ -86,14 +89,14 @@ protected:
virtual void clear();
- Ports _ports; ///< Vector of ports (not a Table to preserve order)
- Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
- SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of
+ Ports _ports; ///< Vector of ports (not a Table to preserve order)
+ Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown)
+ SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of
private:
- mutable uint32_t _num_values; ///< Size of _min_values and _max_values
- mutable float* _min_values; ///< Port min values (cached for LV2)
- mutable float* _max_values; ///< Port max values (cached for LV2)
+ mutable uint32_t _num_values; ///< Size of _min_values and _max_values
+ mutable float* _min_values; ///< Port min values (cached for LV2)
+ mutable float* _max_values; ///< Port max values (cached for LV2)
};
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index a2423ab8..c449bf12 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -27,9 +27,9 @@ namespace Ingen {
namespace Client {
-ObjectModel::ObjectModel(const Path& path)
- : ResourceImpl(path)
- , _meta(ResourceImpl::meta_uri(path))
+ObjectModel::ObjectModel(Shared::LV2URIMap& uris, const Raul::Path& path)
+ : ResourceImpl(uris, path)
+ , _meta(uris, ResourceImpl::meta_uri(path))
, _path(path)
, _symbol((path == Path::root()) ? "root" : path.symbol())
{
@@ -76,7 +76,7 @@ ObjectModel::get_property(const Raul::URI& key) const
bool
ObjectModel::polyphonic() const
{
- const Raul::Atom& polyphonic = get_property(Shared::LV2URIMap::instance().ingen_polyphonic);
+ const Raul::Atom& polyphonic = get_property(_uris.ingen_polyphonic);
return (polyphonic.is_valid() && polyphonic.get_bool());
}
diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp
index 2c1fd23e..0a108cb9 100644
--- a/src/client/ObjectModel.hpp
+++ b/src/client/ObjectModel.hpp
@@ -31,6 +31,9 @@
#include "shared/ResourceImpl.hpp"
namespace Ingen {
+
+namespace Shared { class LV2URIMap; }
+
namespace Client {
class ClientStore;
@@ -79,7 +82,7 @@ public:
protected:
friend class ClientStore;
- ObjectModel(const Raul::Path& path);
+ ObjectModel(Shared::LV2URIMap& uris, const Raul::Path& path);
virtual void set_path(const Raul::Path& p);
virtual void set_parent(SharedPtr<ObjectModel> p);
@@ -89,12 +92,11 @@ protected:
virtual void set(SharedPtr<ObjectModel> model);
ResourceImpl _meta;
-
SharedPtr<ObjectModel> _parent;
private:
- Raul::Path _path;
- Raul::Symbol _symbol;
+ Raul::Path _path;
+ Raul::Symbol _symbol;
};
diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp
index 94557bd0..e7d30665 100644
--- a/src/client/PatchModel.cpp
+++ b/src/client/PatchModel.cpp
@@ -160,7 +160,7 @@ PatchModel::remove_connection(const Shared::Port* src_port, const Shared::Port*
bool
PatchModel::enabled() const
{
- const Raul::Atom& enabled = get_property(Shared::LV2URIMap::instance().ingen_enabled);
+ const Raul::Atom& enabled = get_property(_uris.ingen_enabled);
return (enabled.is_valid() && enabled.get_bool());
}
@@ -168,7 +168,7 @@ PatchModel::enabled() const
uint32_t
PatchModel::internal_poly() const
{
- const Raul::Atom& poly = get_property(Shared::LV2URIMap::instance().ingen_polyphony);
+ const Raul::Atom& poly = get_property(_uris.ingen_polyphony);
return poly.is_valid() ? poly.get_int32() : 1;
}
@@ -176,7 +176,7 @@ PatchModel::internal_poly() const
bool
PatchModel::polyphonic() const
{
- const Raul::Atom& poly = get_property(Shared::LV2URIMap::instance().ingen_polyphonic);
+ const Raul::Atom& poly = get_property(_uris.ingen_polyphonic);
return poly.is_valid() && poly.get_bool();
}
diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp
index e3baa3eb..d4c564d2 100644
--- a/src/client/PatchModel.hpp
+++ b/src/client/PatchModel.hpp
@@ -76,8 +76,8 @@ public:
private:
friend class ClientStore;
- PatchModel(const Raul::Path& patch_path)
- : NodeModel("http://drobilla.net/ns/ingen#Patch", patch_path)
+ PatchModel(Shared::LV2URIMap& uris, const Raul::Path& patch_path)
+ : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path)
, _connections(new Connections())
, _editable(true)
{
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index b50513ce..4805c2bc 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -40,8 +40,9 @@ SLV2Plugins PluginModel::_slv2_plugins = NULL;
Redland::World* PluginModel::_rdf_world = NULL;
-PluginModel::PluginModel(const URI& uri, const URI& type_uri, const Resource::Properties& properties)
- : ResourceImpl(uri)
+PluginModel::PluginModel(Shared::LV2URIMap& uris,
+ const URI& uri, const URI& type_uri, const Resource::Properties& properties)
+ : ResourceImpl(uris, uri)
, _type(type_from_uri(type_uri.str()))
{
add_properties(properties);
@@ -69,7 +70,7 @@ PluginModel::get_property(const URI& key) const
return val;
// No lv2:symbol from data or engine, invent one
- if (key == Shared::LV2URIMap::instance().lv2_symbol) {
+ if (key == _uris.lv2_symbol) {
const URI& uri = this->uri();
size_t last_slash = uri.find_last_of('/');
size_t last_hash = uri.find_last_of('#');
diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp
index 4d54cd53..82397550 100644
--- a/src/client/PluginModel.hpp
+++ b/src/client/PluginModel.hpp
@@ -30,6 +30,9 @@
#include "shared/ResourceImpl.hpp"
namespace Ingen {
+
+namespace Shared { class LV2URIMap; }
+
namespace Client {
class PatchModel;
@@ -46,6 +49,7 @@ class PluginModel : public Ingen::Shared::Plugin
{
public:
PluginModel(
+ Shared::LV2URIMap& uris,
const Raul::URI& uri,
const Raul::URI& type_uri,
const Shared::Resource::Properties& properties);
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index f943e54f..b19211e6 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -55,7 +55,7 @@ lv2_ui_write(LV2UI_Controller controller,
SharedPtr<PortModel> port = ui->node()->ports()[port_index];
- SharedPtr<Shared::LV2URIMap> map = ui->world()->uris;
+ const Shared::LV2URIMap& uris = *ui->world()->uris().get();
// float (special case, always 0)
if (format == 0) {
@@ -63,18 +63,18 @@ lv2_ui_write(LV2UI_Controller controller,
if (*(float*)buffer == port->value().get_float())
return; // do nothing (handle stupid plugin UIs that feed back)
- ui->world()->engine->set_property(port->path(), map->ingen_value, Atom(*(float*)buffer));
+ ui->world()->engine()->set_property(port->path(), uris.ingen_value, Atom(*(float*)buffer));
- } else if (format == map->ui_format_events.id) {
+ } else if (format == uris.ui_format_events.id) {
LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer;
LV2_Event_Iterator iter;
uint8_t* data;
lv2_event_begin(&iter, buf);
while (lv2_event_is_valid(&iter)) {
LV2_Event* const ev = lv2_event_get(&iter, &data);
- if (ev->type == map->midi_event.id) {
+ if (ev->type == uris.midi_event.id) {
// FIXME: bundle multiple events by writing an entire buffer here
- ui->world()->engine->set_property(port->path(), map->ingen_value,
+ ui->world()->engine()->set_property(port->path(), uris.ingen_value,
Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size, data));
} else {
warn << "Unable to send event type " << ev->type <<
@@ -84,11 +84,11 @@ lv2_ui_write(LV2UI_Controller controller,
lv2_event_increment(&iter);
}
- } else if (format == map->object_transfer.id) {
+ } else if (format == uris.object_transfer.id) {
LV2_Object* buf = (LV2_Object*)buffer;
Raul::Atom val;
- Shared::LV2Object::to_atom(buf, val);
- ui->world()->engine->set_property(port->path(), map->ingen_value, val);
+ Shared::LV2Object::to_atom(uris, buf, val);
+ ui->world()->engine()->set_property(port->path(), uris.ingen_value, val);
} else {
warn << "Unknown value format " << format
@@ -122,7 +122,7 @@ PluginUI::create(Ingen::Shared::World* world,
Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex());
SharedPtr<PluginUI> ret;
- SLV2Value gtk_gui_uri = slv2_value_new_uri(world->slv2_world,
+ SLV2Value gtk_gui_uri = slv2_value_new_uri(world->slv2_world(),
"http://lv2plug.in/ns/extensions/ui#GtkUI");
SLV2UIs uis = slv2_plugin_get_uis(plugin);
@@ -141,7 +141,7 @@ PluginUI::create(Ingen::Shared::World* world,
if (ui) {
info << "Found GTK Plugin UI: " << slv2_ui_get_uri(ui) << endl;
ret = SharedPtr<PluginUI>(new PluginUI(world, node));
- ret->_features = world->lv2_features->lv2_features(node.get());
+ ret->_features = world->lv2_features()->lv2_features(node.get());
SLV2UIInstance inst = slv2_ui_instantiate(
plugin, ui, lv2_ui_write, ret.get(), ret->_features->array());
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index e23a0e1a..80934cad 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -28,7 +28,7 @@ PortModel::set_property(const Raul::URI& uri,
const Raul::Atom& value)
{
Raul::Atom& ret = ObjectModel::set_property(uri, value);
- if (uri == Shared::LV2URIMap::instance().ingen_value)
+ if (uri == _uris.ingen_value)
this->value(value);
return ret;
}
@@ -37,14 +37,14 @@ PortModel::set_property(const Raul::URI& uri,
bool
PortModel::supports(const Raul::URI& value_type) const
{
- return has_property(Shared::LV2URIMap::instance().obj_supports, value_type);
+ return has_property(_uris.obj_supports, value_type);
}
bool
PortModel::port_property(const std::string& uri) const
{
- return has_property(Shared::LV2URIMap::instance().lv2_portProperty, Raul::URI(uri));
+ return has_property(_uris.lv2_portProperty, Raul::URI(uri));
}
@@ -65,5 +65,16 @@ PortModel::set(SharedPtr<ObjectModel> model)
}
+bool
+PortModel::has_context(const Raul::URI& uri)
+{
+ const Raul::Atom& context = get_property(_uris.ctx_context);
+ if (uri == _uris.ctx_AudioContext && !context.is_valid())
+ return true;
+ else
+ return context == uri;
+}
+
+
} // namespace Client
} // namespace Ingen
diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp
index 02305e1a..dc864ffe 100644
--- a/src/client/PortModel.hpp
+++ b/src/client/PortModel.hpp
@@ -58,6 +58,8 @@ public:
bool is_integer() const { return port_property("http://lv2plug.in/ns/lv2core#integer"); }
bool is_toggle() const { return port_property("http://lv2plug.in/ns/lv2core#toggled"); }
+ bool has_context(const Raul::URI& context);
+
inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); }
Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value);
@@ -84,8 +86,9 @@ public:
private:
friend class ClientStore;
- PortModel(const Raul::Path& path, uint32_t index, Shared::PortType type, Direction dir)
- : ObjectModel(path)
+ PortModel(Shared::LV2URIMap& uris,
+ const Raul::Path& path, uint32_t index, Shared::PortType type, Direction dir)
+ : ObjectModel(uris, path)
, _index(index)
, _direction(dir)
, _current_val(0.0f)