summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/interface/EngineInterface.h1
-rw-r--r--src/common/util/CountedPtr.h5
-rw-r--r--src/libs/client/ConnectionModel.h23
-rw-r--r--src/libs/client/Makefile.am2
-rw-r--r--src/libs/client/ModelClientInterface.cpp136
-rw-r--r--src/libs/client/ModelClientInterface.h88
-rw-r--r--src/libs/client/ModelEngineInterface.cpp25
-rw-r--r--src/libs/client/ModelEngineInterface.h9
-rw-r--r--src/libs/client/NodeModel.cpp22
-rw-r--r--src/libs/client/NodeModel.h22
-rw-r--r--src/libs/client/OSCClientReceiver.cpp5
-rw-r--r--src/libs/client/OSCClientReceiver.h7
-rw-r--r--src/libs/client/OSCEngineSender.cpp4
-rw-r--r--src/libs/client/OSCEngineSender.h1
-rw-r--r--src/libs/client/ObjectModel.h21
-rw-r--r--src/libs/client/PatchLibrarian.cpp46
-rw-r--r--src/libs/client/PatchLibrarian.h2
-rw-r--r--src/libs/client/PatchModel.cpp48
-rw-r--r--src/libs/client/PatchModel.h67
-rw-r--r--src/libs/client/PortModel.h60
-rw-r--r--src/libs/client/PresetModel.h2
-rw-r--r--src/libs/client/Store.cpp66
-rw-r--r--src/libs/client/Store.h11
-rw-r--r--src/libs/engine/NodeFactory.cpp12
-rw-r--r--src/libs/engine/NodeFactory.h4
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp12
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp13
-rw-r--r--src/libs/engine/QueuedEngineInterface.h1
-rw-r--r--src/libs/engine/events/AddNodeEvent.cpp25
-rw-r--r--src/libs/engine/events/AddNodeEvent.h13
-rw-r--r--src/progs/demolition/DemolitionClientInterface.h1
-rw-r--r--src/progs/ingenuity/ControlGroups.cpp8
-rw-r--r--src/progs/ingenuity/LoadPatchWindow.cpp9
-rw-r--r--src/progs/ingenuity/LoadPluginWindow.cpp7
-rw-r--r--src/progs/ingenuity/LoadSubpatchWindow.cpp8
-rw-r--r--src/progs/ingenuity/NewSubpatchWindow.cpp3
-rw-r--r--src/progs/ingenuity/OmFlowCanvas.cpp6
-rw-r--r--src/progs/ingenuity/PatchPropertiesWindow.cpp6
-rw-r--r--src/progs/ingenuity/PatchWindow.cpp2
-rw-r--r--src/progs/patch_loader/patch_loader.cpp7
40 files changed, 330 insertions, 480 deletions
diff --git a/src/common/interface/EngineInterface.h b/src/common/interface/EngineInterface.h
index c86340c5..b8dcb6d8 100644
--- a/src/common/interface/EngineInterface.h
+++ b/src/common/interface/EngineInterface.h
@@ -64,7 +64,6 @@ public:
bool direction) = 0;
virtual void create_node(const string& path,
- const string& plugin_type,
const string& plugin_uri,
bool polyphonic) = 0;
diff --git a/src/common/util/CountedPtr.h b/src/common/util/CountedPtr.h
index d1a48a58..0f00be87 100644
--- a/src/common/util/CountedPtr.h
+++ b/src/common/util/CountedPtr.h
@@ -21,8 +21,7 @@
#include <cassert>
#include <cstddef>
-#ifdef DEBUG
-#define BOOST_SP_ENABLE_DEBUG_HOOKS 1
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
#include <iostream>
#include <list>
#include <algorithm>
@@ -47,7 +46,7 @@ namespace boost {
}
}
-#endif // DEBUG
+#endif // BOOST_SP_ENABLE_DEBUG_HOOKS
#include <boost/shared_ptr.hpp>
diff --git a/src/libs/client/ConnectionModel.h b/src/libs/client/ConnectionModel.h
index fe244649..4c0d18f8 100644
--- a/src/libs/client/ConnectionModel.h
+++ b/src/libs/client/ConnectionModel.h
@@ -14,7 +14,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#ifndef CONNECTIONMODEL_H
#define CONNECTIONMODEL_H
@@ -28,6 +27,8 @@ using std::string;
namespace Ingen {
namespace Client {
+class Store;
+
/** Class to represent a port->port connection in the engine.
*
@@ -42,23 +43,25 @@ namespace Client {
class ConnectionModel
{
public:
- ConnectionModel(const Path& src_port, const Path& dst_port);
- ConnectionModel(CountedPtr<PortModel> src, CountedPtr<PortModel> dst);
-
CountedPtr<PortModel> src_port() const { return _src_port; }
CountedPtr<PortModel> dst_port() const { return _dst_port; }
- void set_src_port(CountedPtr<PortModel> port) { _src_port = port; _src_port_path = port->path(); }
- void set_dst_port(CountedPtr<PortModel> port) { _dst_port = port; _dst_port_path = port->path(); }
-
- void src_port_path(const string& s) { _src_port_path = s; }
- void dst_port_path(const string& s) { _dst_port_path = s; }
-
const Path& src_port_path() const;
const Path& dst_port_path() const;
const Path patch_path() const;
private:
+ friend class Store;
+
+ ConnectionModel(const Path& src_port, const Path& dst_port);
+ ConnectionModel(CountedPtr<PortModel> src, CountedPtr<PortModel> dst);
+
+ void set_src_port(CountedPtr<PortModel> port) { _src_port = port; _src_port_path = port->path(); }
+ void set_dst_port(CountedPtr<PortModel> port) { _dst_port = port; _dst_port_path = port->path(); }
+
+ void src_port_path(const string& s) { _src_port_path = s; }
+ void dst_port_path(const string& s) { _dst_port_path = s; }
+
Path _src_port_path; ///< Only used if _src_port == NULL
Path _dst_port_path; ///< Only used if _dst_port == NULL
CountedPtr<PortModel> _src_port;
diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am
index 23723f11..42f1fddc 100644
--- a/src/libs/client/Makefile.am
+++ b/src/libs/client/Makefile.am
@@ -18,8 +18,6 @@ libomclient_la_SOURCES = \
ThreadedSigClientInterface.cpp \
ModelEngineInterface.h \
ModelEngineInterface.cpp \
- ModelClientInterface.h \
- ModelClientInterface.cpp \
PresetModel.h \
ControlModel.h \
ObjectController.h \
diff --git a/src/libs/client/ModelClientInterface.cpp b/src/libs/client/ModelClientInterface.cpp
deleted file mode 100644
index d29395e7..00000000
--- a/src/libs/client/ModelClientInterface.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard.
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "ModelClientInterface.h"
-#include "PatchModel.h"
-#include "ConnectionModel.h"
-#include "PresetModel.h"
-#include "NodeModel.h"
-#include "PluginModel.h"
-
-namespace Ingen {
-namespace Client {
-
-
-void
-ModelClientInterface::new_plugin_model(CountedPtr<PluginModel> pi)
-{
-}
-
-
-void
-ModelClientInterface::new_patch_model(CountedPtr<PatchModel> pm)
-{
-}
-
-
-void
-ModelClientInterface::new_node_model(CountedPtr<NodeModel> nm)
-{
-}
-
-
-void
-ModelClientInterface::new_port_model(CountedPtr<PortModel> port_info)
-{
-}
-
-
-void
-ModelClientInterface::connection_model(CountedPtr<ConnectionModel> cm)
-{
-}
-
-
-
-/* Implementations of ClientInterface functions to drive
- * the above functions:
- */
-
-
-
-void
-ModelClientInterface::new_plugin(string type,
- string uri,
- string name)
-{
- CountedPtr<PluginModel> plugin(new PluginModel(type, uri));
- plugin->name(name);
- new_plugin_model(plugin);
-}
-
-
-
-void
-ModelClientInterface::new_patch(string path, uint32_t poly)
-{
- CountedPtr<PatchModel> pm(new PatchModel(path, poly));
- //PluginModel* pi = new PluginModel(PluginModel::Patch);
- //pm->plugin(pi);
- new_patch_model(pm);
-}
-
-
-
-void
-ModelClientInterface::new_node(string plugin_type,
- string plugin_uri,
- string node_path,
- bool is_polyphonic,
- uint32_t num_ports)
-{
- cerr << "FIXME: NEW NODE\n";
-
- CountedPtr<PluginModel> plugin(new PluginModel(plugin_type, plugin_uri));
-
- CountedPtr<NodeModel> nm(new NodeModel(plugin, node_path, is_polyphonic));
-
- new_node_model(nm);
-}
-
-
-
-void
-ModelClientInterface::new_port(string path,
- string type,
- bool is_output)
-{
- PortModel::Type ptype = PortModel::CONTROL;
- if (type != "AUDIO") ptype = PortModel::AUDIO;
- else if (type != "CONTROL") ptype = PortModel::CONTROL;
- else if (type != "MIDI") ptype = PortModel::MIDI;
- else cerr << "[ModelClientInterface] WARNING: Unknown port type received (" << type << ")" << endl;
-
- PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
-
- CountedPtr<PortModel> port_model(new PortModel(path, ptype, pdir));
- new_port_model(port_model);
-}
-
-
-
-void
-ModelClientInterface::connection(string src_port_path,
- string dst_port_path)
-{
- connection_model(CountedPtr<ConnectionModel>(new ConnectionModel(src_port_path, dst_port_path)));
-}
-
-
-
-
-} // namespace Client
-} // namespace Ingen
diff --git a/src/libs/client/ModelClientInterface.h b/src/libs/client/ModelClientInterface.h
deleted file mode 100644
index 9b467fa6..00000000
--- a/src/libs/client/ModelClientInterface.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard.
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef MODELCLIENTINTERFACE_H
-#define MODELCLIENTINTERFACE_H
-
-#include <string>
-#include <memory>
-using std::string; using std::auto_ptr;
-#include "interface/ClientInterface.h"
-#include "util/CountedPtr.h"
-
-namespace Ingen {
-namespace Client {
-
-class PatchModel;
-class NodeModel;
-class ConnectionModel;
-class PortModel;
-class PluginModel;
-
-
-/** A client interface that creates Model objects to represent the engine's state.
- *
- * This calls it's own methods with the models as parameters; clients can inherit
- * this and implement a class with a similar interface to ClientInterface except
- * with model classes passed where appropriate instead of primitives.
- *
- * \ingroup IngenClient
- */
-class ModelClientInterface : virtual public Ingen::Shared::ClientInterface
-{
-public:
- ModelClientInterface(Ingen::Shared::ClientInterface& extend)
- : Ingen::Shared::ClientInterface(extend)
- {}
-
- virtual ~ModelClientInterface() {}
-
- virtual void new_plugin_model(CountedPtr<PluginModel> pi);
- virtual void new_patch_model(CountedPtr<PatchModel> pm);
- virtual void new_node_model(CountedPtr<NodeModel> nm);
- virtual void new_port_model(CountedPtr<PortModel> port_info);
- virtual void connection_model(CountedPtr<ConnectionModel> cm);
-
- // ClientInterface functions to drive the above:
-
- virtual void new_plugin(string type,
- string uri,
- string name);
-
- virtual void new_patch(string path, uint32_t poly);
-
- virtual void new_node(string plugin_type,
- string plugin_uri,
- string node_path,
- bool is_polyphonic,
- uint32_t num_ports);
-
- virtual void new_port(string path,
- string data_type,
- bool is_output);
-
- virtual void connection(string src_port_path,
- string dst_port_path);
-
-protected:
- ModelClientInterface() {}
-};
-
-
-} // namespace Client
-} // namespace Ingen
-
-#endif // MODELCLIENTINTERFACE_H
diff --git a/src/libs/client/ModelEngineInterface.cpp b/src/libs/client/ModelEngineInterface.cpp
index 7cc2ae22..3add8854 100644
--- a/src/libs/client/ModelEngineInterface.cpp
+++ b/src/libs/client/ModelEngineInterface.cpp
@@ -25,17 +25,19 @@ namespace Client {
/** Load a node.
*/
void
-ModelEngineInterface::create_node_from_model(const NodeModel* nm)
+ModelEngineInterface::create_node_with_data(const string& plugin_uri,
+ const Path& path,
+ bool is_polyphonic,
+ const MetadataMap& initial_data)
{
// Load by URI
- if (nm->plugin()->uri().length() > 0) {
- create_node(nm->path().c_str(),
- nm->plugin()->type_string(),
- nm->plugin()->uri().c_str(),
- nm->polyphonic());
+ if (plugin_uri.length() > 0) {
+ create_node(path, plugin_uri, is_polyphonic);
// Load by libname, label
} else {
+ cerr << "FIXME: non-uri" << endl;
+ #if 0
//assert(nm->plugin()->lib_name().length() > 0);
assert(nm->plugin()->plug_label().length() > 0);
@@ -44,9 +46,10 @@ ModelEngineInterface::create_node_from_model(const NodeModel* nm)
nm->plugin()->lib_name().c_str(),
nm->plugin()->plug_label().c_str(),
nm->polyphonic());
+ #endif
}
- set_all_metadata(nm);
+ set_metadata_map(path, initial_data);
}
@@ -56,17 +59,17 @@ void
ModelEngineInterface::create_patch_from_model(const PatchModel* pm)
{
create_patch(pm->path().c_str(), pm->poly());
- set_all_metadata(pm);
+ set_metadata_map(pm->path(), pm->metadata());
}
/** Set all pieces of metadata in a model.
*/
void
-ModelEngineInterface::set_all_metadata(const ObjectModel* m)
+ModelEngineInterface::set_metadata_map(const Path& subject, const MetadataMap& data)
{
- for (MetadataMap::const_iterator i = m->metadata().begin(); i != m->metadata().end(); ++i)
- set_metadata(m->path(), i->first, i->second);
+ for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i)
+ set_metadata(subject, i->first, i->second);
}
diff --git a/src/libs/client/ModelEngineInterface.h b/src/libs/client/ModelEngineInterface.h
index 29d82d8d..7bc65d1a 100644
--- a/src/libs/client/ModelEngineInterface.h
+++ b/src/libs/client/ModelEngineInterface.h
@@ -20,6 +20,7 @@
#include <string>
#include <lo/lo.h>
#include "interface/EngineInterface.h"
+#include "ObjectModel.h"
using std::string;
class Path;
@@ -44,9 +45,13 @@ public:
virtual ~ModelEngineInterface() {}
virtual void create_patch_from_model(const PatchModel* pm);
- virtual void create_node_from_model(const NodeModel* nm);
- virtual void set_all_metadata(const ObjectModel* nm);
+ virtual void create_node_with_data(const string& plugin_uri,
+ const Path& path,
+ bool is_polyphonicc,
+ const MetadataMap& initial_data);
+
+ virtual void set_metadata_map(const Path& subject, const MetadataMap& data);
virtual void set_preset(const Path& patch_path, const PresetModel* pm);
protected:
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index 55f70130..cb46bafc 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -53,7 +53,7 @@ NodeModel::remove_port(CountedPtr<PortModel> port)
void
-NodeModel::remove_port(const string& port_path)
+NodeModel::remove_port(const Path& port_path)
{
for (PortModelList::iterator i = m_ports.begin(); i != m_ports.end(); ++i) {
if ((*i)->path() == port_path) {
@@ -118,22 +118,10 @@ NodeModel::add_port(CountedPtr<PortModel> pm)
assert(pm->path().is_child_of(_path));
assert(pm->parent().get() == this);
- PortModelList::iterator existing = m_ports.end();
- for (PortModelList::iterator i = m_ports.begin(); i != m_ports.end(); ++i) {
- if ((*i)->path() == pm->path()) {
- existing = i;
- break;
- }
- }
-
- if (existing != m_ports.end()) {
- cerr << "Warning: port clash, assimilating old port " << _path << endl;
- pm->assimilate(*existing);
- *existing = pm;
- } else {
- m_ports.push_back(pm);
- new_port_sig.emit(pm);
- }
+ PortModelList::iterator existing = find(m_ports.begin(), m_ports.end(), pm);
+
+ // Store should have handled this by merging the two
+ assert(existing == m_ports.end());
}
diff --git a/src/libs/client/NodeModel.h b/src/libs/client/NodeModel.h
index f9c87f6e..2bce6656 100644
--- a/src/libs/client/NodeModel.h
+++ b/src/libs/client/NodeModel.h
@@ -35,6 +35,7 @@ namespace Ingen {
namespace Client {
class PluginModel;
+class Store;
/** Node model class, used by the client to store engine's state.
@@ -44,18 +45,16 @@ class PluginModel;
class NodeModel : public ObjectModel
{
public:
- NodeModel(const string& plugin_uri, const Path& path, bool polyphonic);
- NodeModel(CountedPtr<PluginModel> plugin, const Path& path, bool polyphonic);
virtual ~NodeModel();
CountedPtr<PortModel> get_port(const string& port_name) const;
const map<int, map<int, string> >& get_programs() const { return m_banks; }
- const string& plugin_uri() const { return m_plugin_uri; }
- CountedPtr<PluginModel> plugin() const { return m_plugin; }
- int num_ports() const { return m_ports.size(); }
- const PortModelList& ports() const { return m_ports; }
- virtual bool polyphonic() const { return m_polyphonic; }
+ const string& plugin_uri() const { return m_plugin_uri; }
+ CountedPtr<PluginModel> plugin() const { return m_plugin; }
+ int num_ports() const { return m_ports.size(); }
+ const PortModelList& ports() const { return m_ports; }
+ virtual bool polyphonic() const { return m_polyphonic; }
// Signals
sigc::signal<void, CountedPtr<PortModel> > new_port_sig;
@@ -63,16 +62,19 @@ public:
protected:
friend class Store;
+
+ NodeModel(const string& plugin_uri, const Path& path, bool polyphonic);
+ NodeModel(CountedPtr<PluginModel> plugin, const Path& path, bool polyphonic);
+
NodeModel(const Path& path);
void add_child(CountedPtr<ObjectModel> c);
void remove_child(CountedPtr<ObjectModel> c);
void add_port(CountedPtr<PortModel> pm);
void remove_port(CountedPtr<PortModel> pm);
- void remove_port(const string& port_path);
+ void remove_port(const Path& port_path);
void add_program(int bank, int program, const string& name);
void remove_program(int bank, int program);
-
//void plugin(CountedPtr<PluginModel> p) { m_plugin = p; }
virtual void clear();
@@ -86,8 +88,6 @@ protected:
map<int, map<int, string> > m_banks; ///< DSSI banks
private:
- friend class PatchLibrarian; // FIXME: remove
-
// Prevent copies (undefined)
NodeModel(const NodeModel& copy);
NodeModel& operator=(const NodeModel& copy);
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index 4c715c76..e5a2ccc3 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -26,9 +26,6 @@ namespace Ingen {
namespace Client {
-/** Construct a OSCClientReceiver with a user-provided ModelClientInterface object for notification
- * of engine events.
- */
OSCClientReceiver::OSCClientReceiver(int listen_port)
: _listen_port(listen_port),
_st(NULL)//,
@@ -378,8 +375,6 @@ OSCClientReceiver::m_response_cb(const char* path, const char* types, lo_arg** a
int
OSCClientReceiver::m_num_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- /** Not worth it implementing a ModelClientInterface callback for this (?)
- * Or I'm just lazy. FIXME? */
num_plugins(argv[0]->i);
return 0;
diff --git a/src/libs/client/OSCClientReceiver.h b/src/libs/client/OSCClientReceiver.h
index 2d957a6a..287f5e45 100644
--- a/src/libs/client/OSCClientReceiver.h
+++ b/src/libs/client/OSCClientReceiver.h
@@ -85,13 +85,6 @@ private:
int _listen_port;
lo_server_thread _st;
- // Used for receiving nodes - multiple messages are received before
- // sending an event to the client (via ModelClientInterface)
- //bool _receiving_node;
- //NodeModel* _receiving_node_model;
- //int32_t _receiving_node_num_ports;
- //int32_t _num_received_ports;
-
LO_HANDLER(error);
LO_HANDLER(response);
LO_HANDLER(num_plugins);
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index 447fa934..7bc67aa0 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -188,15 +188,13 @@ OSCEngineSender::create_port(const string& path,
void
OSCEngineSender::create_node(const string& path,
- const string& plugin_type,
const string& plugin_uri,
bool polyphonic)
{
assert(_engine_addr);
- lo_send(_engine_addr, "/om/synth/create_node", "isssi",
+ lo_send(_engine_addr, "/om/synth/create_node", "issi",
next_id(),
path.c_str(),
- plugin_type.c_str(),
plugin_uri.c_str(),
(polyphonic ? 1 : 0));
}
diff --git a/src/libs/client/OSCEngineSender.h b/src/libs/client/OSCEngineSender.h
index f514097d..1a4fa0e5 100644
--- a/src/libs/client/OSCEngineSender.h
+++ b/src/libs/client/OSCEngineSender.h
@@ -79,7 +79,6 @@ public:
bool is_output);
void create_node(const string& path,
- const string& plugin_type,
const string& plugin_uri,
bool polyphonic);
diff --git a/src/libs/client/ObjectModel.h b/src/libs/client/ObjectModel.h
index 79d551f5..a3cc745c 100644
--- a/src/libs/client/ObjectModel.h
+++ b/src/libs/client/ObjectModel.h
@@ -50,35 +50,36 @@ typedef map<string, Atom> MetadataMap;
class ObjectModel
{
public:
- ObjectModel(const Path& path);
-
virtual ~ObjectModel();
const Atom& get_metadata(const string& key) const;
- void add_metadata(const MetadataMap& data);
const MetadataMap& metadata() const { return _metadata; }
inline const Path& path() const { return _path; }
CountedPtr<ObjectModel> parent() const { return _parent; }
- void assimilate(CountedPtr<ObjectModel> model);
-
// Signals
sigc::signal<void, const string&, const Atom&> metadata_update_sig;
sigc::signal<void> destroyed_sig;
-
- // FIXME: make private
- void set_metadata(const string& key, const Atom& value)
- { _metadata[key] = value; metadata_update_sig.emit(key, value); }
-
protected:
friend class Store;
friend class PatchLibrarian; // FIXME: remove
+
+ ObjectModel(const Path& path);
+
virtual void set_path(const Path& p) { _path = p; }
virtual void set_parent(CountedPtr<ObjectModel> p) { _parent = p; }
virtual void add_child(CountedPtr<ObjectModel> c) = 0;
virtual void remove_child(CountedPtr<ObjectModel> c) = 0;
+
+ void add_metadata(const MetadataMap& data);
+
+ void assimilate(CountedPtr<ObjectModel> model);
+
+ void set_metadata(const string& key, const Atom& value)
+ { _metadata[key] = value; metadata_update_sig.emit(key, value); }
+
Path _path;
CountedPtr<ObjectModel> _parent;
diff --git a/src/libs/client/PatchLibrarian.cpp b/src/libs/client/PatchLibrarian.cpp
index 4db47b5b..9fc70ee7 100644
--- a/src/libs/client/PatchLibrarian.cpp
+++ b/src/libs/client/PatchLibrarian.cpp
@@ -21,7 +21,6 @@
#include <algorithm>
#include "PatchModel.h"
#include "NodeModel.h"
-#include "ModelClientInterface.h"
#include "ConnectionModel.h"
#include "PortModel.h"
#include "PresetModel.h"
@@ -126,8 +125,9 @@ PatchLibrarian::save_patch(CountedPtr<PatchModel> patch_model, const string& fil
cout << "Saving patch " << patch_model->path() << " to " << filename << endl;
- patch_model->filename(filename);
-
+ if (patch_model->filename() != filename)
+ cerr << "Warning: Saving patch to file other than filename stored in model." << endl;
+
string dir = filename.substr(0, filename.find_last_of("/"));
NodeModel* nm = NULL;
@@ -196,7 +196,8 @@ PatchLibrarian::save_patch(CountedPtr<PatchModel> patch_model, const string& fil
// No path
if (spm->filename() == "") {
ref_filename = spm->path().name() + ".om";
- spm->filename(dir +"/"+ ref_filename);
+ cerr << "FIXME: subpatch filename" << endl;
+ //spm->filename(dir +"/"+ ref_filename);
// Absolute path
} else if (spm->filename().substr(0, 1) == "/") {
// Attempt to make it a relative path, if it's undernath this patch's dir
@@ -204,7 +205,8 @@ PatchLibrarian::save_patch(CountedPtr<PatchModel> patch_model, const string& fil
ref_filename = spm->filename().substr(dir.length()+1);
} else { // FIXME: not good
ref_filename = spm->filename().substr(spm->filename().find_last_of("/")+1);
- spm->filename(dir +"/"+ ref_filename);
+ cerr << "FIXME: subpatch filename (2)" << endl;
+ //spm->filename(dir +"/"+ ref_filename);
}
} else {
ref_filename = spm->filename();
@@ -423,7 +425,8 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing)
cur = cur->xmlChildrenNode;
string path;
- pm->filename(filename);
+ cerr << "FIXME: patch filename" << endl;
+ //pm->filename(filename);
// Load Patch attributes
while (cur != NULL) {
@@ -439,12 +442,14 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing)
}
assert(path.find("//") == string::npos);
assert(path.length() > 0);
- pm->set_path(path);
+ cerr << "FIXME: patch path (2)" << endl;
+ //pm->set_path(path);
}
} else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) {
if (load_poly) {
poly = atoi((char*)key);
- pm->poly(poly);
+ cerr << "FIXME: patch poly" << endl;
+ //pm->poly(poly);
}
} else if (xmlStrcmp(cur->name, (const xmlChar*)"connection")
&& xmlStrcmp(cur->name, (const xmlChar*)"node")
@@ -502,9 +507,10 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing)
if ((!xmlStrcmp(cur->name, (const xmlChar*)"node"))) {
CountedPtr<NodeModel> nm = parse_node(pm, doc, cur);
if (nm) {
- _engine->create_node_from_model(nm.get());
- _engine->set_all_metadata(nm.get());
- cerr << "FIXME: max min\n";
+ cerr << "FIXME: load node\n";
+ //_engine->create_node_from_model(nm.get());
+ //_engine->set_all_metadata(nm.get());
+
/*
//for (PortModelList::const_iterator j = nm->ports().begin(); j != nm->ports().end(); ++j) {
// FIXME: ew
@@ -557,7 +563,7 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing)
xmlFreeDoc(doc);
xmlCleanupParser();
- _engine->set_all_metadata(pm.get());
+ _engine->set_metadata_map(pm->path(), pm->metadata());
if (!existing)
_engine->enable_patch(pm->path());
@@ -758,10 +764,13 @@ cerr << "FIXME: load node\n";
void
PatchLibrarian::load_subpatch(const CountedPtr<PatchModel> parent, xmlDocPtr doc, const xmlNodePtr subpatch)
{
- xmlChar *key;
- xmlNodePtr cur = subpatch->xmlChildrenNode;
+ //xmlChar *key;
+ //xmlNodePtr cur = subpatch->xmlChildrenNode;
- CountedPtr<PatchModel> pm(new PatchModel("/UNINITIALIZED", 1)); // FIXME: ew
+ cerr << "FIXME: load subpatch" << endl;
+
+#if 0
+ //CountedPtr<PatchModel> pm(new PatchModel("/UNINITIALIZED", 1)); // FIXME: ew
while (cur != NULL) {
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
@@ -789,8 +798,9 @@ PatchLibrarian::load_subpatch(const CountedPtr<PatchModel> parent, xmlDocPtr doc
// NodeModel::set_path from calling it's parent's rename_node with
// an invalid (nonexistant) name
pm->set_parent(parent);
-
+
load_patch(pm, false);
+#endif
}
@@ -801,6 +811,8 @@ PatchLibrarian::parse_connection(const CountedPtr<const PatchModel> parent, xmlD
{
//cerr << "[PatchLibrarian] Parsing connection..." << endl;
+ cerr << "FIXME: load connection" << endl;
+#if 0
xmlChar *key;
xmlNodePtr cur = node->xmlChildrenNode;
@@ -842,6 +854,8 @@ PatchLibrarian::parse_connection(const CountedPtr<const PatchModel> parent, xmlD
translate_load_path(parent->path().base() + dest_node +"/"+ dest_port));
return cm;
+#endif
+ return 0;
}
diff --git a/src/libs/client/PatchLibrarian.h b/src/libs/client/PatchLibrarian.h
index d73912f1..cf90d876 100644
--- a/src/libs/client/PatchLibrarian.h
+++ b/src/libs/client/PatchLibrarian.h
@@ -23,7 +23,6 @@
#include <libxml/tree.h>
#include <cassert>
#include "util/CountedPtr.h"
-//#include "DummyModelClientInterface.h"
using std::string;
@@ -35,7 +34,6 @@ class NodeModel;
class ConnectionModel;
class PresetModel;
class ModelEngineInterface;
-class ModelClientInterface;
/** Handles all patch saving and loading.
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 21e47089..c332cba6 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -90,10 +90,10 @@ PatchModel::remove_child(CountedPtr<ObjectModel> c)
CountedPtr<NodeModel>
-PatchModel::get_node(const string& name)
+PatchModel::get_node(const string& name) const
{
assert(name.find("/") == string::npos);
- NodeModelMap::iterator i = m_nodes.find(name);
+ NodeModelMap::const_iterator i = m_nodes.find(name);
return ((i != m_nodes.end()) ? (*i).second : CountedPtr<NodeModel>());
}
@@ -185,6 +185,8 @@ PatchModel::clear()
void
PatchModel::rename_node(const Path& old_path, const Path& new_path)
{
+ cerr << "FIXME: node rename" << endl;
+#if 0
assert(old_path.parent() == path());
assert(new_path.parent() == path());
@@ -205,13 +207,14 @@ PatchModel::rename_node(const Path& old_path, const Path& new_path)
}
cerr << "[PatchModel::rename_node] " << _path << ": failed to find node " << old_path << endl;
+#endif
}
CountedPtr<ConnectionModel>
-PatchModel::get_connection(const string& src_port_path, const string& dst_port_path)
+PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const
{
- for (list<CountedPtr<ConnectionModel> >::iterator i = m_connections.begin(); i != m_connections.end(); ++i)
+ for (list<CountedPtr<ConnectionModel> >::const_iterator i = m_connections.begin(); i != m_connections.end(); ++i)
if ((*i)->src_port_path() == src_port_path && (*i)->dst_port_path() == dst_port_path)
return (*i);
return CountedPtr<ConnectionModel>();
@@ -228,44 +231,15 @@ PatchModel::get_connection(const string& src_port_path, const string& dst_port_p
void
PatchModel::add_connection(CountedPtr<ConnectionModel> cm)
{
+ // Store should have 'resolved' the connection already
assert(cm);
- //assert(cm->src_port_path().parent().parent() == _path);
- //assert(cm->dst_port_path().parent().parent() == _path);
assert(cm->patch_path() == path());
+ assert(cm->src_port() && cm->src_port()->parent()->parent().get() == this);
+ assert(cm->dst_port() && cm->dst_port()->parent()->parent().get() == this);
- //cerr << "PatchModel::add_connection: " << cm->src_port_path() << " -> " << cm->dst_port_path() << endl;
-
CountedPtr<ConnectionModel> existing = get_connection(cm->src_port_path(), cm->dst_port_path());
-
- if (existing) {
- return;
- }
-
- NodeModel* src_node = (cm->src_port_path().parent() == path())
- ? this : get_node(cm->src_port_path().parent().name()).get();
- CountedPtr<PortModel> src_port = src_node->get_port(cm->src_port_path().name());
- NodeModel* dst_node = (cm->dst_port_path().parent() == path())
- ? this : get_node(cm->dst_port_path().parent().name()).get();
- CountedPtr<PortModel> dst_port = dst_node->get_port(cm->dst_port_path().name());
-
- assert(src_port);
- assert(dst_port);
+ assert(!existing); // Store should have handled this
- // Find source port pointer to 'resolve' connection if necessary
- if (cm->src_port())
- assert(cm->src_port() == src_port);
- else
- cm->set_src_port(src_port);
-
- // Find dest port pointer to 'resolve' connection if necessary
- if (cm->dst_port())
- assert(cm->dst_port() == dst_port);
- else
- cm->set_dst_port(dst_port);
-
- assert(cm->src_port());
- assert(cm->dst_port());
-
m_connections.push_back(cm);
new_connection_sig.emit(cm);
diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h
index 49a45503..7188cb1f 100644
--- a/src/libs/client/PatchModel.h
+++ b/src/libs/client/PatchModel.h
@@ -31,6 +31,8 @@ using std::list; using std::string; using std::map;
namespace Ingen {
namespace Client {
+class Store;
+
/** Client's model of a patch.
*
@@ -39,43 +41,15 @@ namespace Client {
class PatchModel : public NodeModel
{
public:
- PatchModel(const string& patch_path, size_t internal_poly)
- : NodeModel("ingen:patch", patch_path, false ), // FIXME
- m_enabled(false),
- m_poly(internal_poly)
- {
- cerr << "FIXME: patch poly\n";
- }
-
const NodeModelMap& nodes() const { return m_nodes; }
const list<CountedPtr<ConnectionModel> >& connections() const { return m_connections; }
- virtual void set_path(const Path& path);
-
- void add_child(CountedPtr<ObjectModel> c);
- void remove_child(CountedPtr<ObjectModel> c);
-
- CountedPtr<NodeModel> get_node(const string& node_name);
- void add_node(CountedPtr<NodeModel> nm);
- //void remove_node(const string& name);
- void remove_node(CountedPtr<NodeModel> nm);
-
- void rename_node(const Path& old_path, const Path& new_path);
- void rename_node_port(const Path& old_path, const Path& new_path);
-
- CountedPtr<ConnectionModel> get_connection(const string& src_port_path, const string& dst_port_path);
- void add_connection(CountedPtr<ConnectionModel> cm);
- void remove_connection(const string& src_port_path, const string& dst_port_path);
-
- virtual void clear();
+ CountedPtr<ConnectionModel> get_connection(const string& src_port_path, const string& dst_port_path) const;
+ CountedPtr<NodeModel> get_node(const string& node_name) const;
- size_t poly() const { return m_poly; }
- void poly(size_t p) { m_poly = p; }
- const string& filename() const { return m_filename; }
- void filename(const string& f) { m_filename = f; }
- bool enabled() const { return m_enabled; }
- void enable();
- void disable();
+ size_t poly() const { return m_poly; }
+ const string& filename() const { return m_filename; }
+ bool enabled() const { return m_enabled; }
bool polyphonic() const;
// Signals
@@ -87,6 +61,33 @@ public:
sigc::signal<void> disabled_sig;
private:
+ friend class Store;
+
+ PatchModel(const Path& patch_path, size_t internal_poly)
+ : NodeModel("ingen:patch", patch_path, false ), // FIXME
+ m_enabled(false),
+ m_poly(internal_poly)
+ {
+ cerr << "FIXME: patch poly\n";
+ }
+
+ void filename(const string& f) { m_filename = f; }
+ void poly(size_t p) { m_poly = p; }
+ void enable();
+ void disable();
+ void clear();
+ void set_path(const Path& path);
+ void add_node(CountedPtr<NodeModel> nm);
+ void remove_node(CountedPtr<NodeModel> nm);
+ void add_child(CountedPtr<ObjectModel> c);
+ void remove_child(CountedPtr<ObjectModel> c);
+
+ void add_connection(CountedPtr<ConnectionModel> cm);
+ void remove_connection(const string& src_port_path, const string& dst_port_path);
+
+ void rename_node(const Path& old_path, const Path& new_path);
+ void rename_node_port(const Path& old_path, const Path& new_path);
+
// Prevent copies (undefined)
PatchModel(const PatchModel& copy);
PatchModel& operator=(const PatchModel& copy);
diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h
index dd0a208b..c4b08ce8 100644
--- a/src/libs/client/PortModel.h
+++ b/src/libs/client/PortModel.h
@@ -23,12 +23,14 @@
#include <sigc++/sigc++.h>
#include "ObjectModel.h"
#include "util/CountedPtr.h"
+#include "util/Path.h"
using std::string; using std::list;
namespace Ingen {
namespace Client {
-/* Model of a port.
+
+/** Model of a port.
*
* \ingroup IngenClient.
*/
@@ -40,7 +42,29 @@ public:
enum Direction { INPUT, OUTPUT };
enum Hint { NONE, INTEGER, TOGGLE, LOGARITHMIC };
- PortModel(const string& path, Type type, Direction dir, Hint hint)
+ inline float value() const { return m_current_val; }
+ inline bool connected() const { return (m_connections > 0); }
+ inline Type type() const { return m_type; }
+ inline bool is_input() const { return (m_direction == INPUT); }
+ inline bool is_output() const { return (m_direction == OUTPUT); }
+ inline bool is_audio() const { return (m_type == AUDIO); }
+ inline bool is_control() const { return (m_type == CONTROL); }
+ inline bool is_midi() const { return (m_type == MIDI); }
+ inline bool is_logarithmic() const { return (m_hint == LOGARITHMIC); }
+ inline bool is_integer() const { return (m_hint == INTEGER); }
+ inline bool is_toggle() const { return (m_hint == TOGGLE); }
+
+ inline bool operator==(const PortModel& pm) const { return (_path == pm._path); }
+
+ // Signals
+ sigc::signal<void, float> control_change_sig; ///< "Control" ports only
+ sigc::signal<void, CountedPtr<PortModel> > connection_sig;
+ sigc::signal<void, CountedPtr<PortModel> > disconnection_sig;
+
+private:
+ friend class Store;
+
+ PortModel(const Path& path, Type type, Direction dir, Hint hint)
: ObjectModel(path),
m_type(type),
m_direction(dir),
@@ -50,7 +74,7 @@ public:
{
}
- PortModel(const string& path, Type type, Direction dir)
+ PortModel(const Path& path, Type type, Direction dir)
: ObjectModel(path),
m_type(type),
m_direction(dir),
@@ -60,38 +84,18 @@ public:
{
}
+ inline void value(float f) { m_current_val = f; control_change_sig.emit(f); }
+
void add_child(CountedPtr<ObjectModel> c) { throw; }
void remove_child(CountedPtr<ObjectModel> c) { throw; }
- inline float value() const { return m_current_val; }
- inline void value(float f) { m_current_val = f; control_change_sig.emit(f); }
- inline bool connected() { return (m_connections > 0); }
- inline Type type() { return m_type; }
-
- inline bool is_input() const { return (m_direction == INPUT); }
- inline bool is_output() const { return (m_direction == OUTPUT); }
- inline bool is_audio() const { return (m_type == AUDIO); }
- inline bool is_control() const { return (m_type == CONTROL); }
- inline bool is_midi() const { return (m_type == MIDI); }
- inline bool is_logarithmic() const { return (m_hint == LOGARITHMIC); }
- inline bool is_integer() const { return (m_hint == INTEGER); }
- inline bool is_toggle() const { return (m_hint == TOGGLE); }
+ // Prevent copies (undefined)
+ PortModel(const PortModel& copy);
+ PortModel& operator=(const PortModel& copy);
- inline bool operator==(const PortModel& pm)
- { return (_path == pm._path); }
-
void connected_to(CountedPtr<PortModel> p) { ++m_connections; connection_sig.emit(p); }
void disconnected_from(CountedPtr<PortModel> p) { --m_connections; disconnection_sig.emit(p); }
- // Signals
- sigc::signal<void, float> control_change_sig; ///< "Control" ports only
- sigc::signal<void, CountedPtr<PortModel> > connection_sig;
- sigc::signal<void, CountedPtr<PortModel> > disconnection_sig;
-
-private:
- // Prevent copies (undefined)
- PortModel(const PortModel& copy);
- PortModel& operator=(const PortModel& copy);
Type m_type;
Direction m_direction;
diff --git a/src/libs/client/PresetModel.h b/src/libs/client/PresetModel.h
index e56a9177..9e7f5339 100644
--- a/src/libs/client/PresetModel.h
+++ b/src/libs/client/PresetModel.h
@@ -50,7 +50,7 @@ public:
m_controls.push_back(ControlModel(m_base_path + port_name, value));
}
- const string& name() { return m_name; }
+ const string& name() const { return m_name; }
void name(const string& n) { m_name = n; }
const list<ControlModel>& controls() const { return m_controls; }
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index e2637c0f..64824b39 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -86,6 +86,45 @@ Store::resolve_plugin_orphans(CountedPtr<PluginModel> plugin)
void
+Store::add_connection_orphan(CountedPtr<ConnectionModel> connection)
+{
+ cerr << "WARNING: Orphan connection received." << endl;
+
+ cerr << "FIXME (add_connection_orphan)" << endl;
+
+ throw; // FIXME: (lazy)
+#if 0
+ map<string, list<CountedPtr<ConnectionModel> > >::iterator spawn
+ = m_connection_orphans.find(node->connection_uri());
+
+ if (spawn != m_connection_orphans.end()) {
+ spawn->second.push_back(node);
+ } else {
+ list<CountedPtr<ConnectionModel> > l;
+ l.push_back(node);
+ m_connection_orphans[node->connection_uri()] = l;
+ }
+#endif
+}
+
+
+void
+Store::resolve_connection_orphans(CountedPtr<PortModel> port)
+{
+ cerr << "FIXME (add_connection_orphan)" << endl;
+ throw; // FIXME: (lazy)
+#if 0
+ map<string, list<CountedPtr<ConnectionModel> > >::iterator spawn
+ = m_connection_orphans.find(connection->uri());
+
+ if (spawn != m_connection_orphans.end()) {
+ cerr << "XXXXXXXXXX PLUGIN-ORPHAN PLUGIN FOUND!! XXXXXXXXXXXXXXXXX" << endl;
+ }
+#endif
+}
+
+
+void
Store::add_orphan(CountedPtr<ObjectModel> child)
{
cerr << "WARNING: Orphan object " << child->path() << " received." << endl;
@@ -133,8 +172,18 @@ Store::add_object(CountedPtr<ObjectModel> object)
}
}
+ // If we already have "this" object, merge the existing one into the new
+ // one (with precedence to the new values).
+ ObjectMap::iterator existing = m_objects.find(object->path());
+ if (existing != m_objects.end()) {
+ cerr << "[Store] Warning: Assimilating " << object->path() << endl;
+ object->assimilate(existing->second);
+ existing->second = object;
+ }
+
m_objects[object->path()] = object;
+ // FIXME: emit this when we already had one?
new_object_sig.emit(object);
resolve_orphans(object);
@@ -327,10 +376,21 @@ Store::connection_event(const Path& src_port_path, const Path& dst_port_path)
CountedPtr<PatchModel> patch = PtrCast<PatchModel>(this->object(cm->patch_path()));
- if (patch)
+ CountedPtr<ObjectModel> src_obj = this->object(src_port_path);
+ CountedPtr<ObjectModel> dst_obj = this->object(dst_port_path);
+
+ if (!src_obj || !dst_obj || !patch) {
+ add_connection_orphan(cm);
+ } else {
+ CountedPtr<PortModel> src_port = PtrCast<PortModel>(src_obj);
+ CountedPtr<PortModel> dst_port = PtrCast<PortModel>(dst_obj);
+ assert(src_port && dst_port);
+
+ cm->set_src_port(src_port);
+ cm->set_dst_port(dst_port);
+
patch->add_connection(cm);
- else
- cerr << "ERROR: connection in nonexistant patch" << endl;
+ }
}
diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h
index 99466b1d..cd27e5d6 100644
--- a/src/libs/client/Store.h
+++ b/src/libs/client/Store.h
@@ -36,6 +36,8 @@ class PluginModel;
class PatchModel;
class NodeModel;
class PortModel;
+class ConnectionModel;
+
/** Automatically manages models of objects in the engine.
*
@@ -62,9 +64,14 @@ private:
void add_plugin(CountedPtr<PluginModel> plugin);
+ // It would be nice to integrate these somehow..
+
void add_orphan(CountedPtr<ObjectModel> orphan);
void resolve_orphans(CountedPtr<ObjectModel> parent);
+ void add_connection_orphan(CountedPtr<ConnectionModel> orphan);
+ void resolve_connection_orphans(CountedPtr<PortModel> port);
+
void add_plugin_orphan(CountedPtr<NodeModel> orphan);
void resolve_plugin_orphans(CountedPtr<PluginModel> plugin);
@@ -81,7 +88,9 @@ private:
void connection_event(const Path& src_port_path, const Path& dst_port_path);
void disconnection_event(const Path& src_port_path, const Path& dst_port_path);
- map<Path, CountedPtr<ObjectModel> > m_objects; ///< Keyed by Ingen path
+ typedef map<Path, CountedPtr<ObjectModel> > ObjectMap;
+ ObjectMap m_objects; ///< Keyed by Ingen path
+
map<string, CountedPtr<PluginModel> > m_plugins; ///< Keyed by URI
/** Objects we've received, but depend on the existance of another unknown object.
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index 9ab03a73..33b1842d 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -92,6 +92,18 @@ NodeFactory::~NodeFactory()
}
+const Plugin*
+NodeFactory::plugin(const string& uri)
+{
+ // FIXME: this needs.. well, fixing
+ for (list<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i)
+ if ((*i)->uri() == uri)
+ return (*i);
+
+ return NULL;
+}
+
+
void
NodeFactory::load_plugins()
{
diff --git a/src/libs/engine/NodeFactory.h b/src/libs/engine/NodeFactory.h
index 25408b2d..1fd6c2d4 100644
--- a/src/libs/engine/NodeFactory.h
+++ b/src/libs/engine/NodeFactory.h
@@ -56,6 +56,8 @@ public:
const list<Plugin*>& plugins() { return _plugins; }
+ const Plugin* plugin(const string& uri);
+
private:
#ifdef HAVE_LADSPA
void load_ladspa_plugins();
@@ -76,7 +78,7 @@ private:
list<PluginLibrary*> _libraries;
list<Plugin*> _internal_plugins;
- list<Plugin*> _plugins;
+ list<Plugin*> _plugins; // FIXME: make a map
bool _has_loaded;
};
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index afed89fd..92ab08f0 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -88,8 +88,8 @@ OSCEngineReceiver::OSCEngineReceiver(CountedPtr<Engine> engine, size_t queue_siz
lo_server_add_method(_server, "/om/synth/disable_patch", "is", disable_patch_cb, this);
lo_server_add_method(_server, "/om/synth/clear_patch", "is", clear_patch_cb, this);
lo_server_add_method(_server, "/om/synth/create_port", "issi", create_port_cb, this);
- lo_server_add_method(_server, "/om/synth/create_node", "issssi", create_node_cb, this);
- lo_server_add_method(_server, "/om/synth/create_node", "isssi", create_node_by_uri_cb, this);
+ lo_server_add_method(_server, "/om/synth/create_node", "isssi", create_node_cb, this);
+ lo_server_add_method(_server, "/om/synth/create_node", "issi", create_node_by_uri_cb, this);
lo_server_add_method(_server, "/om/synth/destroy", "is", destroy_cb, this);
lo_server_add_method(_server, "/om/synth/rename", "iss", rename_cb, this);
lo_server_add_method(_server, "/om/synth/connect", "iss", connect_cb, this);
@@ -487,7 +487,6 @@ OSCEngineReceiver::m_create_port_cb(const char* path, const char* types, lo_arg*
* <p> \b /om/synth/create_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 type (string) - Plugin type ("Internal", "LV2", "DSSI", "LADSPA")
* \arg \b plug-uri (string) - URI of the plugin to load
* \arg \b poly (integer-boolean) - Whether node is polyphonic (0 = false, 1 = true) </p> \n \n
*/
@@ -495,13 +494,12 @@ int
OSCEngineReceiver::m_create_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* type = &argv[2]->s;
- const char* plug_uri = &argv[3]->s;
- const int poly = argv[4]->i;
+ const char* plug_uri = &argv[2]->s;
+ const int poly = argv[3]->i;
// FIXME: make sure poly is valid
- create_node(node_path, type, plug_uri, (poly == 1));
+ create_node(node_path, plug_uri, (poly == 1));
return 0;
}
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index b0903e29..ce56e569 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -140,17 +140,10 @@ void QueuedEngineInterface::create_port(const string& path,
void
QueuedEngineInterface::create_node(const string& path,
- const string& plugin_type,
const string& plugin_uri,
bool polyphonic)
{
- // FIXME: ew
-
- Plugin* plugin = new Plugin();
- plugin->set_type(plugin_type);
- plugin->uri(plugin_uri);
-
- push_queued(new AddNodeEvent(*_engine.get(), _responder, now(), path, plugin, polyphonic));
+ push_queued(new AddNodeEvent(*_engine.get(), _responder, now(), path, plugin_uri, polyphonic));
}
@@ -161,6 +154,9 @@ QueuedEngineInterface::create_node(const string& path,
const string& plugin_label,
bool polyphonic)
{
+ cerr << "FIXME: deprecated create_node\n";
+ throw;
+#if 0
// FIXME: ew
Plugin* plugin = new Plugin();
@@ -169,6 +165,7 @@ QueuedEngineInterface::create_node(const string& path,
plugin->plug_label(plugin_label);
push_queued(new AddNodeEvent(*_engine.get(), _responder, now(), path, plugin, polyphonic));
+#endif
}
void
diff --git a/src/libs/engine/QueuedEngineInterface.h b/src/libs/engine/QueuedEngineInterface.h
index f9aaa0b4..10b120e8 100644
--- a/src/libs/engine/QueuedEngineInterface.h
+++ b/src/libs/engine/QueuedEngineInterface.h
@@ -89,7 +89,6 @@ public:
bool direction);
virtual void create_node(const string& path,
- const string& plugin_type,
const string& plugin_uri,
bool polyphonic);
diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp
index 19ff6bf5..6e42ef82 100644
--- a/src/libs/engine/events/AddNodeEvent.cpp
+++ b/src/libs/engine/events/AddNodeEvent.cpp
@@ -33,7 +33,7 @@
namespace Ingen {
-AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly)
+/*AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly)
: QueuedEvent(engine, responder, timestamp),
m_path(path),
m_plugin(plugin),
@@ -43,12 +43,24 @@ AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, Samp
m_process_order(NULL),
m_node_already_exists(false)
{
+}*/
+
+AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path,
+ const string& plugin_uri, bool poly)
+: QueuedEvent(engine, responder, timestamp),
+ m_path(path),
+ m_plugin_uri(plugin_uri),
+ m_poly(poly),
+ m_patch(NULL),
+ m_node(NULL),
+ m_process_order(NULL),
+ m_node_already_exists(false)
+{
}
AddNodeEvent::~AddNodeEvent()
{
- delete m_plugin;
}
@@ -62,12 +74,13 @@ AddNodeEvent::pre_process()
}
m_patch = _engine.object_store()->find_patch(m_path.parent());
+ const Plugin* plugin = _engine.node_factory()->plugin(m_plugin_uri);
- if (m_patch != NULL) {
+ if (m_patch && plugin) {
if (m_poly)
- m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch);
+ m_node = _engine.node_factory()->load_plugin(plugin, m_path.name(), m_patch->internal_poly(), m_patch);
else
- m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch);
+ m_node = _engine.node_factory()->load_plugin(plugin, m_path.name(), 1, m_patch);
if (m_node != NULL) {
m_node->activate();
@@ -113,7 +126,7 @@ AddNodeEvent::post_process()
} else if (m_node == NULL) {
msg = "Unable to load node ";
msg.append(m_path).append(" (you're missing the plugin \"").append(
- m_plugin->uri());
+ m_plugin_uri);
_responder->respond_error(msg);
} else {
_responder->respond_ok();
diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h
index c7616c2b..b4345f90 100644
--- a/src/libs/engine/events/AddNodeEvent.h
+++ b/src/libs/engine/events/AddNodeEvent.h
@@ -39,7 +39,14 @@ class Plugin;
class AddNodeEvent : public QueuedEvent
{
public:
- AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly);
+ //AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly);
+ AddNodeEvent(Engine& engine,
+ CountedPtr<Responder> responder,
+ SampleCount timestamp,
+ const string& node_path,
+ const string& plugin_uri,
+ bool poly);
+
~AddNodeEvent();
void pre_process();
@@ -49,11 +56,11 @@ public:
private:
string m_patch_name;
Path m_path;
- Plugin* m_plugin;
+ string m_plugin_uri;
bool m_poly;
Patch* m_patch;
Node* m_node;
- Array<Node*>* m_process_order; // Patch's new process order
+ Array<Node*>* m_process_order; ///< Patch's new process order
bool m_node_already_exists;
};
diff --git a/src/progs/demolition/DemolitionClientInterface.h b/src/progs/demolition/DemolitionClientInterface.h
index e1093411..809857cf 100644
--- a/src/progs/demolition/DemolitionClientInterface.h
+++ b/src/progs/demolition/DemolitionClientInterface.h
@@ -14,7 +14,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#ifndef DEMOLITIONCLIENTHOOKS_H
#define DEMOLITIONCLIENTHOOKS_H
diff --git a/src/progs/ingenuity/ControlGroups.cpp b/src/progs/ingenuity/ControlGroups.cpp
index 06f49f86..9b809cff 100644
--- a/src/progs/ingenuity/ControlGroups.cpp
+++ b/src/progs/ingenuity/ControlGroups.cpp
@@ -247,7 +247,7 @@ SliderControlGroup::update_value_from_slider()
m_enable_signal = false;
m_value_spinner.set_value(value);
m_control_panel->value_changed(m_port_model->path(), value);
- m_port_model->value(value);
+ //m_port_model->value(value);
m_enable_signal = true;
}
}
@@ -273,7 +273,7 @@ SliderControlGroup::update_value_from_spinner()
m_control_panel->value_changed(m_port_model->path(), value);
- m_port_model->value(value);
+ //m_port_model->value(value);
m_enable_signal = true;
}
}
@@ -369,7 +369,7 @@ IntegerControlGroup::update_value()
if (m_enable_signal) {
float value = m_spinner.get_value();
m_control_panel->value_changed(m_port_model->path(), value);
- m_port_model->value(value);
+ //m_port_model->value(value);
}
}
@@ -440,7 +440,7 @@ ToggleControlGroup::update_value()
if (m_enable_signal) {
float value = m_checkbutton.get_active() ? 1.0f : 0.0f;
m_control_panel->value_changed(m_port_model->path(), value);
- m_port_model->value(value);
+ //m_port_model->value(value);
}
}
diff --git a/src/progs/ingenuity/LoadPatchWindow.cpp b/src/progs/ingenuity/LoadPatchWindow.cpp
index 5e740aac..1fa5c2ba 100644
--- a/src/progs/ingenuity/LoadPatchWindow.cpp
+++ b/src/progs/ingenuity/LoadPatchWindow.cpp
@@ -118,13 +118,14 @@ LoadPatchWindow::ok_clicked()
if (m_replace)
App::instance().engine()->clear_patch(m_patch->path());
- CountedPtr<PatchModel> pm(new PatchModel(m_patch->path(), poly));
- pm->filename(get_filename());
- pm->set_metadata("filename", Atom(get_filename().c_str()));
+ cerr << "FIXME: load patch" << endl;
+ //CountedPtr<PatchModel> pm(new PatchModel(m_patch->path(), poly));
+ //pm->filename(get_filename());
+ //pm->set_metadata("filename", Atom(get_filename().c_str()));
// FIXME: necessary?
//pm->set_parent(m_patch->parent());
//App::instance().engine()->push_added_patch(pm);
- App::instance().loader()->load_patch(pm, true, true);
+ //App::instance().loader()->load_patch(pm, true, true);
hide();
}
diff --git a/src/progs/ingenuity/LoadPluginWindow.cpp b/src/progs/ingenuity/LoadPluginWindow.cpp
index 9321b12a..2c09584c 100644
--- a/src/progs/ingenuity/LoadPluginWindow.cpp
+++ b/src/progs/ingenuity/LoadPluginWindow.cpp
@@ -313,11 +313,8 @@ LoadPluginWindow::add_clicked()
dialog.run();
} else {
- const string path = m_patch->path().base() + name;
- NodeModel* nm = new NodeModel(plugin, path, polyphonic);
- nm->add_metadata(m_initial_data);
-
- App::instance().engine()->create_node_from_model(nm);
+ Path path = m_patch->path().base() + Path::nameify(name);
+ App::instance().engine()->create_node_with_data(plugin->uri(), path, polyphonic, m_initial_data);
++m_plugin_name_offset;
m_node_name_entry->set_text(generate_module_name(m_plugin_name_offset));
diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp
index cb7a7ef6..ed5da0ee 100644
--- a/src/progs/ingenuity/LoadSubpatchWindow.cpp
+++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp
@@ -158,10 +158,8 @@ LoadSubpatchWindow::ok_clicked()
// m_new_module_x, m_new_module_y);
}
- CountedPtr<PatchModel> pm(new PatchModel(m_patch->path().base() + name, poly));
+ /*CountedPtr<PatchModel> pm(new PatchModel(m_patch->path().base() + name, poly));
pm->filename(filename);
- // FIXME: necessary?
- //pm->set_parent(m_patch);
pm->set_metadata("module-x", Atom((float)m_new_module_x));
pm->set_metadata("module-y", Atom((float)m_new_module_y));
@@ -169,7 +167,9 @@ LoadSubpatchWindow::ok_clicked()
App::instance().loader()->load_patch(pm, true, false);
App::instance().configuration()->set_patch_folder(pm->filename().substr(0, pm->filename().find_last_of("/")));
-
+ */
+ cerr << "FIXME: load subpatch" << endl;
+
hide();
}
diff --git a/src/progs/ingenuity/NewSubpatchWindow.cpp b/src/progs/ingenuity/NewSubpatchWindow.cpp
index 8d673622..1d730582 100644
--- a/src/progs/ingenuity/NewSubpatchWindow.cpp
+++ b/src/progs/ingenuity/NewSubpatchWindow.cpp
@@ -87,6 +87,8 @@ NewSubpatchWindow::name_changed()
void
NewSubpatchWindow::ok_clicked()
{
+ cerr << "FIXME: new subpatch\n";
+#if 0
PatchModel* pm = new PatchModel(
m_patch->path().base() + m_name_entry->get_text(),
m_poly_spinbutton->get_value_as_int());
@@ -102,6 +104,7 @@ NewSubpatchWindow::ok_clicked()
pm->set_metadata("module-x", (float)m_new_module_x);
pm->set_metadata("module-y", (float)m_new_module_y);
App::instance().engine()->create_patch_from_model(pm);
+#endif
hide();
}
diff --git a/src/progs/ingenuity/OmFlowCanvas.cpp b/src/progs/ingenuity/OmFlowCanvas.cpp
index 0d2e9bb0..dfd89f8a 100644
--- a/src/progs/ingenuity/OmFlowCanvas.cpp
+++ b/src/progs/ingenuity/OmFlowCanvas.cpp
@@ -196,6 +196,8 @@ OmFlowCanvas::connect(const Port* src_port, const Port* dst_port)
if (src->model()->type() == PortModel::MIDI &&
dst->model()->type() == PortModel::CONTROL)
{
+ cerr << "FIXME: MIDI binding" << endl;
+#if 0
CountedPtr<PluginModel> pm(new PluginModel(PluginModel::Internal, "", "midi_control_in", ""));
CountedPtr<NodeModel> nm(new NodeModel(pm, m_patch->path().base()
+ src->name() + "-" + dst->name(), false));
@@ -214,9 +216,9 @@ OmFlowCanvas::connect(const Port* src_port, const Port* dst_port)
dst->model()->get_metadata("user-min").get_float());
App::instance().engine()->set_port_value_queued(nm->path().base() + "Max",
dst->model()->get_metadata("user-max").get_float());
+#endif
} else {
- App::instance().engine()->connect(src->model()->path(),
- dst->model()->path());
+ App::instance().engine()->connect(src->model()->path(), dst->model()->path());
}
}
diff --git a/src/progs/ingenuity/PatchPropertiesWindow.cpp b/src/progs/ingenuity/PatchPropertiesWindow.cpp
index b6dd5e7f..51912fe9 100644
--- a/src/progs/ingenuity/PatchPropertiesWindow.cpp
+++ b/src/progs/ingenuity/PatchPropertiesWindow.cpp
@@ -74,8 +74,10 @@ PatchPropertiesWindow::cancel_clicked()
void
PatchPropertiesWindow::ok_clicked()
{
- m_patch_model->set_metadata("author", Atom(m_author_entry->get_text().c_str()));
- m_patch_model->set_metadata("description", Atom(m_textview->get_buffer()->get_text().c_str()));
+ cerr << "FIXME: properties\n";
+
+ //m_patch_model->set_metadata("author", Atom(m_author_entry->get_text().c_str()));
+ //m_patch_model->set_metadata("description", Atom(m_textview->get_buffer()->get_text().c_str()));
hide();
}
diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp
index 1aec1977..6915b4a1 100644
--- a/src/progs/ingenuity/PatchWindow.cpp
+++ b/src/progs/ingenuity/PatchWindow.cpp
@@ -283,7 +283,7 @@ PatchWindow::event_save_as()
if (confirm) {
App::instance().loader()->save_patch(m_patch, filename, recursive);
- m_patch->filename(filename);
+ //m_patch->set_metadata("filename", Atom(filename.c_str()));
}
}
App::instance().configuration()->set_patch_folder(dialog.get_current_folder());
diff --git a/src/progs/patch_loader/patch_loader.cpp b/src/progs/patch_loader/patch_loader.cpp
index f7464840..69a06407 100644
--- a/src/progs/patch_loader/patch_loader.cpp
+++ b/src/progs/patch_loader/patch_loader.cpp
@@ -71,9 +71,10 @@ int main(int argc, char** argv)
// Load patches
for (uint i=0; i < args_info.inputs_num; ++i) {
- CountedPtr<PatchModel> pm(new PatchModel("", 0));
- pm->filename(args_info.inputs[i]);
- librarian.load_patch(pm, true);
+ cerr << "FIXME: load patch" << endl;
+ //CountedPtr<PatchModel> pm(new PatchModel("", 0));
+ //pm->filename(args_info.inputs[i]);
+ //librarian.load_patch(pm, true);
}
return 0;