summaryrefslogtreecommitdiffstats
path: root/src/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-03-06 10:23:19 +0000
committerDavid Robillard <d@drobilla.net>2010-03-06 10:23:19 +0000
commit059f20c9666234f2be01498ee04f1e7ee795ba8f (patch)
treeef0d53073d53012aeaa7d084fccf477b166c0684 /src/engine/events
parent085a451dfec54126be1b9346899c81d82e6eb58e (diff)
downloadingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.gz
ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.bz2
ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.zip
Save Ingen patches as working standard LV2 plugin bundles.
This allows you to create an Ingen patch in Ingen running as a Jack client, save it, then load that patch as an LV2 plugin in any LV2 compliant host. Eliminate (hopefully) all static data in the engine (for multiple instantiations in a single process). More API/ABI stable interface for Ingen::Shared::World. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2533 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events')
-rw-r--r--src/engine/events/CreateNode.cpp4
-rw-r--r--src/engine/events/CreatePatch.cpp2
-rw-r--r--src/engine/events/CreatePort.cpp2
-rw-r--r--src/engine/events/Delete.cpp14
-rw-r--r--src/engine/events/Delete.hpp3
-rw-r--r--src/engine/events/RequestMetadata.cpp6
-rw-r--r--src/engine/events/SendBinding.cpp2
-rw-r--r--src/engine/events/SendPortValue.cpp2
-rw-r--r--src/engine/events/SetMetadata.cpp4
-rw-r--r--src/engine/events/SetPortValue.cpp12
10 files changed, 26 insertions, 25 deletions
diff --git a/src/engine/events/CreateNode.cpp b/src/engine/events/CreateNode.cpp
index dc3f4469..1e428fdc 100644
--- a/src/engine/events/CreateNode.cpp
+++ b/src/engine/events/CreateNode.cpp
@@ -81,8 +81,8 @@ CreateNode::CreateNode(
_plugin_label = uri;
}
- const LV2URIMap& uris = Shared::LV2URIMap::instance();
- const Resource::Properties::const_iterator p = properties.find(uris.ingen_polyphonic);
+ const Resource::Properties::const_iterator p = properties.find(
+ engine.world()->uris()->ingen_polyphonic);
if (p != properties.end() && p->second.type() == Raul::Atom::BOOL
&& p->second.get_bool())
_polyphonic = true;
diff --git a/src/engine/events/CreatePatch.cpp b/src/engine/events/CreatePatch.cpp
index 5f87d605..17a27d11 100644
--- a/src/engine/events/CreatePatch.cpp
+++ b/src/engine/events/CreatePatch.cpp
@@ -83,7 +83,7 @@ CreatePatch::pre_process()
if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_poly()))
poly = _poly;
- const LV2URIMap& uris = *_engine.world()->uris.get();
+ const LV2URIMap& uris = *_engine.world()->uris().get();
_patch = new PatchImpl(_engine, path.symbol(), poly, _parent,
_engine.driver()->sample_rate(), _poly);
diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp
index 33477400..cb76e9a2 100644
--- a/src/engine/events/CreatePort.cpp
+++ b/src/engine/events/CreatePort.cpp
@@ -84,7 +84,7 @@ CreatePort::pre_process()
_patch = _engine.engine_store()->find_patch(_path.parent());
- const LV2URIMap& uris = *_engine.world()->uris.get();
+ const LV2URIMap& uris = *_engine.world()->uris().get();
if (_patch != NULL) {
assert(_patch->path() == _path.parent());
diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp
index 9e4548ac..45c54260 100644
--- a/src/engine/events/Delete.cpp
+++ b/src/engine/events/Delete.cpp
@@ -42,6 +42,7 @@ Delete::Delete(Engine& engine, SharedPtr<Request> request, FrameTime time, const
: QueuedEvent(engine, request, time, true)
, _path(path)
, _store_iterator(engine.engine_store()->end())
+ , _garbage(NULL)
, _driver_port(NULL)
, _patch_node_listnode(NULL)
, _patch_port_listnode(NULL)
@@ -153,9 +154,8 @@ Delete::execute(ProcessContext& context)
_engine.maid()->push(_port->parent_patch()->external_ports());
_port->parent_patch()->external_ports(_ports_array);
- if ( ! _port->parent_patch()->parent()) {
- _driver_port = _engine.driver()->remove_port(_port->path());
- }
+ if ( ! _port->parent_patch()->parent())
+ _garbage = _engine.driver()->remove_port(_port->path(), &_driver_port);
}
if (parent_patch) {
@@ -201,10 +201,10 @@ Delete::post_process()
_request->respond_error("Unable to delete object " + _path.chop_scheme());
}
- if (_driver_port) {
- _driver_port->elem()->destroy();
- _engine.maid()->push(_driver_port);
- }
+ if (_driver_port)
+ _driver_port->destroy();
+
+ _engine.maid()->push(_garbage);
}
diff --git a/src/engine/events/Delete.hpp b/src/engine/events/Delete.hpp
index be786c56..54a02d9f 100644
--- a/src/engine/events/Delete.hpp
+++ b/src/engine/events/Delete.hpp
@@ -75,7 +75,8 @@ private:
EngineStore::iterator _store_iterator;
SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
SharedPtr<PortImpl> _port; ///< Non-NULL iff a port
- Raul::List<DriverPort*>::Node* _driver_port;
+ Raul::Deletable* _garbage;
+ DriverPort* _driver_port;
PatchImpl::Nodes::Node* _patch_node_listnode;
Raul::List<PortImpl*>::Node* _patch_port_listnode;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp
index 69c5b271..5efc7072 100644
--- a/src/engine/events/RequestMetadata.cpp
+++ b/src/engine/events/RequestMetadata.cpp
@@ -74,7 +74,7 @@ RequestMetadata::pre_process()
GraphObjectImpl* obj = dynamic_cast<GraphObjectImpl*>(_resource);
if (obj) {
- if (_key == _engine.world()->uris->ingen_value)
+ if (_key == _engine.world()->uris()->ingen_value)
_special_type = PORT_VALUE;
else if (_is_meta)
_value = obj->meta().get_property(_key);
@@ -101,7 +101,7 @@ RequestMetadata::execute(ProcessContext& context)
} else {
IntrusivePtr<ObjectBuffer> obuf = PtrCast<ObjectBuffer>(port->buffer(0));
if (obuf) {
- LV2Object::to_atom(obuf->object(), _value);
+ LV2Object::to_atom(*_engine.world()->uris().get(), obuf->object(), _value);
}
}
} else {
@@ -119,7 +119,7 @@ RequestMetadata::post_process()
if (_resource) {
_request->respond_ok();
_request->client()->set_property(_uri.str(),
- _engine.world()->uris->ingen_value, _value);
+ _engine.world()->uris()->ingen_value, _value);
} else {
const string msg = "Get value for non-port " + _uri.str();
_request->respond_error(msg);
diff --git a/src/engine/events/SendBinding.cpp b/src/engine/events/SendBinding.cpp
index c3c83ea4..82736f53 100644
--- a/src/engine/events/SendBinding.cpp
+++ b/src/engine/events/SendBinding.cpp
@@ -31,7 +31,7 @@ namespace Events {
void
SendBinding::post_process()
{
- const LV2URIMap& uris = *_engine.world()->uris.get();
+ const LV2URIMap& uris = *_engine.world()->uris().get();
Raul::Atom::DictValue dict;
if (_type == ControlBindings::MIDI_CC) {
dict[uris.rdf_type] = uris.midi_Controller;
diff --git a/src/engine/events/SendPortValue.cpp b/src/engine/events/SendPortValue.cpp
index e6bf7ad9..394decad 100644
--- a/src/engine/events/SendPortValue.cpp
+++ b/src/engine/events/SendPortValue.cpp
@@ -33,7 +33,7 @@ SendPortValue::post_process()
{
_engine.broadcaster()->set_property(
_port->path(),
- _engine.world()->uris->ingen_value, _value);
+ _engine.world()->uris()->ingen_value, _value);
}
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index 6b0e5832..8066a4e9 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -111,13 +111,13 @@ SetMetadata::pre_process()
return;
}
- const LV2URIMap& uris = *_engine.world()->uris.get();
+ const LV2URIMap& uris = *_engine.world()->uris().get();
if (is_graph_object && !_object) {
Path path(_subject.str());
bool is_patch = false, is_node = false, is_port = false, is_output = false;
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);
// Create a separate request without a source so EventSource isn't unblocked twice
SharedPtr<Request> sub_request(new Request(NULL, _request->client(), _request->id()));
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index b93783c2..1a41938d 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -102,7 +102,7 @@ SetPortValue::pre_process()
if (_port) {
_port->set_value(_value);
- _port->set_property(_engine.world()->uris->ingen_value, _value);
+ _port->set_property(_engine.world()->uris()->ingen_value, _value);
}
QueuedEvent::pre_process();
@@ -151,7 +151,7 @@ SetPortValue::apply(Context& context)
return;
}
- SharedPtr<LV2URIMap> uris = _engine.world()->uris;
+ LV2URIMap& uris = *_engine.world()->uris().get();
EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
if (ebuf) {
@@ -159,14 +159,14 @@ SetPortValue::apply(Context& context)
// Size 0 event, pass it along to the plugin as a typed but empty event
if (_value.data_size() == 0) {
- const uint32_t type_id = uris->uri_to_id(NULL, _value.get_blob_type());
+ const uint32_t type_id = uris.uri_to_id(NULL, _value.get_blob_type());
ebuf->append(frames, 0, type_id, 0, NULL);
_port->raise_set_by_user_flag();
return;
} else if (!strcmp(_value.get_blob_type(), "http://lv2plug.in/ns/ext/midi#MidiEvent")) {
ebuf->prepare_write(context);
- ebuf->append(frames, 0, uris->midi_event.id, _value.data_size(),
+ ebuf->append(frames, 0, uris.midi_event.id, _value.data_size(),
(const uint8_t*)_value.get_blob());
_port->raise_set_by_user_flag();
return;
@@ -176,7 +176,7 @@ SetPortValue::apply(Context& context)
ObjectBuffer* const obuf = dynamic_cast<ObjectBuffer*>(buf);
if (obuf) {
obuf->object()->size = obuf->size() - sizeof(LV2_Object);
- if (LV2Object::from_atom(_value, obuf->object())) {
+ if (LV2Object::from_atom(uris, _value, obuf->object())) {
debug << "Converted atom " << _value << " :: " << obuf->object()->type
<< " * " << obuf->object()->size << " @ " << obuf->object() << endl;
return;
@@ -200,7 +200,7 @@ SetPortValue::post_process()
assert(_port != NULL);
_request->respond_ok();
_engine.broadcaster()->set_property(_port_path,
- _engine.world()->uris->ingen_value, _value);
+ _engine.world()->uris()->ingen_value, _value);
break;
case TYPE_MISMATCH:
ss << "Illegal value type " << _value.type()