diff options
Diffstat (limited to 'src')
21 files changed, 176 insertions, 107 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp index 940a3f46..684640d4 100644 --- a/src/bindings/Client.hpp +++ b/src/bindings/Client.hpp @@ -74,11 +74,11 @@ public: virtual void object_destroyed(const std::string& path) {} - virtual void connection(const std::string& src_port_path, - const std::string& dst_port_path) {} + virtual void connect(const std::string& src_port_path, + const std::string& dst_port_path) {} - virtual void disconnection(const std::string& src_port_path, - const std::string& dst_port_path) {} + virtual void disconnect(const std::string& src_port_path, + const std::string& dst_port_path) {} virtual void variable_change(const std::string& subject_path, const std::string& predicate, diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp index 931e267b..9b0cbffb 100644 --- a/src/common/interface/ClientInterface.hpp +++ b/src/common/interface/ClientInterface.hpp @@ -30,7 +30,6 @@ class EngineInterface; /** The (only) interface the engine uses to communicate with clients. - * * Purely virtual (except for the destructor). * * \ingroup interface @@ -106,11 +105,11 @@ public: virtual void object_destroyed(const std::string& path) = 0; - virtual void connection(const std::string& src_port_path, - const std::string& dst_port_path) = 0; + virtual void connect(const std::string& src_port_path, + const std::string& dst_port_path) = 0; - virtual void disconnection(const std::string& src_port_path, - const std::string& dst_port_path) = 0; + virtual void disconnect(const std::string& src_port_path, + const std::string& dst_port_path) = 0; virtual void variable_change(const std::string& subject_path, const std::string& predicate, diff --git a/src/common/interface/CommonInterface.hpp b/src/common/interface/CommonInterface.hpp new file mode 100644 index 00000000..da147e9f --- /dev/null +++ b/src/common/interface/CommonInterface.hpp @@ -0,0 +1,65 @@ +/* This file is part of Ingen. + * Copyright (C) 2008 Dave Robillard <http://drobilla.net> + * + * 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 COMMONINTERFACE_H +#define COMMONINTERFACE_H + +#include <inttypes.h> +#include <string> +#include <raul/SharedPtr.hpp> +#include "interface/ClientInterface.hpp" +#include "interface/CommonInterface.hpp" + +namespace Ingen { +namespace Shared { + + +/** Abstract interface common to both engine and clients. + * Purely virtual (except for the destructor). + * + * \ingroup interface + */ +class CommonInterface +{ +public: + virtual ~CommonInterface() {} + + // Bundles + virtual void bundle_begin() = 0; + virtual void bundle_end() = 0; + + // Object commands + + virtual void new_patch(const std::string& path, + uint32_t poly) = 0; + + virtual void connect(const std::string& src_port_path, + const std::string& dst_port_path) = 0; + + virtual void disconnect(const std::string& src_port_path, + const std::string& dst_port_path) = 0; + +protected: + CommonInterface() {} +}; + + +} // namespace Shared +} // namespace Ingen + +#endif // COMMONINTERFACE_H + diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp index 08fb9c1a..a6481a7d 100644 --- a/src/common/interface/EngineInterface.hpp +++ b/src/common/interface/EngineInterface.hpp @@ -22,21 +22,18 @@ #include <string> #include <raul/SharedPtr.hpp> #include "interface/ClientInterface.hpp" -using std::string; -using Ingen::Shared::ClientInterface; +#include "interface/CommonInterface.hpp" namespace Ingen { -/** Shared code used on both client side and engine side (abstract interfaces). */ namespace Shared { /** The (only) interface clients use to communicate with the engine. - * * Purely virtual (except for the destructor). * * \ingroup interface */ -class EngineInterface +class EngineInterface : public CommonInterface { public: virtual ~EngineInterface() {} @@ -47,7 +44,7 @@ public: // Client registration virtual void register_client(ClientInterface* client) = 0; - virtual void unregister_client(const string& uri) = 0; + virtual void unregister_client(const std::string& uri) = 0; // Engine commands virtual void load_plugins() = 0; @@ -61,95 +58,96 @@ public: // Object commands - virtual void create_patch(const string& path, - uint32_t poly) = 0; + virtual void new_patch(const std::string& path, + uint32_t poly) = 0; - virtual void create_port(const string& path, - const string& data_type, - bool is_output) = 0; + virtual void create_port(const std::string& path, + const std::string& data_type, + bool is_output) = 0; - virtual void create_node(const string& path, - const string& plugin_uri, - bool polyphonic) = 0; + virtual void create_node(const std::string& path, + const std::string& plugin_uri, + bool polyphonic) = 0; /** DEPRECATED */ - virtual void create_node(const string& path, - const string& plugin_type, - const string& library_name, - const string& plugin_label, - bool polyphonic) = 0; + virtual void create_node(const std::string& path, + const std::string& plugin_type, + const std::string& library_name, + const std::string& plugin_label, + bool polyphonic) = 0; - virtual void rename(const string& old_path, - const string& new_symbol) = 0; + virtual void rename(const std::string& old_path, + const std::string& new_symbol) = 0; - virtual void destroy(const string& path) = 0; + virtual void destroy(const std::string& path) = 0; - virtual void clear_patch(const string& patch_path) = 0; + virtual void clear_patch(const std::string& patch_path) = 0; - virtual void set_polyphony(const string& patch_path, uint32_t poly) = 0; + virtual void set_polyphony(const std::string& patch_path, uint32_t poly) = 0; - virtual void set_polyphonic(const string& path, bool poly) = 0; + virtual void set_polyphonic(const std::string& path, bool poly) = 0; - virtual void enable_patch(const string& patch_path) = 0; + virtual void enable_patch(const std::string& patch_path) = 0; - virtual void disable_patch(const string& patch_path) = 0; + virtual void disable_patch(const std::string& patch_path) = 0; - virtual void connect(const string& src_port_path, - const string& dst_port_path) = 0; + virtual void connect(const std::string& src_port_path, + const std::string& dst_port_path) = 0; - virtual void disconnect(const string& src_port_path, - const string& dst_port_path) = 0; + virtual void disconnect(const std::string& src_port_path, + const std::string& dst_port_path) = 0; - virtual void disconnect_all(const string& parent_patch_path, - const string& path) = 0; + virtual void disconnect_all(const std::string& parent_patch_path, + const std::string& path) = 0; - virtual void set_port_value(const string& port_path, - const string& type_uri, - uint32_t data_size, - const void* data) = 0; + virtual void set_port_value(const std::string& port_path, + const std::string& type_uri, + uint32_t data_size, + const void* data) = 0; - virtual void set_port_value(const string& port_path, - const string& type_uri, - uint32_t voice, - uint32_t data_size, - const void* data) = 0; + virtual void set_port_value(const std::string& port_path, + const std::string& type_uri, + uint32_t voice, + uint32_t data_size, + const void* data) = 0; - virtual void set_port_value_immediate(const string& port_path, - const string& type_uri, - uint32_t data_size, - const void* data) = 0; + virtual void set_port_value_immediate(const std::string& port_path, + const std::string& type_uri, + uint32_t data_size, + const void* data) = 0; - virtual void set_port_value_immediate(const string& port_path, - const string& type_uri, - uint32_t voice, - uint32_t data_size, - const void* data) = 0; + virtual void set_port_value_immediate(const std::string& port_path, + const std::string& type_uri, + uint32_t voice, + uint32_t data_size, + const void* data) = 0; - virtual void enable_port_broadcasting(const string& port_path) = 0; + virtual void enable_port_broadcasting(const std::string& port_path) = 0; - virtual void disable_port_broadcasting(const string& port_path) = 0; + virtual void disable_port_broadcasting(const std::string& port_path) = 0; - virtual void set_program(const string& node_path, - uint32_t bank, - uint32_t program) = 0; + virtual void set_program(const std::string& node_path, + uint32_t bank, + uint32_t program) = 0; - virtual void midi_learn(const string& node_path) = 0; + virtual void midi_learn(const std::string& node_path) = 0; - virtual void set_variable(const string& path, - const string& predicate, - const Raul::Atom& value) = 0; + virtual void set_variable(const std::string& subject_path, + const std::string& predicate, + const Raul::Atom& value) = 0; // Requests virtual void ping() = 0; - virtual void request_plugin(const string& uri) = 0; + virtual void request_plugin(const std::string& uri) = 0; - virtual void request_object(const string& path) = 0; + virtual void request_object(const std::string& path) = 0; - virtual void request_port_value(const string& port_path) = 0; + virtual void request_port_value(const std::string& port_path) = 0; - virtual void request_variable(const string& path, const string& key) = 0; + virtual void request_variable(const std::string& path, + const std::string& key) = 0; virtual void request_plugins() = 0; diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index d064830b..6b44fcf8 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -299,7 +299,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, // Create it, if we're not merging if (!existing && path != "/") { - _engine->create_patch(path, poly); + _engine->new_patch(path, poly); for (GraphObject::Variables::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_variable(path, i->first, i->second); } diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 3f5447d0..00c5c28f 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -238,7 +238,7 @@ OSCClientReceiver::_connection_cb(const char* path, const char* types, lo_arg** const char* const src_port_path = &argv[0]->s; const char* const dst_port_path = &argv[1]->s; - connection(src_port_path, dst_port_path); + connect(src_port_path, dst_port_path); return 0; } @@ -250,7 +250,7 @@ OSCClientReceiver::_disconnection_cb(const char* path, const char* types, lo_arg const char* src_port_path = &argv[0]->s; const char* dst_port_path = &argv[1]->s; - disconnection(src_port_path, dst_port_path); + disconnect(src_port_path, dst_port_path); return 0; } diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 412cb5cd..44149865 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -183,11 +183,11 @@ OSCEngineSender::quit() // Object commands void -OSCEngineSender::create_patch(const string& path, - uint32_t poly) +OSCEngineSender::new_patch(const string& path, + uint32_t poly) { assert(_engine_addr); - lo_send(_engine_addr, "/ingen/create_patch", "isi", + lo_send(_engine_addr, "/ingen/new_patch", "isi", next_id(), path.c_str(), poly); diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp index dfbdff62..bb935d7a 100644 --- a/src/libs/client/OSCEngineSender.hpp +++ b/src/libs/client/OSCEngineSender.hpp @@ -73,8 +73,8 @@ public: // Object commands - void create_patch(const string& path, - uint32_t poly); + void new_patch(const string& path, + uint32_t poly); void create_port(const string& path, const string& data_type, diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp index 858ea3e6..1fed9e65 100644 --- a/src/libs/client/SigClientInterface.hpp +++ b/src/libs/client/SigClientInterface.hpp @@ -116,7 +116,7 @@ protected: void polyphonic(const string& path, bool polyphonic) { if (_enabled) signal_polyphonic.emit(path, polyphonic); } - void connection(const string& src_port_path, const string& dst_port_path) + void connect(const string& src_port_path, const string& dst_port_path) { if (_enabled) signal_connection.emit(src_port_path, dst_port_path); } void object_destroyed(const string& path) @@ -137,7 +137,7 @@ protected: void object_renamed(const string& old_path, const string& new_path) { if (_enabled) signal_object_renamed.emit(old_path, new_path); } - void disconnection(const string& src_port_path, const string& dst_port_path) + void disconnect(const string& src_port_path, const string& dst_port_path) { if (_enabled) signal_disconnection.emit(src_port_path, dst_port_path); } void variable_change(const string& path, const string& key, const Raul::Atom& value) diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp index 2dab8897..63a35b59 100644 --- a/src/libs/client/ThreadedSigClientInterface.hpp +++ b/src/libs/client/ThreadedSigClientInterface.hpp @@ -106,7 +106,7 @@ public: void polyphonic(const string& path, bool polyphonic) { push_sig(sigc::bind(polyphonic_slot, path, polyphonic)); } - void connection(const string& src_port_path, const string& dst_port_path) + void connect(const string& src_port_path, const string& dst_port_path) { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } void object_destroyed(const string& path) @@ -127,7 +127,7 @@ public: void object_renamed(const string& old_path, const string& new_path) { push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); } - void disconnection(const string& src_port_path, const string& dst_port_path) + void disconnect(const string& src_port_path, const string& dst_port_path) { push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); } void variable_change(const string& path, const string& key, const Raul::Atom& value) diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 34f34933..23b841c0 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -180,7 +180,7 @@ void ClientBroadcaster::send_connection(const SharedPtr<const ConnectionImpl> c) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) - (*i).second->connection(c->src_port()->path(), c->dst_port()->path()); + (*i).second->connect(c->src_port()->path(), c->dst_port()->path()); } @@ -188,7 +188,7 @@ void ClientBroadcaster::send_disconnection(const string& src_port_path, const string& dst_port_path) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) - (*i).second->disconnection(src_port_path, dst_port_path); + (*i).second->disconnect(src_port_path, dst_port_path); } diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 3b853571..2139a49a 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -426,7 +426,7 @@ OSCClientSender::patch_polyphony(const std::string& patch_path, uint32_t poly) * \arg \b dst-path (string) - Path of the destination port</p> \n \n */ void -OSCClientSender::connection(const std::string& src_port_path, const std::string& dst_port_path) +OSCClientSender::connect(const std::string& src_port_path, const std::string& dst_port_path) { send("/ingen/new_connection", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END); } @@ -438,7 +438,7 @@ OSCClientSender::connection(const std::string& src_port_path, const std::string& * \arg \b dst-path (string) - Path of the destination port</p> \n \n */ void -OSCClientSender::disconnection(const std::string& src_port_path, const std::string& dst_port_path) +OSCClientSender::disconnect(const std::string& src_port_path, const std::string& dst_port_path) { send("/ingen/disconnection", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END); } diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp index cd2264df..d102790d 100644 --- a/src/libs/engine/OSCClientSender.hpp +++ b/src/libs/engine/OSCClientSender.hpp @@ -109,11 +109,11 @@ public: virtual void object_renamed(const std::string& old_path, const std::string& new_path); - virtual void connection(const std::string& src_port_path, - const std::string& dst_port_path); + virtual void connect(const std::string& src_port_path, + const std::string& dst_port_path); - virtual void disconnection(const std::string& src_port_path, - const std::string& dst_port_path); + virtual void disconnect(const std::string& src_port_path, + const std::string& dst_port_path); virtual void variable_change(const std::string& subject_path, const std::string& predicate, diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index ca035a7f..5c1318cd 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -86,7 +86,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t lo_server_add_method(_server, "/ingen/load_plugins", "i", load_plugins_cb, this); lo_server_add_method(_server, "/ingen/activate", "i", engine_activate_cb, this); lo_server_add_method(_server, "/ingen/deactivate", "i", engine_deactivate_cb, this); - lo_server_add_method(_server, "/ingen/create_patch", "isi", create_patch_cb, this); + lo_server_add_method(_server, "/ingen/new_patch", "isi", new_patch_cb, this); lo_server_add_method(_server, "/ingen/enable_patch", "is", enable_patch_cb, this); lo_server_add_method(_server, "/ingen/disable_patch", "is", disable_patch_cb, this); lo_server_add_method(_server, "/ingen/clear_patch", "is", clear_patch_cb, this); @@ -373,18 +373,18 @@ OSCEngineReceiver::_engine_deactivate_cb(const char* path, const char* types, lo /** \page engine_osc_namespace - * <p> \b /ingen/create_patch - Creates a new, empty, toplevel patch. + * <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::_create_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +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; - create_patch(patch_path, poly); + new_patch(patch_path, poly); return 0; } diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp index a998054f..006192bf 100644 --- a/src/libs/engine/OSCEngineReceiver.hpp +++ b/src/libs/engine/OSCEngineReceiver.hpp @@ -93,7 +93,7 @@ private: LO_HANDLER(load_plugins); LO_HANDLER(engine_activate); LO_HANDLER(engine_deactivate); - LO_HANDLER(create_patch); + LO_HANDLER(new_patch); LO_HANDLER(rename); LO_HANDLER(create_port); LO_HANDLER(create_node); diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 67bd41d2..47312226 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -69,7 +69,7 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r // Send connections for (PatchImpl::Connections::const_iterator j = patch->connections().begin(); j != patch->connections().end(); ++j) - client->connection((*j)->src_port_path(), (*j)->dst_port_path()); + client->connect((*j)->src_port_path(), (*j)->dst_port_path()); } } diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 988093aa..3aa96aee 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -138,8 +138,8 @@ QueuedEngineInterface::bundle_end() // Object commands void -QueuedEngineInterface::create_patch(const string& path, - uint32_t poly) +QueuedEngineInterface::new_patch(const string& path, + uint32_t poly) { push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly)); } diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp index adf6d263..e8a8669d 100644 --- a/src/libs/engine/QueuedEngineInterface.hpp +++ b/src/libs/engine/QueuedEngineInterface.hpp @@ -81,8 +81,8 @@ public: // Object commands - virtual void create_patch(const string& path, - uint32_t poly); + virtual void new_patch(const string& path, + uint32_t poly); virtual void create_port(const string& path, const string& data_type, diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp index e33c9f2e..90e6c911 100644 --- a/src/libs/gui/NewSubpatchWindow.cpp +++ b/src/libs/gui/NewSubpatchWindow.cpp @@ -92,7 +92,7 @@ NewSubpatchWindow::ok_clicked() const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text()); const uint32_t poly = _poly_spinbutton->get_value_as_int(); - App::instance().engine()->create_patch(path, poly); + App::instance().engine()->new_patch(path, poly); for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) App::instance().engine()->set_variable(path, i->first, i->second); diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp index 94c517a8..c2ba9307 100644 --- a/src/libs/gui/ThreadedLoader.cpp +++ b/src/libs/gui/ThreadedLoader.cpp @@ -19,6 +19,7 @@ #include <string> #include "module/global.hpp" #include "module/World.hpp" +#include "module/Module.hpp" #include "client/PatchModel.hpp" #include "App.hpp" #include "ThreadedLoader.hpp" @@ -34,9 +35,15 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine) , _deprecated_loader(engine) { set_name("Loader"); - + // FIXME: rework this so the thread is only present when it's doing something (save mem) - if (App::instance().world()->serialisation_module) { + // and module isn't loaded until required + + World* world = App::instance().world(); + if (!world->serialisation_module) + world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); + + if (world->serialisation_module) { Loader* (*new_loader)() = NULL; bool found = App::instance().world()->serialisation_module->get_symbol( diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp index 0bfed964..c9b01bf8 100644 --- a/src/libs/serialisation/Loader.cpp +++ b/src/libs/serialisation/Loader.cpp @@ -112,7 +112,7 @@ Loader::load(Ingen::Shared::World* world, cout << " as " << patch_path << endl; if (patch_path != "/") - world->engine->create_patch(patch_path, patch_poly); + world->engine->new_patch(patch_path, patch_poly); /* Set document metadata (so File->Save doesn't prompt) * FIXME: This needs some thinking for multiple clients... */ |