summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-27 17:42:51 +0000
committerDavid Robillard <d@drobilla.net>2009-05-27 17:42:51 +0000
commitc11ecf0fd10641218326ae384e80413ba3cdf46c (patch)
tree52ea61f88167a2e7eacc8fa5ff0ee39ee25b2e7e /src/engine
parent8feac4ed0e764c677d4d208377e956c6db94d2dd (diff)
downloadingen-c11ecf0fd10641218326ae384e80413ba3cdf46c.tar.gz
ingen-c11ecf0fd10641218326ae384e80413ba3cdf46c.tar.bz2
ingen-c11ecf0fd10641218326ae384e80413ba3cdf46c.zip
Remove 'new_patch', 'new_node', and 'new_port' from interface in favour of generic 'put'.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2011 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/Engine.cpp3
-rw-r--r--src/engine/GraphObjectImpl.cpp9
-rw-r--r--src/engine/HTTPClientSender.cpp24
-rw-r--r--src/engine/HTTPClientSender.hpp14
-rw-r--r--src/engine/InputPort.cpp8
-rw-r--r--src/engine/OSCClientSender.cpp81
-rw-r--r--src/engine/OSCClientSender.hpp14
-rw-r--r--src/engine/OSCEngineReceiver.cpp55
-rw-r--r--src/engine/OSCEngineReceiver.hpp2
-rw-r--r--src/engine/ObjectSender.cpp37
-rw-r--r--src/engine/OutputPort.cpp8
-rw-r--r--src/engine/PortImpl.cpp35
-rw-r--r--src/engine/QueuedEngineInterface.cpp57
-rw-r--r--src/engine/QueuedEngineInterface.hpp23
-rw-r--r--src/engine/events/CreateNodeEvent.cpp14
-rw-r--r--src/engine/events/CreateNodeEvent.hpp17
-rw-r--r--src/engine/events/CreatePatchEvent.cpp12
-rw-r--r--src/engine/events/CreatePatchEvent.hpp11
-rw-r--r--src/engine/events/CreatePortEvent.cpp18
-rw-r--r--src/engine/events/CreatePortEvent.hpp15
20 files changed, 177 insertions, 280 deletions
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index 5da8ca56..4d697b5e 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -190,6 +190,9 @@ Engine::activate(size_t parallelism)
if (!root_patch) {
root_patch = new PatchImpl(*this, "", 1, NULL,
_audio_driver->sample_rate(), _audio_driver->buffer_size(), 1);
+ root_patch->add_property("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Patch"));
+ root_patch->add_property("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node"));
+ root_patch->set_property("ingen:polyphony", Raul::Atom(int32_t(1)));
root_patch->activate();
_world->store->add(root_patch);
root_patch->compiled_patch(root_patch->compile());
diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp
index 71730202..ef4e2cd4 100644
--- a/src/engine/GraphObjectImpl.cpp
+++ b/src/engine/GraphObjectImpl.cpp
@@ -30,7 +30,14 @@ using namespace Shared;
void
GraphObjectImpl::set_variable(const Raul::URI& key, const Atom& value)
{
- _variables[key] = value;
+ // Ignore duplicate statements
+ typedef Resource::Properties::const_iterator iterator;
+ const std::pair<iterator,iterator> range = _variables.equal_range(key);
+ for (iterator i = range.first; i != range.second; ++i)
+ if (i->second == value)
+ return;
+
+ _variables.insert(make_pair(key, value));
}
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index 5804ce43..b3fd1bc0 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -49,20 +49,11 @@ HTTPClientSender::error(const std::string& msg)
}
-void HTTPClientSender::new_node(const Raul::Path& node_path,
- const Raul::URI& plugin_uri)
-{
- //send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str(), LO_ARGS_END);
-}
-
-
void
-HTTPClientSender::new_port(const Raul::Path& path,
- const Raul::URI& type,
- uint32_t index,
- bool is_output)
+HTTPClientSender::put(const Raul::Path& path,
+ const Shared::Resource::Properties& properties)
{
- //send("/ingen/new_port", "sisi", path.c_str(), index, type.c_str(), is_output, LO_ARGS_END);
+ cerr << "HTTP CLIENT PUT " << path << endl;
}
@@ -163,6 +154,7 @@ HTTPClientSender::activity(const Raul::Path& path)
send_chunk(msg);
}
+#if 0
static void null_deleter(const Shared::GraphObject*) {}
bool
@@ -178,6 +170,7 @@ HTTPClientSender::new_object(const Shared::GraphObject* object)
send_chunk(str);
return true;
}
+#endif
void
@@ -195,13 +188,6 @@ HTTPClientSender::new_plugin(const Raul::URI& uri,
void
-HTTPClientSender::new_patch(const Raul::Path& path, uint32_t poly)
-{
- //send_chunk(string("<").append(path.str()).append("> a ingen:Patch"));
-}
-
-
-void
HTTPClientSender::rename(const Raul::Path& old_path, const Raul::Path& new_path)
{
string msg = string(
diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp
index 2cfe6098..e4a88112 100644
--- a/src/engine/HTTPClientSender.hpp
+++ b/src/engine/HTTPClientSender.hpp
@@ -72,22 +72,14 @@ public:
void error(const std::string& msg);
- virtual bool new_object(const Shared::GraphObject* object);
+ //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 new_patch(const Raul::Path& path,
- uint32_t poly);
-
- virtual void new_node(const Raul::Path& path,
- const Raul::URI& plugin_uri);
-
- virtual void new_port(const Raul::Path& path,
- const Raul::URI& type,
- uint32_t index,
- bool is_output);
+ virtual void put(const Raul::Path& path,
+ const Shared::Resource::Properties& properties);
virtual void clear_patch(const Raul::Path& path);
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index c8b373c1..9b10580f 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -19,11 +19,12 @@
#include <iostream>
#include <cstdlib>
#include <cassert>
+#include "interface/Patch.hpp"
#include "AudioBuffer.hpp"
-#include "EventBuffer.hpp"
#include "ConnectionImpl.hpp"
-#include "OutputPort.hpp"
+#include "EventBuffer.hpp"
#include "NodeImpl.hpp"
+#include "OutputPort.hpp"
#include "ProcessContext.hpp"
#include "util.hpp"
@@ -31,6 +32,7 @@ using namespace std;
namespace Ingen {
+namespace Shared { class Patch; }
using namespace Shared;
InputPort::InputPort(NodeImpl* parent,
@@ -42,6 +44,8 @@ InputPort::InputPort(NodeImpl* parent,
size_t buffer_size)
: PortImpl(parent, name, index, poly, type, value, buffer_size)
{
+ if (!dynamic_cast<Patch*>(parent))
+ add_property("rdf:type", Raul::Atom(Raul::Atom::URI, "lv2:InputPort"));
}
diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp
index 5f351b87..55a42e9f 100644
--- a/src/engine/OSCClientSender.cpp
+++ b/src/engine/OSCClientSender.cpp
@@ -120,45 +120,11 @@ OSCClientSender::error(const std::string& msg)
}
-/** \page client_osc_namespace
- * <p> \b /ingen/new_node - Notification of a new node's creation.
- * \arg \b plug-uri (string) - URI of the plugin new node is an instance of
- * \arg \b path (string) - Path of the new node
- * \arg \b polyphonic (boolean) - Node is polyphonic\n\n
- * \li New nodes are sent as a bundle. The first message in the bundle will be
- * this one (/ingen/new_node), followed by a series of /ingen/new_port commands,
- * followed by /ingen/new_node_end. </p> \n \n
- */
-void OSCClientSender::new_node(const Path& node_path,
- const URI& plugin_uri)
-{
- send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str(), LO_ARGS_END);
-}
-
-
-
-/** \page client_osc_namespace
- * <p> \b /ingen/new_port - Notification of a new port's creation.
- * \arg \b path (string) - Path of new port
- * \arg \b index (integer) - Index (or sort key) of port on parent
- * \arg \b data-type (string) - Type of port (ingen:AudioPort, ingen:ControlPort, ingen:EventPort)
- * \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1)
- *
- * \li Note that in the event of loading a patch, this message could be
- * followed immediately by a control change, meaning the default-value is
- * not actually the current value of the port.
- * \li The minimum and maximum values are suggestions only, they are not
- * enforced in any way, and going outside them is perfectly fine. Also note
- * that the port ranges in om_gtk are not these ones! Those ranges are set
- * as variable.</p> \n \n
- */
void
-OSCClientSender::new_port(const Path& path,
- const URI& type,
- uint32_t index,
- bool is_output)
+OSCClientSender::put(const Raul::Path& path,
+ const Shared::Resource::Properties& properties)
{
- send("/ingen/new_port", "sisi", path.c_str(), index, type.c_str(), is_output, LO_ARGS_END);
+ cerr << "OSC CLIENT PUT " << path << endl;
}
@@ -307,47 +273,6 @@ OSCClientSender::new_plugin(const URI& uri,
}
-bool
-OSCClientSender::new_object(const Shared::GraphObject* object)
-{
-#if 0
- using namespace Shared;
-
- const Patch* patch = dynamic_cast<const Patch*>(object);
- if (patch) {
- new_patch(patch->path(), patch->internal_polyphony());
- return true;
- }
-
- const Node* node = dynamic_cast<const Node*>(object);
- if (node) {
- new_node(node->path(), node->plugin()->uri());
- return true;
- }
-
- const Port* port = dynamic_cast<const Port*>(object);
- if (port) {
- new_port(port->path(), port->type().uri(), port->index(), !port->is_input());
- return true;
- }
-#endif
-
- return false;
-}
-
-
-/** \page client_osc_namespace
- * <p> \b /ingen/new_patch - Notification of a new patch
- * \arg \b path (string) - Path of new patch
- * \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node) </p> \n \n
- */
-void
-OSCClientSender::new_patch(const Path& path, uint32_t poly)
-{
- send("/ingen/new_patch", "si", path.c_str(), poly, LO_ARGS_END);
-}
-
-
/** \page client_osc_namespace
* <p> \b /ingen/rename - Notification of an object's renaming
* \arg \b old-path (string) - Old path of object
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 404bdee7..b66ff59d 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -71,22 +71,12 @@ public:
void error(const std::string& msg);
- 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 new_patch(const Raul::Path& path,
- uint32_t poly);
-
- virtual void new_node(const Raul::Path& path,
- const Raul::URI& plugin_uri);
-
- virtual void new_port(const Raul::Path& path,
- const Raul::URI& type,
- uint32_t index,
- bool is_output);
+ virtual void put(const Raul::Path& path,
+ const Shared::Resource::Properties& properties);
virtual void clear_patch(const Raul::Path& path);
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp
index 8fa92803..37a8132a 100644
--- a/src/engine/OSCEngineReceiver.cpp
+++ b/src/engine/OSCEngineReceiver.cpp
@@ -94,7 +94,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/set_polyphonic", "isT", set_polyphonic_cb, this);
lo_server_add_method(_server, "/ingen/set_polyphonic", "isF", set_polyphonic_cb, this);
lo_server_add_method(_server, "/ingen/new_port", "issi", new_port_cb, this);
- lo_server_add_method(_server, "/ingen/new_node", "iss", new_node_by_uri_cb, this);
+ lo_server_add_method(_server, "/ingen/put", NULL, new_port_cb, this);
lo_server_add_method(_server, "/ingen/destroy", "is", destroy_cb, this);
lo_server_add_method(_server, "/ingen/rename", "iss", rename_cb, this);
lo_server_add_method(_server, "/ingen/connect", "iss", connect_cb, this);
@@ -366,23 +366,6 @@ OSCEngineReceiver::_engine_deactivate_cb(const char* path, const char* types, lo
/** \page engine_osc_namespace
- * <p> \b /ingen/new_patch - Creates a new, empty, toplevel patch.
- * \arg \b response-id (integer)
- * \arg \b patch-path (string) - Patch path (complete, ie /master/parent/new_patch)
- * \arg \b poly (integer) - Patch's (internal) polyphony </p> \n \n
- */
-int
-OSCEngineReceiver::_new_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* patch_path = &argv[1]->s;
- const int32_t poly = argv[2]->i;
-
- new_patch(patch_path, poly);
- return 0;
-}
-
-
-/** \page engine_osc_namespace
* <p> \b /ingen/rename - Rename an Object (only Nodes, for now)
* \arg \b response-id (integer)
* \arg \b old-path - Object's path
@@ -414,42 +397,6 @@ OSCEngineReceiver::_clear_patch_cb(const char* path, const char* types, lo_arg**
}
-// FIXME: add index
-/** \page engine_osc_namespace
- * <p> \b /ingen/new_port - Add a port into a given patch (load a plugin by URI)
- * \arg \b response-id (integer)
- * \arg \b path (string) - Full path of the new port (ie. /patch2/subpatch/newport)
- * \arg \b data-type (string) - Type of port (lv2:AudioPort, lv2:ControlPort, lv2ev:EventPort)
- * \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1) </p> \n \n
- */
-int
-OSCEngineReceiver::_new_port_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* port_path = &argv[1]->s;
- const char* data_type = &argv[2]->s;
- const int32_t direction = argv[3]->i;
-
- new_port(port_path, data_type, 0, (direction == 1));
- return 0;
-}
-
-/** \page engine_osc_namespace
- * <p> \b /ingen/new_node - Add a node into a given patch (load a plugin by URI)
- * \arg \b response-id (integer)
- * \arg \b node-path (string) - Full path of the new node (ie. /patch2/subpatch/newnode)
- * \arg \b plug-uri (string) - URI of the plugin to load \n \n
- */
-int
-OSCEngineReceiver::_new_node_by_uri_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* node_path = &argv[1]->s;
- const char* plug_uri = &argv[2]->s;
-
- new_node(node_path, plug_uri);
- return 0;
-}
-
-
/** \page engine_osc_namespace
* <p> \b /ingen/destroy - Removes (destroys) a Patch or a Node
* \arg \b response-id (integer)
diff --git a/src/engine/OSCEngineReceiver.hpp b/src/engine/OSCEngineReceiver.hpp
index 04fc357a..fada5a17 100644
--- a/src/engine/OSCEngineReceiver.hpp
+++ b/src/engine/OSCEngineReceiver.hpp
@@ -92,7 +92,7 @@ private:
LO_HANDLER(new_patch);
LO_HANDLER(rename);
LO_HANDLER(new_port);
- LO_HANDLER(new_node_by_uri);
+ LO_HANDLER(put);
LO_HANDLER(clear_patch);
LO_HANDLER(set_polyphony);
LO_HANDLER(set_polyphonic);
diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp
index 01fa3f3b..9bf70cbf 100644
--- a/src/engine/ObjectSender.cpp
+++ b/src/engine/ObjectSender.cpp
@@ -27,6 +27,7 @@
#include "AudioBuffer.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -35,9 +36,6 @@ using namespace Shared;
void
ObjectSender::send_object(ClientInterface* client, const GraphObjectImpl* object, bool recursive)
{
- if (client->new_object(object))
- return;
-
const PatchImpl* patch = dynamic_cast<const PatchImpl*>(object);
if (patch) {
send_patch(client, patch, recursive);
@@ -64,20 +62,16 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r
if (bundle)
client->transfer_begin();
- client->new_patch(patch->path(), patch->internal_polyphony());
- client->set_variable(patch->path(), "ingen:polyphonic", bool(patch->polyphonic()));
-
- // Send variable
- const GraphObjectImpl::Properties& data = patch->variables();
- for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j)
- client->set_variable(patch->path(), (*j).first, (*j).second);
-
- client->set_variable(patch->path(), "ingen:enabled", (bool)patch->enabled());
+ client->put(patch->path(), patch->properties());
if (recursive) {
+ // Send variables
+ const GraphObjectImpl::Properties& data = patch->variables();
+ for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j)
+ client->set_variable(patch->path(), (*j).first, (*j).second);
// Send nodes
- for (Raul::List<NodeImpl*>::const_iterator j = patch->nodes().begin();
+ for (List<NodeImpl*>::const_iterator j = patch->nodes().begin();
j != patch->nodes().end(); ++j) {
const NodeImpl* const node = (*j);
send_node(client, node, true, false);
@@ -119,18 +113,12 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu
if (bundle)
client->transfer_begin();
- client->new_node(node->path(), node->plugin()->uri());
- client->set_variable(node->path(), "ingen:polyphonic", bool(node->polyphonic()));
+ client->put(node->path(), node->variables());
// Send variables
- const GraphObjectImpl::Properties& data = node->variables();
- for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j)
- client->set_variable(node->path(), (*j).first, (*j).second);
-
- // Send properties
- const GraphObjectImpl::Properties& prop = node->properties();
+ const GraphObjectImpl::Properties& prop = node->variables();
for (GraphObjectImpl::Properties::const_iterator j = prop.begin(); j != prop.end(); ++j)
- client->set_property(node->path(), (*j).first, (*j).second);
+ client->set_variable(node->path(), (*j).first, (*j).second);
if (recursive) {
// Send ports
@@ -151,12 +139,13 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bund
if (bundle)
client->bundle_begin();
- client->new_port(port->path(), port->type().uri(), port->index(), port->is_output());
+ client->put(port->path(), port->properties());
+
PatchImpl* graph_parent = dynamic_cast<PatchImpl*>(port->parent_node());
if (graph_parent && graph_parent->internal_polyphony() > 1)
client->set_variable(port->path(), "ingen:polyphonic", bool(port->polyphonic()));
- // Send variable
+ // Send variables
const GraphObjectImpl::Properties& data = port->variables();
for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j)
client->set_variable(port->path(), (*j).first, (*j).second);
diff --git a/src/engine/OutputPort.cpp b/src/engine/OutputPort.cpp
index aa3007b0..020ea6bb 100644
--- a/src/engine/OutputPort.cpp
+++ b/src/engine/OutputPort.cpp
@@ -16,14 +16,17 @@
*/
#include <iostream>
-#include "OutputPort.hpp"
+#include "interface/Patch.hpp"
#include "Buffer.hpp"
+#include "NodeImpl.hpp"
+#include "OutputPort.hpp"
#include "ProcessContext.hpp"
using namespace std;
namespace Ingen {
+namespace Shared { class Patch; }
using namespace Shared;
OutputPort::OutputPort(NodeImpl* parent,
@@ -35,6 +38,9 @@ OutputPort::OutputPort(NodeImpl* parent,
size_t buffer_size)
: PortImpl(parent, name, index, poly, type, value, buffer_size)
{
+ if (!dynamic_cast<Patch*>(parent))
+ add_property("rdf:type", Raul::Atom(Raul::Atom::URI, "lv2:OutputPort"));
+
if (type == DataType::CONTROL)
_broadcast = true;
}
diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp
index 15a44355..c81e797a 100644
--- a/src/engine/PortImpl.cpp
+++ b/src/engine/PortImpl.cpp
@@ -28,19 +28,20 @@
#include "events/SendPortActivityEvent.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
using namespace Shared;
-PortImpl::PortImpl(NodeImpl* const node,
- const string& name,
- uint32_t index,
- uint32_t poly,
- DataType type,
- const Raul::Atom& value,
- size_t buffer_size)
+PortImpl::PortImpl(NodeImpl* const node,
+ const string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ const Atom& value,
+ size_t buffer_size)
: GraphObjectImpl(node, name, (type == DataType::AUDIO || type == DataType::CONTROL))
, _index(index)
, _poly(poly)
@@ -50,9 +51,9 @@ PortImpl::PortImpl(NodeImpl* const node,
, _fixed_buffers(false)
, _broadcast(false)
, _set_by_user(false)
- , _last_broadcasted_value(_value.type() == Raul::Atom::FLOAT ? _value.get_float() : 0.0f) // default?
+ , _last_broadcasted_value(_value.type() == Atom::FLOAT ? _value.get_float() : 0.0f) // default?
, _context(Context::AUDIO)
- , _buffers(new Raul::Array<Buffer*>(poly))
+ , _buffers(new Array<Buffer*>(poly))
, _prepared_buffers(NULL)
{
assert(node != NULL);
@@ -65,8 +66,16 @@ PortImpl::PortImpl(NodeImpl* const node,
else
_polyphonic = true;
- if (type == DataType::EVENT)
+ if (type == DataType::AUDIO)
+ add_property("rdf:type", Atom(Atom::URI, "lv2:AudioPort"));
+
+ if (type == DataType::CONTROL)
+ add_property("rdf:type", Atom(Atom::URI, "lv2:ControlPort"));
+
+ if (type == DataType::EVENT) {
+ add_property("rdf:type", Atom(Atom::URI, "lv2ev:EventPort"));
_broadcast = true; // send activity blips
+ }
assert(_buffers->size() > 0);
}
@@ -83,7 +92,7 @@ PortImpl::~PortImpl()
bool
-PortImpl::set_polyphonic(Raul::Maid& maid, bool p)
+PortImpl::set_polyphonic(Maid& maid, bool p)
{
if (_type == DataType::CONTROL || _type == DataType::AUDIO)
return GraphObjectImpl::set_polyphonic(maid, p);
@@ -100,7 +109,7 @@ PortImpl::prepare_poly(uint32_t poly)
/* FIXME: poly never goes down, harsh on memory.. */
if (poly > _poly) {
- _prepared_buffers = new Raul::Array<Buffer*>(poly, *_buffers);
+ _prepared_buffers = new Array<Buffer*>(poly, *_buffers);
for (uint32_t i = _poly; i < _prepared_buffers->size(); ++i)
_prepared_buffers->at(i) = Buffer::create(_type, _buffer_size);
}
@@ -110,7 +119,7 @@ PortImpl::prepare_poly(uint32_t poly)
bool
-PortImpl::apply_poly(Raul::Maid& maid, uint32_t poly)
+PortImpl::apply_poly(Maid& maid, uint32_t poly)
{
if (!_polyphonic || !_parent->polyphonic())
return true;
diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp
index e19261f7..a1192c03 100644
--- a/src/engine/QueuedEngineInterface.cpp
+++ b/src/engine/QueuedEngineInterface.cpp
@@ -23,6 +23,7 @@
#include "Engine.hpp"
#include "AudioDriver.hpp"
+using namespace std;
using namespace Raul;
namespace Ingen {
@@ -149,36 +150,36 @@ QueuedEngineInterface::bundle_end()
// Object commands
-bool
-QueuedEngineInterface::new_object(const GraphObject* object)
-{
- return false;
-}
-
-
-void
-QueuedEngineInterface::new_patch(const Path& path,
- uint32_t poly)
-{
- push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly));
-}
-
-
-// FIXME: use index
-void QueuedEngineInterface::new_port(const Path& path,
- const URI& type,
- uint32_t index,
- bool direction)
-{
- push_queued(new CreatePortEvent(_engine, _responder, now(), path, type, direction, this));
-}
-
void
-QueuedEngineInterface::new_node(const Path& path,
- const URI& plugin_uri)
-{
- push_queued(new CreateNodeEvent(_engine, _responder, now(), path, plugin_uri, true));
+QueuedEngineInterface::put(const Path& path,
+ const Resource::Properties& properties)
+{
+ typedef Resource::Properties::const_iterator iterator;
+ cerr << "ENGINE PUT " << path << " {" << endl;
+ for (iterator i = properties.begin(); i != properties.end(); ++i)
+ cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl;
+ cerr << "}" << endl;
+
+ bool is_patch = false, is_node = false, is_port = false, is_output = false;
+ DataType data_type(DataType::UNKNOWN);
+ ResourceImpl::type(properties, is_patch, is_node, is_port, is_output, data_type);
+
+ if (is_patch) {
+ uint32_t poly = 1;
+ iterator p = properties.find("ingen:polyphony");
+ if (p != properties.end() && p->second.is_valid() && p->second.type() == Atom::INT)
+ poly = p->second.get_int32();
+ push_queued(new CreatePatchEvent(
+ _engine, _responder, now(), path, poly, properties));
+ } else if (is_node) {
+ const iterator p = properties.find("rdf:instanceOf");
+ push_queued(new CreateNodeEvent(
+ _engine, _responder, now(), path, p->second.get_uri(), true, properties));
+ } else if (is_port) {
+ push_queued(new CreatePortEvent(
+ _engine, _responder, now(), path, data_type.uri(), is_output, this, properties));
+ }
}
diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp
index 1263c225..f12a1b23 100644
--- a/src/engine/QueuedEngineInterface.hpp
+++ b/src/engine/QueuedEngineInterface.hpp
@@ -22,12 +22,13 @@
#include <string>
#include <memory>
#include "raul/SharedPtr.hpp"
-#include "types.hpp"
-#include "tuning.hpp"
-#include "interface/EngineInterface.hpp"
#include "interface/ClientInterface.hpp"
-#include "Responder.hpp"
+#include "interface/EngineInterface.hpp"
+#include "interface/Resource.hpp"
#include "QueuedEventSource.hpp"
+#include "Responder.hpp"
+#include "tuning.hpp"
+#include "types.hpp"
namespace Ingen {
@@ -70,18 +71,8 @@ public:
// CommonInterface object commands
- virtual bool new_object(const Shared::GraphObject* object);
-
- virtual void new_patch(const Raul::Path& path,
- uint32_t poly);
-
- virtual void new_node(const Raul::Path& path,
- const Raul::URI& plugin_uri);
-
- virtual void new_port(const Raul::Path& path,
- const Raul::URI& type,
- uint32_t index,
- bool is_output);
+ virtual void put(const Raul::Path& path,
+ const Shared::Resource::Properties& properties);
virtual void rename(const Raul::Path& old_path,
const Raul::Path& new_path);
diff --git a/src/engine/events/CreateNodeEvent.cpp b/src/engine/events/CreateNodeEvent.cpp
index fea858f1..6f3ed834 100644
--- a/src/engine/events/CreateNodeEvent.cpp
+++ b/src/engine/events/CreateNodeEvent.cpp
@@ -38,8 +38,16 @@ using namespace Raul;
namespace Ingen {
-
-CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path, const URI& plugin_uri, bool polyphonic)
+using namespace Shared;
+
+CreateNodeEvent::CreateNodeEvent(
+ Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Path& path,
+ const URI& plugin_uri,
+ bool polyphonic,
+ const Resource::Properties& properties)
: QueuedEvent(engine, responder, timestamp)
, _path(path)
, _plugin_uri(plugin_uri)
@@ -48,6 +56,7 @@ CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder,
, _node(NULL)
, _compiled_patch(NULL)
, _node_already_exists(false)
+ , _properties(properties)
{
string uri = _plugin_uri.str();
if (uri.substr(0, 3) == "om:") {
@@ -80,6 +89,7 @@ CreateNodeEvent::pre_process()
if (_patch && plugin) {
_node = plugin->instantiate(_path.name(), _polyphonic, _patch, _engine);
+ _node->variables().insert(_properties.begin(), _properties.end());
if (_node != NULL) {
_node->activate();
diff --git a/src/engine/events/CreateNodeEvent.hpp b/src/engine/events/CreateNodeEvent.hpp
index 7065cb84..b8dbf082 100644
--- a/src/engine/events/CreateNodeEvent.hpp
+++ b/src/engine/events/CreateNodeEvent.hpp
@@ -20,6 +20,7 @@
#include <string>
#include "QueuedEvent.hpp"
+#include "interface/Resource.hpp"
namespace Ingen {
@@ -35,12 +36,14 @@ class CompiledPatch;
class CreateNodeEvent : public QueuedEvent
{
public:
- CreateNodeEvent(Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- const Raul::Path& node_path,
- const Raul::URI& plugin_uri,
- bool poly);
+ CreateNodeEvent(
+ Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Raul::Path& node_path,
+ const Raul::URI& plugin_uri,
+ bool poly,
+ const Shared::Resource::Properties& properties);
void pre_process();
void execute(ProcessContext& context);
@@ -57,6 +60,8 @@ private:
NodeImpl* _node;
CompiledPatch* _compiled_patch; ///< Patch's new process order
bool _node_already_exists;
+
+ Shared::Resource::Properties _properties;
};
diff --git a/src/engine/events/CreatePatchEvent.cpp b/src/engine/events/CreatePatchEvent.cpp
index 574d909b..f4a60760 100644
--- a/src/engine/events/CreatePatchEvent.cpp
+++ b/src/engine/events/CreatePatchEvent.cpp
@@ -32,8 +32,16 @@ using namespace Raul;
namespace Ingen {
+using namespace Shared;
-CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, int poly)
+
+CreatePatchEvent::CreatePatchEvent(
+ Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ int poly,
+ const Resource::Properties& properties)
: QueuedEvent(engine, responder, timestamp)
, _path(path)
, _patch(NULL)
@@ -41,6 +49,7 @@ CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responde
, _compiled_patch(NULL)
, _poly(poly)
, _error(NO_ERROR)
+ , _properties(properties)
{
}
@@ -74,6 +83,7 @@ CreatePatchEvent::pre_process()
poly = _poly;
_patch = new PatchImpl(_engine, path.name(), poly, _parent, _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size(), _poly);
+ _patch->properties().insert(_properties.begin(), _properties.end());
if (_parent != NULL) {
_parent->add_node(new PatchImpl::Nodes::Node(_patch));
diff --git a/src/engine/events/CreatePatchEvent.hpp b/src/engine/events/CreatePatchEvent.hpp
index 796306f8..44b47d8c 100644
--- a/src/engine/events/CreatePatchEvent.hpp
+++ b/src/engine/events/CreatePatchEvent.hpp
@@ -19,6 +19,7 @@
#define CREATEPATCHEVENT_H
#include "QueuedEvent.hpp"
+#include "interface/Resource.hpp"
namespace Ingen {
@@ -33,7 +34,13 @@ class CompiledPatch;
class CreatePatchEvent : public QueuedEvent
{
public:
- CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, int poly);
+ CreatePatchEvent(
+ Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ int poly,
+ const Shared::Resource::Properties& properties);
void pre_process();
void execute(ProcessContext& context);
@@ -48,6 +55,8 @@ private:
CompiledPatch* _compiled_patch;
int _poly;
ErrorType _error;
+
+ Shared::Resource::Properties _properties;
};
diff --git a/src/engine/events/CreatePortEvent.cpp b/src/engine/events/CreatePortEvent.cpp
index 69ef7364..38c3587c 100644
--- a/src/engine/events/CreatePortEvent.cpp
+++ b/src/engine/events/CreatePortEvent.cpp
@@ -41,13 +41,15 @@ namespace Ingen {
using namespace Shared;
-CreatePortEvent::CreatePortEvent(Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- const Raul::Path& path,
- const Raul::URI& type,
- bool is_output,
- QueuedEventSource* source)
+CreatePortEvent::CreatePortEvent(
+ Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ const Raul::URI& type,
+ bool is_output,
+ QueuedEventSource* source,
+ const Resource::Properties& properties)
: QueuedEvent(engine, responder, timestamp, true, source)
, _error(NO_ERROR)
, _path(path)
@@ -57,6 +59,7 @@ CreatePortEvent::CreatePortEvent(Engine& engine,
, _patch(NULL)
, _patch_port(NULL)
, _driver_port(NULL)
+ , _properties(properties)
{
/* This is blocking because of the two different sets of Patch ports, the array used in the
* audio thread (inherited from NodeBase), and the arrays used in the pre processor thread.
@@ -93,6 +96,7 @@ CreatePortEvent::pre_process()
const uint32_t old_num_ports = _patch->num_ports();
_patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output);
+ _patch_port->properties().insert(_properties.begin(), _properties.end());
if (_patch_port) {
diff --git a/src/engine/events/CreatePortEvent.hpp b/src/engine/events/CreatePortEvent.hpp
index 4304e362..ab65eabd 100644
--- a/src/engine/events/CreatePortEvent.hpp
+++ b/src/engine/events/CreatePortEvent.hpp
@@ -22,8 +22,7 @@
#include "raul/Path.hpp"
#include "raul/Array.hpp"
#include "interface/DataType.hpp"
-
-template <typename T> class Array;
+#include "interface/Resource.hpp"
namespace Ingen {
@@ -39,7 +38,15 @@ class DriverPort;
class CreatePortEvent : public QueuedEvent
{
public:
- CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, const Raul::URI& type, bool is_output, QueuedEventSource* source);
+ CreatePortEvent(
+ Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ const Raul::URI& type,
+ bool is_output,
+ QueuedEventSource* source,
+ const Shared::Resource::Properties& properties);
void pre_process();
void execute(ProcessContext& context);
@@ -63,6 +70,8 @@ private:
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports array for Patch
DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port
bool _succeeded;
+
+ Shared::Resource::Properties _properties;
};