diff options
author | David Robillard <d@drobilla.net> | 2012-03-12 06:59:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-12 06:59:48 +0000 |
commit | 81e9fb3245bd461ebfee4cfa16d1792e48533f9e (patch) | |
tree | eb1b30d79cba70dda9d832100dd7c14b08085b03 /src/shared | |
parent | e9d9569271ee962c09ab66c6babed1ca5655a6c6 (diff) | |
download | ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.gz ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.bz2 ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.zip |
Centralise atom creation in forge object.
Aside from being more greppable and making realtime violations more obvious, this is a step towards using LV2 atoms internally (which needs a factory since the type numbers are dynamic).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4054 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/Builder.cpp | 5 | ||||
-rw-r--r-- | src/shared/Configuration.cpp | 37 | ||||
-rw-r--r-- | src/shared/LV2Atom.cpp | 13 | ||||
-rw-r--r-- | src/shared/URIs.cpp | 5 | ||||
-rw-r--r-- | src/shared/World.cpp | 8 |
5 files changed, 39 insertions, 29 deletions
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index fff40f3f..3672e388 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -47,8 +47,9 @@ Builder::build(SharedPtr<const GraphObject> object) if (patch) { if (!object->path().is_root()) { Resource::Properties props; - props.insert(make_pair(uris.rdf_type, uris.ingen_Patch)); - props.insert(make_pair(uris.ingen_polyphony, Atom(int32_t(patch->internal_poly())))); + props.insert(make_pair(uris.rdf_type, uris.ingen_Patch)); + props.insert(make_pair(uris.ingen_polyphony, + _uris->forge.make(int32_t(patch->internal_poly())))); _interface.put(object->path(), props); } diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp index d2d1e9dc..300c7f1d 100644 --- a/src/shared/Configuration.cpp +++ b/src/shared/Configuration.cpp @@ -15,8 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "raul/Atom.hpp" - #include "ingen/shared/Configuration.hpp" using namespace Raul; @@ -24,8 +22,9 @@ using namespace Raul; namespace Ingen { namespace Shared { -Configuration::Configuration() - : Raul::Configuration("A realtime modular audio processor.", +Configuration::Configuration(Raul::Forge* forge) + : Raul::Configuration(forge, + "A realtime modular audio processor.", "Ingen is a flexible modular system that be used in various ways.\n" "The engine can run as a stand-alone server controlled via a network protocol\n" "(e.g. OSC), or internal to another process (e.g. the GUI). The GUI, or other\n" @@ -38,21 +37,21 @@ Configuration::Configuration() " ingen -eg patch.ttl # Run an engine and a GUI and load a patch file\n" " ingen -eg patch.ingen # Run an engine and a GUI and load a patch bundle") { - add("client-port", 'C', "Client OSC port", Atom::INT, Atom()) - .add("connect", 'c', "Connect to engine URI", Atom::STRING, "osc.udp://localhost:16180") - .add("engine", 'e', "Run (JACK) engine", Atom::BOOL, false) - .add("engine-port", 'E', "Engine listen port", Atom::INT, 16180) - .add("gui", 'g', "Launch the GTK graphical interface", Atom::BOOL, false) - .add("help", 'h', "Print this help message", Atom::BOOL, false) - .add("jack-client", 'n', "JACK client name", Atom::STRING, "ingen") - .add("jack-server", 's', "JACK server name", Atom::STRING, "") - .add("uuid", 'u', "JACK session UUID", Atom::STRING, "") - .add("load", 'l', "Load patch", Atom::STRING, Atom()) - .add("packet-size", 'k', "Maximum UDP packet size", Atom::INT, 4096) - .add("parallelism", 'p', "Number of concurrent process threads", Atom::INT, 1) - .add("path", 'L', "Target path for loaded patch", Atom::STRING, Atom()) - .add("queue-size", 'q', "Event queue size", Atom::INT, 4096) - .add("run", 'r', "Run script", Atom::STRING, Atom()); + add("client-port", 'C', "Client OSC port", Atom::INT, forge->make()); + add("connect", 'c', "Connect to engine URI", Atom::STRING, forge->make("osc.udp://localhost:16180")); + add("engine", 'e', "Run (JACK) engine", Atom::BOOL, forge->make(false)); + add("engine-port", 'E', "Engine listen port", Atom::INT, forge->make(16180)); + add("gui", 'g', "Launch the GTK graphical interface", Atom::BOOL, forge->make(false)); + add("help", 'h', "Print this help message", Atom::BOOL, forge->make(false)); + add("jack-client", 'n', "JACK client name", Atom::STRING, forge->make("ingen")); + add("jack-server", 's', "JACK server name", Atom::STRING, forge->make("")); + add("uuid", 'u', "JACK session UUID", Atom::STRING, forge->make("")); + add("load", 'l', "Load patch", Atom::STRING, forge->make()); + add("packet-size", 'k', "Maximum UDP packet size", Atom::INT, forge->make(4096)); + add("parallelism", 'p', "Number of concurrent process threads", Atom::INT, forge->make(1)); + add("path", 'L', "Target path for loaded patch", Atom::STRING, forge->make()); + add("queue-size", 'q', "Event queue size", Atom::INT, forge->make(4096)); + add("run", 'r', "Run script", Atom::STRING, forge->make()); } } // namespace Shared diff --git a/src/shared/LV2Atom.cpp b/src/shared/LV2Atom.cpp index 931ed9ab..991c4f7c 100644 --- a/src/shared/LV2Atom.cpp +++ b/src/shared/LV2Atom.cpp @@ -31,19 +31,22 @@ namespace Shared { namespace LV2Atom { bool -to_atom(const Shared::URIs& uris, const LV2_Atom* object, Raul::Atom& atom) +to_atom(Raul::Forge* forge, + const Shared::URIs& uris, + const LV2_Atom* object, + Raul::Atom& atom) { if (object->type == uris.atom_String.id) { - atom = Raul::Atom((char*)(object + 1)); + atom = forge->make((char*)(object + 1)); return true; } else if (object->type == uris.atom_Bool.id) { - atom = Raul::Atom((bool)(int32_t*)(object + 1)); + atom = forge->make((bool)(int32_t*)(object + 1)); return true; } else if (object->type == uris.atom_Int32.id) { - atom = Raul::Atom((int32_t*)(object + 1)); + atom = forge->make((int32_t*)(object + 1)); return true; } else if (object->type == uris.atom_Float.id) { - atom = Raul::Atom((float*)(object + 1)); + atom = forge->make((float*)(object + 1)); return true; } return false; diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp index 8c40705f..bb2142e1 100644 --- a/src/shared/URIs.cpp +++ b/src/shared/URIs.cpp @@ -53,8 +53,9 @@ URIs::Quark::c_str() const #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" -URIs::URIs() - : atom_Bool (LV2_ATOM__Bool) +URIs::URIs(Raul::Forge& f) + : forge(f) + , atom_Bool (LV2_ATOM__Bool) , atom_Float (LV2_ATOM__Float) , atom_Int32 (LV2_ATOM__Int32) , atom_MessagePort (LV2_ATOM__MessagePort) diff --git a/src/shared/World.cpp b/src/shared/World.cpp index 59207939..cf21cd44 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -23,6 +23,7 @@ #include "lilv/lilv.h" #include "raul/log.hpp" +#include "raul/Atom.hpp" #include "sord/sordmm.hpp" #include "ingen/EngineBase.hpp" @@ -102,8 +103,9 @@ public: , argv(a_argv) , conf(conf) , lv2_features(NULL) + , forge(new Raul::Forge()) , rdf_world(new Sord::World()) - , uris(new Shared::URIs()) + , uris(new Shared::URIs(*forge)) , lv2_uri_map(new Ingen::Shared::LV2URIMap(*uris.get())) , lilv_world(lilv_world_new()) { @@ -144,6 +146,8 @@ public: delete lv2_features; lv2_features = NULL; + delete forge; + uris.reset(); } @@ -161,6 +165,7 @@ public: char**& argv; Raul::Configuration* conf; LV2Features* lv2_features; + Raul::Forge* forge; Sord::World* rdf_world; SharedPtr<URIs> uris; SharedPtr<LV2URIMap> lv2_uri_map; @@ -199,6 +204,7 @@ SharedPtr<Serialisation::Serialiser> World::serialiser() { return _impl->seria SharedPtr<Serialisation::Parser> World::parser() { return _impl->parser; } SharedPtr<Store> World::store() { return _impl->store; } Raul::Configuration* World::conf() { return _impl->conf; } +Raul::Forge& World::forge() { return *_impl->forge; } LV2Features* World::lv2_features() { return _impl->lv2_features; } LilvWorld* World::lilv_world() { return _impl->lilv_world; } |