Changeset 2533
- Timestamp:
- 03/06/10 02:23:19 (6 months ago)
- Location:
- trunk
- Files:
-
- 118 modified
-
ingen/src/bindings/ingen_bindings.cpp (modified) (1 diff)
-
ingen/src/client/ClientStore.cpp (modified) (5 diffs)
-
ingen/src/client/ClientStore.hpp (modified) (3 diffs)
-
ingen/src/client/DeprecatedLoader.cpp (modified) (10 diffs)
-
ingen/src/client/DeprecatedLoader.hpp (modified) (3 diffs)
-
ingen/src/client/HTTPClientReceiver.cpp (modified) (4 diffs)
-
ingen/src/client/HTTPEngineSender.cpp (modified) (1 diff)
-
ingen/src/client/HTTPEngineSender.hpp (modified) (1 diff)
-
ingen/src/client/NodeModel.cpp (modified) (4 diffs)
-
ingen/src/client/NodeModel.hpp (modified) (3 diffs)
-
ingen/src/client/ObjectModel.cpp (modified) (2 diffs)
-
ingen/src/client/ObjectModel.hpp (modified) (3 diffs)
-
ingen/src/client/PatchModel.cpp (modified) (3 diffs)
-
ingen/src/client/PatchModel.hpp (modified) (1 diff)
-
ingen/src/client/PluginModel.cpp (modified) (2 diffs)
-
ingen/src/client/PluginModel.hpp (modified) (2 diffs)
-
ingen/src/client/PluginUI.cpp (modified) (6 diffs)
-
ingen/src/client/PortModel.cpp (modified) (4 diffs)
-
ingen/src/client/PortModel.hpp (modified) (2 diffs)
-
ingen/src/common/interface/Node.hpp (modified) (1 diff)
-
ingen/src/engine/BufferFactory.cpp (modified) (3 diffs)
-
ingen/src/engine/BufferFactory.hpp (modified) (4 diffs)
-
ingen/src/engine/ClientBroadcaster.hpp (modified) (1 diff)
-
ingen/src/engine/ConnectionImpl.cpp (modified) (1 diff)
-
ingen/src/engine/Context.hpp (modified) (1 diff)
-
ingen/src/engine/ControlBindings.cpp (modified) (11 diffs)
-
ingen/src/engine/ControlBindings.hpp (modified) (2 diffs)
-
ingen/src/engine/Driver.hpp (modified) (2 diffs)
-
ingen/src/engine/DuplexPort.cpp (modified) (1 diff)
-
ingen/src/engine/Engine.cpp (modified) (6 diffs)
-
ingen/src/engine/Engine.hpp (modified) (3 diffs)
-
ingen/src/engine/EventSource.cpp (modified) (1 diff)
-
ingen/src/engine/events/CreateNode.cpp (modified) (1 diff)
-
ingen/src/engine/events/CreatePatch.cpp (modified) (1 diff)
-
ingen/src/engine/events/CreatePort.cpp (modified) (1 diff)
-
ingen/src/engine/events/Delete.cpp (modified) (3 diffs)
-
ingen/src/engine/events/Delete.hpp (modified) (1 diff)
-
ingen/src/engine/events/RequestMetadata.cpp (modified) (3 diffs)
-
ingen/src/engine/events/SendBinding.cpp (modified) (1 diff)
-
ingen/src/engine/events/SendPortValue.cpp (modified) (1 diff)
-
ingen/src/engine/events/SetMetadata.cpp (modified) (2 diffs)
-
ingen/src/engine/events/SetPortValue.cpp (modified) (6 diffs)
-
ingen/src/engine/GraphObjectImpl.cpp (modified) (1 diff)
-
ingen/src/engine/GraphObjectImpl.hpp (modified) (2 diffs)
-
ingen/src/engine/HTTPClientSender.cpp (modified) (2 diffs)
-
ingen/src/engine/HTTPEngineReceiver.cpp (modified) (5 diffs)
-
ingen/src/engine/InputPort.cpp (modified) (3 diffs)
-
ingen/src/engine/InternalPlugin.cpp (modified) (2 diffs)
-
ingen/src/engine/InternalPlugin.hpp (modified) (2 diffs)
-
ingen/src/engine/ingen_engine.cpp (modified) (1 diff)
-
ingen/src/engine/ingen_http.cpp (modified) (1 diff)
-
ingen/src/engine/ingen_jack.cpp (modified) (1 diff)
-
ingen/src/engine/ingen_lv2.cpp (modified) (6 diffs)
-
ingen/src/engine/ingen_osc.cpp (modified) (1 diff)
-
ingen/src/engine/internals/Controller.cpp (modified) (1 diff)
-
ingen/src/engine/internals/Controller.hpp (modified) (2 diffs)
-
ingen/src/engine/internals/Delay.cpp (modified) (2 diffs)
-
ingen/src/engine/internals/Delay.hpp (modified) (2 diffs)
-
ingen/src/engine/internals/Note.cpp (modified) (1 diff)
-
ingen/src/engine/internals/Note.hpp (modified) (2 diffs)
-
ingen/src/engine/internals/Trigger.cpp (modified) (1 diff)
-
ingen/src/engine/internals/Trigger.hpp (modified) (2 diffs)
-
ingen/src/engine/JackDriver.cpp (modified) (3 diffs)
-
ingen/src/engine/JackDriver.hpp (modified) (1 diff)
-
ingen/src/engine/LADSPANode.cpp (modified) (1 diff)
-
ingen/src/engine/LADSPAPlugin.cpp (modified) (3 diffs)
-
ingen/src/engine/LADSPAPlugin.hpp (modified) (1 diff)
-
ingen/src/engine/LV2Info.cpp (modified) (1 diff)
-
ingen/src/engine/LV2Info.hpp (modified) (1 diff)
-
ingen/src/engine/LV2Node.cpp (modified) (3 diffs)
-
ingen/src/engine/LV2Plugin.cpp (modified) (2 diffs)
-
ingen/src/engine/MessageContext.cpp (modified) (2 diffs)
-
ingen/src/engine/NodeFactory.cpp (modified) (7 diffs)
-
ingen/src/engine/NodeImpl.cpp (modified) (1 diff)
-
ingen/src/engine/ObjectSender.cpp (modified) (1 diff)
-
ingen/src/engine/OutputPort.cpp (modified) (1 diff)
-
ingen/src/engine/PatchImpl.cpp (modified) (3 diffs)
-
ingen/src/engine/PatchPlugin.hpp (modified) (1 diff)
-
ingen/src/engine/PluginImpl.hpp (modified) (2 diffs)
-
ingen/src/engine/PortImpl.cpp (modified) (5 diffs)
-
ingen/src/engine/PortImpl.hpp (modified) (1 diff)
-
ingen/src/engine/QueuedEngineInterface.cpp (modified) (1 diff)
-
ingen/src/engine/ThreadManager.hpp (modified) (1 diff)
-
ingen/src/engine/wscript (modified) (2 diffs)
-
ingen/src/gui/App.cpp (modified) (7 diffs)
-
ingen/src/gui/App.hpp (modified) (2 diffs)
-
ingen/src/gui/ConnectWindow.cpp (modified) (8 diffs)
-
ingen/src/gui/LoadRemotePatchWindow.cpp (modified) (2 diffs)
-
ingen/src/gui/NodeModule.cpp (modified) (1 diff)
-
ingen/src/gui/PatchCanvas.cpp (modified) (1 diff)
-
ingen/src/gui/Port.cpp (modified) (2 diffs)
-
ingen/src/gui/PropertiesWindow.cpp (modified) (3 diffs)
-
ingen/src/gui/ThreadedLoader.cpp (modified) (4 diffs)
-
ingen/src/gui/ThreadedLoader.hpp (modified) (1 diff)
-
ingen/src/ingen/main.cpp (modified) (12 diffs)
-
ingen/src/module/ingen_module.cpp (modified) (1 diff)
-
ingen/src/module/ingen_module.hpp (modified) (1 diff)
-
ingen/src/module/World.cpp (modified) (7 diffs)
-
ingen/src/module/World.hpp (modified) (3 diffs)
-
ingen/src/serialisation/Parser.cpp (modified) (29 diffs)
-
ingen/src/serialisation/Parser.hpp (modified) (2 diffs)
-
ingen/src/serialisation/Serialiser.cpp (modified) (10 diffs)
-
ingen/src/serialisation/serialisation.cpp (modified) (1 diff)
-
ingen/src/shared/Builder.cpp (modified) (2 diffs)
-
ingen/src/shared/Builder.hpp (modified) (3 diffs)
-
ingen/src/shared/LV2Features.cpp (modified) (1 diff)
-
ingen/src/shared/LV2Object.cpp (modified) (2 diffs)
-
ingen/src/shared/LV2Object.hpp (modified) (1 diff)
-
ingen/src/shared/LV2URIMap.cpp (modified) (4 diffs)
-
ingen/src/shared/LV2URIMap.hpp (modified) (2 diffs)
-
ingen/src/shared/ResourceImpl.cpp (modified) (4 diffs)
-
ingen/src/shared/ResourceImpl.hpp (modified) (4 diffs)
-
ingen/src/shared/runtime_paths.cpp (modified) (3 diffs)
-
ingen/src/shared/runtime_paths.hpp (modified) (1 diff)
-
ingen/src/shared/wscript (modified) (1 diff)
-
raul/raul/Thread.hpp (modified) (3 diffs)
-
raul/src/Thread.cpp (modified) (2 diffs)
-
raul/wscript (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ingen/src/bindings/ingen_bindings.cpp
r2349 r2533 44 44 script_iteration(Ingen::Shared::World* world) 45 45 { 46 if (world->local_engine )47 world->local_engine ->main_iteration();46 if (world->local_engine()) 47 world->local_engine()->main_iteration(); 48 48 } 49 49 -
trunk/ingen/src/client/ClientStore.cpp
r2514 r2533 38 38 39 39 40 ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter) 41 : _engine(engine) 40 ClientStore::ClientStore(SharedPtr<Shared::LV2URIMap> uris, 41 SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> emitter) 42 : _uris(uris) 43 , _engine(engine) 42 44 , _emitter(emitter) 43 45 , _plugins(new Plugins()) … … 258 260 bool is_meta = ResourceImpl::is_meta_uri(uri); 259 261 260 const LV2URIMap& uris = Shared::LV2URIMap::instance();261 262 262 if (!(is_path || is_meta)) { 263 const Atom& type = properties.find( uris.rdf_type)->second;263 const Atom& type = properties.find(_uris->rdf_type)->second; 264 264 if (type.type() == Atom::URI) { 265 265 const URI& type_uri = type.get_uri(); 266 266 if (Plugin::type_from_uri(type_uri) != Plugin::NIL) { 267 SharedPtr<PluginModel> p(new PluginModel(uri , type_uri, properties));267 SharedPtr<PluginModel> p(new PluginModel(uris(), uri, type_uri, properties)); 268 268 add_plugin(p); 269 269 return; … … 290 290 bool is_patch, is_node, is_port, is_output; 291 291 PortType data_type(PortType::UNKNOWN); 292 ResourceImpl::type( properties, is_patch, is_node, is_port, is_output, data_type);292 ResourceImpl::type(uris(), properties, is_patch, is_node, is_port, is_output, data_type); 293 293 294 294 if (is_patch) { 295 SharedPtr<PatchModel> model(new PatchModel( path));295 SharedPtr<PatchModel> model(new PatchModel(uris(), path)); 296 296 model->set_properties(properties); 297 297 add_object(model); 298 298 } else if (is_node) { 299 const Resource::Properties::const_iterator p = properties.find( uris.rdf_instanceOf);299 const Resource::Properties::const_iterator p = properties.find(_uris->rdf_instanceOf); 300 300 SharedPtr<PluginModel> plug; 301 301 if (p->second.is_valid() && p->second.type() == Atom::URI) { … … 303 303 LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl; 304 304 plug = SharedPtr<PluginModel>( 305 new PluginModel( p->second.get_uri(), uris.ingen_nil, Resource::Properties()));305 new PluginModel(uris(), p->second.get_uri(), _uris->ingen_nil, Resource::Properties())); 306 306 add_plugin(plug); 307 307 } 308 308 309 SharedPtr<NodeModel> n(new NodeModel( plug, path));309 SharedPtr<NodeModel> n(new NodeModel(uris(), plug, path)); 310 310 n->set_properties(properties); 311 311 add_object(n); … … 316 316 if (data_type != PortType::UNKNOWN) { 317 317 PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; 318 const Resource::Properties::const_iterator i = properties.find( uris.lv2_index);318 const Resource::Properties::const_iterator i = properties.find(_uris->lv2_index); 319 319 if (i != properties.end() && i->second.type() == Atom::INT) { 320 SharedPtr<PortModel> p(new PortModel( path, i->second.get_int32(), data_type, pdir));320 SharedPtr<PortModel> p(new PortModel(uris(), path, i->second.get_int32(), data_type, pdir)); 321 321 p->set_properties(properties); 322 322 add_object(p); -
trunk/ingen/src/client/ClientStore.hpp
r2445 r2533 53 53 class ClientStore : public Shared::Store, public Shared::CommonInterface, public sigc::trackable { 54 54 public: 55 ClientStore(SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(), 56 SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); 55 ClientStore(SharedPtr<Shared::LV2URIMap> uris, 56 SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(), 57 SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); 57 58 58 59 SharedPtr<PluginModel> plugin(const Raul::URI& uri); … … 66 67 SharedPtr<Plugins> plugins() { return _plugins; } 67 68 void set_plugins(SharedPtr<Plugins> p) { _plugins = p; } 69 70 Shared::LV2URIMap& uris() { return *_uris.get(); } 68 71 69 72 // CommonInterface … … 100 103 bool attempt_connection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); 101 104 105 SharedPtr<Shared::LV2URIMap> _uris; 102 106 SharedPtr<Shared::EngineInterface> _engine; 103 107 SharedPtr<SigClientInterface> _emitter; -
trunk/ingen/src/client/DeprecatedLoader.cpp
r2518 r2533 213 213 size_t poly = 0; 214 214 215 const LV2URIMap& uris = Shared::LV2URIMap::instance();216 217 215 /* Use parameter overridden polyphony, if given */ 218 GraphObject::Properties::iterator poly_param = initial_data.find( uris.ingen_polyphony);216 GraphObject::Properties::iterator poly_param = initial_data.find(_uris->ingen_polyphony); 219 217 if (poly_param != initial_data.end() && poly_param->second.type() == Atom::INT) 220 218 poly = poly_param->second.get_int32(); 221 219 222 if (initial_data.find( uris.ingen_document) == initial_data.end())223 initial_data.insert(make_pair( uris.ingen_document, filename));220 if (initial_data.find(_uris->ingen_document) == initial_data.end()) 221 initial_data.insert(make_pair(_uris->ingen_document, filename)); 224 222 225 223 xmlDocPtr doc = xmlParseFile(filename.c_str()); … … 285 283 if (!existing && !path.is_root()) { 286 284 Resource::Properties props; 287 props.insert(make_pair( uris.rdf_type, uris.ingen_Patch));288 props.insert(make_pair( uris.ingen_polyphony, Atom((int32_t)poly)));285 props.insert(make_pair(_uris->rdf_type, _uris->ingen_Patch)); 286 props.insert(make_pair(_uris->ingen_polyphony, Atom((int32_t)poly))); 289 287 _engine->put(path, props); 290 288 for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) … … 331 329 const float value = i->value(); 332 330 _engine->set_property(translate_load_path(i->port_path().str()), 333 uris.ingen_value, Atom(value));331 _uris->ingen_value, Atom(value)); 334 332 } 335 333 } else { … … 348 346 349 347 if (!existing) 350 _engine->set_property(path, uris.ingen_enabled, (bool)true);348 _engine->set_property(path, _uris->ingen_enabled, (bool)true); 351 349 352 350 _load_path_translations.clear(); … … 440 438 } 441 439 442 const LV2URIMap& uris = Shared::LV2URIMap::instance();443 444 440 // Compatibility hacks for old patches that represent patch ports as nodes 445 441 if (plugin_uri.empty()) { … … 451 447 is_port = true; 452 448 if (plugin_label == "audio_input") { 453 props.insert(make_pair( uris.rdf_type, uris.lv2_AudioPort));454 props.insert(make_pair( uris.rdf_type, uris.lv2_InputPort));449 props.insert(make_pair(_uris->rdf_type, _uris->lv2_AudioPort)); 450 props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); 455 451 } else if (plugin_label == "audio_output") { 456 props.insert(make_pair( uris.rdf_type, uris.lv2_AudioPort));457 props.insert(make_pair( uris.rdf_type, uris.lv2_OutputPort));452 props.insert(make_pair(_uris->rdf_type, _uris->lv2_AudioPort)); 453 props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); 458 454 } else if (plugin_label == "control_input") { 459 props.insert(make_pair( uris.rdf_type, uris.lv2_ControlPort));460 props.insert(make_pair( uris.rdf_type, uris.lv2_InputPort));455 props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort)); 456 props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); 461 457 } else if (plugin_label == "control_output" ) { 462 props.insert(make_pair( uris.rdf_type, uris.lv2_ControlPort));463 props.insert(make_pair( uris.rdf_type, uris.lv2_OutputPort));458 props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort)); 459 props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); 464 460 } else if (plugin_label == "midi_input") { 465 props.insert(make_pair( uris.rdf_type, uris.lv2ev_EventPort));466 props.insert(make_pair( uris.rdf_type, uris.lv2_InputPort));461 props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort)); 462 props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); 467 463 } else if (plugin_label == "midi_output" ) { 468 props.insert(make_pair( uris.rdf_type, uris.lv2ev_EventPort));469 props.insert(make_pair( uris.rdf_type, uris.lv2_OutputPort));464 props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort)); 465 props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); 470 466 } else { 471 467 is_port = false; … … 524 520 525 521 Resource::Properties props; 526 props.insert(make_pair( uris.rdf_type, uris.ingen_Node));527 props.insert(make_pair( uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri)));522 props.insert(make_pair(_uris->rdf_type, _uris->ingen_Node)); 523 props.insert(make_pair(_uris->rdf_instanceOf, Atom(Atom::URI, plugin_uri))); 528 524 _engine->put(path, props); 529 525 530 _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic));526 _engine->set_property(path, _uris->ingen_polyphonic, bool(polyphonic)); 531 527 532 528 for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) … … 539 535 } else { 540 536 Resource::Properties props; 541 props.insert(make_pair( uris.rdf_type, uris.ingen_Node));542 props.insert(make_pair( uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri)));537 props.insert(make_pair(_uris->rdf_type, _uris->ingen_Node)); 538 props.insert(make_pair(_uris->rdf_instanceOf, Atom(Atom::URI, plugin_uri))); 543 539 _engine->put(path, props); 544 _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic));540 _engine->set_property(path, _uris->ingen_polyphonic, bool(polyphonic)); 545 541 for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) 546 542 _engine->set_property(path, i->first, i->second); … … 563 559 564 560 GraphObject::Properties initial_data; 565 const LV2URIMap& uris = Shared::LV2URIMap::instance();566 567 561 while (cur != NULL) { 568 562 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); … … 571 565 name = (const char*)key; 572 566 } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { 573 initial_data.insert(make_pair( uris.ingen_polyphony, (int)poly));567 initial_data.insert(make_pair(_uris->ingen_polyphony, (int)poly)); 574 568 } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) { 575 569 filename = Glib::build_filename(base_filename, (const char*)key); -
trunk/ingen/src/client/DeprecatedLoader.hpp
r2428 r2533 34 34 35 35 namespace Ingen { 36 37 namespace Shared { class LV2URIMap; } 38 36 39 namespace Client { 37 40 … … 46 49 { 47 50 public: 48 DeprecatedLoader(SharedPtr<Shared::EngineInterface> engine) 49 : _engine(engine) 51 DeprecatedLoader( 52 SharedPtr<Shared::LV2URIMap> uris, 53 SharedPtr<Shared::EngineInterface> engine) 54 : _uris(uris) 55 , _engine(engine) 50 56 { 51 57 assert(_engine); … … 65 71 std::string translate_load_path(const std::string& path); 66 72 73 SharedPtr<Shared::LV2URIMap> _uris; 67 74 SharedPtr<Shared::EngineInterface> _engine; 68 75 -
trunk/ingen/src/client/HTTPClientReceiver.cpp
r2484 r2533 134 134 HTTPClientReceiver::update(const std::string& str) 135 135 { 136 LOG(info) << _world->parser ->parse_update(_world, _target.get(), str, _url);136 LOG(info) << _world->parser()->parse_update(_world, _target.get(), str, _url); 137 137 } 138 138 … … 189 189 Glib::Mutex::Lock lock(me->_mutex); 190 190 me->_target->response_ok(0); 191 me->_world->parser ->parse_string(me->_world, me->_target.get(),191 me->_world->parser()->parse_string(me->_world, me->_target.get(), 192 192 Glib::ustring(msg->response_body->data), me->_url); 193 193 } … … 199 199 Glib::Mutex::Lock lock(me->_mutex); 200 200 me->_target->response_ok(0); 201 me->_world->parser ->parse_string(me->_world, me->_target.get(),201 me->_world->parser()->parse_string(me->_world, me->_target.get(), 202 202 Glib::ustring(msg->response_body->data), 203 203 Glib::ustring("/patch/")); … … 227 227 HTTPClientReceiver::start(bool dump) 228 228 { 229 Glib::Mutex::Lock lock(_world->rdf_world ->mutex());230 231 if (!_world->parser )229 Glib::Mutex::Lock lock(_world->rdf_world()->mutex()); 230 231 if (!_world->parser()) 232 232 _world->load("ingen_serialisation"); 233 233 -
trunk/ingen/src/client/HTTPEngineSender.cpp
r2504 r2533 34 34 35 35 36 HTTPEngineSender::HTTPEngineSender( constWorld* world, const URI& engine_url)37 : _world(*world->rdf_world )36 HTTPEngineSender::HTTPEngineSender(World* world, const URI& engine_url) 37 : _world(*world->rdf_world()) 38 38 , _engine_url(engine_url) 39 39 , _id(0) -
trunk/ingen/src/client/HTTPEngineSender.hpp
r2504 r2533 44 44 { 45 45 public: 46 HTTPEngineSender( constShared::World* world, const Raul::URI& engine_url);46 HTTPEngineSender(Shared::World* world, const Raul::URI& engine_url); 47 47 ~HTTPEngineSender(); 48 48 -
trunk/ingen/src/client/NodeModel.cpp
r2409 r2533 31 31 32 32 33 NodeModel::NodeModel(Shared Ptr<PluginModel> plugin, const Path& path)34 : ObjectModel( path)33 NodeModel::NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, const Path& path) 34 : ObjectModel(uris, path) 35 35 , _plugin_uri(plugin->uri()) 36 36 , _plugin(plugin) … … 41 41 } 42 42 43 NodeModel::NodeModel( const URI& plugin_uri, const Path& path)44 : ObjectModel( path)43 NodeModel::NodeModel(Shared::LV2URIMap& uris, const URI& plugin_uri, const Path& path) 44 : ObjectModel(uris, path) 45 45 , _plugin_uri(plugin_uri) 46 46 , _num_values(0) … … 207 207 NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) const 208 208 { 209 const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();210 209 assert(port->parent().get() == this); 211 210 … … 213 212 214 213 // Possibly overriden 215 const Atom& min_atom = port->get_property( uris.lv2_minimum);216 const Atom& max_atom = port->get_property( uris.lv2_maximum);214 const Atom& min_atom = port->get_property(_uris.lv2_minimum); 215 const Atom& max_atom = port->get_property(_uris.lv2_maximum); 217 216 if (min_atom.type() == Atom::FLOAT) 218 217 min = min_atom.get_float(); -
trunk/ingen/src/client/NodeModel.hpp
r2408 r2533 33 33 34 34 namespace Ingen { 35 36 namespace Shared { class LV2URIMap; } 37 35 38 namespace Client { 36 39 … … 72 75 friend class ClientStore; 73 76 74 NodeModel( const Raul::URI& plugin_uri, const Raul::Path& path);75 NodeModel(Shared Ptr<PluginModel> plugin, const Raul::Path& path);77 NodeModel(Shared::LV2URIMap& uris, const Raul::URI& plugin_uri, const Raul::Path& path); 78 NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, const Raul::Path& path); 76 79 77 80 NodeModel(const Raul::Path& path); … … 87 90 virtual void clear(); 88 91 89 Ports _ports; ///< Vector of ports (not a Table to preserve order)90 Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown)91 SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of92 Ports _ports; ///< Vector of ports (not a Table to preserve order) 93 Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) 94 SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of 92 95 93 96 private: 94 mutable uint32_t _num_values; ///< Size of _min_values and _max_values95 mutable float* _min_values; ///< Port min values (cached for LV2)96 mutable float* _max_values; ///< Port max values (cached for LV2)97 mutable uint32_t _num_values; ///< Size of _min_values and _max_values 98 mutable float* _min_values; ///< Port min values (cached for LV2) 99 mutable float* _max_values; ///< Port max values (cached for LV2) 97 100 }; 98 101 -
trunk/ingen/src/client/ObjectModel.cpp
r2514 r2533 28 28 29 29 30 ObjectModel::ObjectModel( constPath& path)31 : ResourceImpl( path)32 , _meta( ResourceImpl::meta_uri(path))30 ObjectModel::ObjectModel(Shared::LV2URIMap& uris, const Raul::Path& path) 31 : ResourceImpl(uris, path) 32 , _meta(uris, ResourceImpl::meta_uri(path)) 33 33 , _path(path) 34 34 , _symbol((path == Path::root()) ? "root" : path.symbol()) … … 77 77 ObjectModel::polyphonic() const 78 78 { 79 const Raul::Atom& polyphonic = get_property( Shared::LV2URIMap::instance().ingen_polyphonic);79 const Raul::Atom& polyphonic = get_property(_uris.ingen_polyphonic); 80 80 return (polyphonic.is_valid() && polyphonic.get_bool()); 81 81 } -
trunk/ingen/src/client/ObjectModel.hpp
r2408 r2533 32 32 33 33 namespace Ingen { 34 35 namespace Shared { class LV2URIMap; } 36 34 37 namespace Client { 35 38 … … 80 83 friend class ClientStore; 81 84 82 ObjectModel( const Raul::Path& path);85 ObjectModel(Shared::LV2URIMap& uris, const Raul::Path& path); 83 86 84 87 virtual void set_path(const Raul::Path& p); … … 90 93 91 94 ResourceImpl _meta; 92 93 95 SharedPtr<ObjectModel> _parent; 94 96 95 97 private: 96 Raul::Path _path;97 Raul::Symbol _symbol;98 Raul::Path _path; 99 Raul::Symbol _symbol; 98 100 }; 99 101 -
trunk/ingen/src/client/PatchModel.cpp
r2491 r2533 161 161 PatchModel::enabled() const 162 162 { 163 const Raul::Atom& enabled = get_property( Shared::LV2URIMap::instance().ingen_enabled);163 const Raul::Atom& enabled = get_property(_uris.ingen_enabled); 164 164 return (enabled.is_valid() && enabled.get_bool()); 165 165 } … … 169 169 PatchModel::internal_poly() const 170 170 { 171 const Raul::Atom& poly = get_property( Shared::LV2URIMap::instance().ingen_polyphony);171 const Raul::Atom& poly = get_property(_uris.ingen_polyphony); 172 172 return poly.is_valid() ? poly.get_int32() : 1; 173 173 } … … 177 177 PatchModel::polyphonic() const 178 178 { 179 const Raul::Atom& poly = get_property( Shared::LV2URIMap::instance().ingen_polyphonic);179 const Raul::Atom& poly = get_property(_uris.ingen_polyphonic); 180 180 return poly.is_valid() && poly.get_bool(); 181 181 } -
trunk/ingen/src/client/PatchModel.hpp
r2491 r2533 77 77 friend class ClientStore; 78 78 79 PatchModel( const Raul::Path& patch_path)80 : NodeModel( "http://drobilla.net/ns/ingen#Patch", patch_path)79 PatchModel(Shared::LV2URIMap& uris, const Raul::Path& patch_path) 80 : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path) 81 81 , _connections(new Connections()) 82 82 , _editable(true) -
trunk/ingen/src/client/PluginModel.cpp
r2420 r2533 41 41 42 42 43 PluginModel::PluginModel(const URI& uri, const URI& type_uri, const Resource::Properties& properties) 44 : ResourceImpl(uri) 43 PluginModel::PluginModel(Shared::LV2URIMap& uris, 44 const URI& uri, const URI& type_uri, const Resource::Properties& properties) 45 : ResourceImpl(uris, uri) 45 46 , _type(type_from_uri(type_uri.str())) 46 47 { … … 70 71 71 72 // No lv2:symbol from data or engine, invent one 72 if (key == Shared::LV2URIMap::instance().lv2_symbol) {73 if (key == _uris.lv2_symbol) { 73 74 const URI& uri = this->uri(); 74 75 size_t last_slash = uri.find_last_of('/'); -
trunk/ingen/src/client/PluginModel.hpp
r2398 r2533 31 31 32 32 namespace Ingen { 33 34 namespace Shared { class LV2URIMap; } 35 33 36 namespace Client { 34 37 … … 47 50 public: 48 51 PluginModel( 52 Shared::LV2URIMap& uris, 49 53 const Raul::URI& uri, 50 54 const Raul::URI& type_uri, -
trunk/ingen/src/client/PluginUI.cpp
r2492 r2533 56 56 SharedPtr<PortModel> port = ui->node()->ports()[port_index]; 57 57 58 SharedPtr<Shared::LV2URIMap> map = ui->world()->uris;58 const Shared::LV2URIMap& uris = *ui->world()->uris().get(); 59 59 60 60 // float (special case, always 0) … … 64 64 return; // do nothing (handle stupid plugin UIs that feed back) 65 65 66 ui->world()->engine ->set_property(port->path(), map->ingen_value, Atom(*(float*)buffer));66 ui->world()->engine()->set_property(port->path(), uris.ingen_value, Atom(*(float*)buffer)); 67 67 68 } else if (format == map->ui_format_events.id) {68 } else if (format == uris.ui_format_events.id) { 69 69 LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer; 70 70 LV2_Event_Iterator iter; … … 73 73 while (lv2_event_is_valid(&iter)) { 74 74 LV2_Event* const ev = lv2_event_get(&iter, &data); 75 if (ev->type == map->midi_event.id) {75 if (ev->type == uris.midi_event.id) { 76 76 // FIXME: bundle multiple events by writing an entire buffer here 77 ui->world()->engine ->set_property(port->path(), map->ingen_value,77 ui->world()->engine()->set_property(port->path(), uris.ingen_value, 78 78 Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size, data)); 79 79 } else { … … 85 85 } 86 86 87 } else if (format == map->object_transfer.id) {87 } else if (format == uris.object_transfer.id) { 88 88 LV2_Object* buf = (LV2_Object*)buffer; 89 89 Raul::Atom val; 90 Shared::LV2Object::to_atom( buf, val);91 ui->world()->engine ->set_property(port->path(), map->ingen_value, val);90 Shared::LV2Object::to_atom(uris, buf, val); 91 ui->world()->engine()->set_property(port->path(), uris.ingen_value, val); 92 92 93 93 } else { … … 123 123 SharedPtr<PluginUI> ret; 124 124 125 SLV2Value gtk_gui_uri = slv2_value_new_uri(world->slv2_world ,125 SLV2Value gtk_gui_uri = slv2_value_new_uri(world->slv2_world(), 126 126 "http://lv2plug.in/ns/extensions/ui#GtkUI"); 127 127 … … 142 142 info << "Found GTK Plugin UI: " << slv2_ui_get_uri(ui) << endl; 143 143 ret = SharedPtr<PluginUI>(new PluginUI(world, node)); 144 ret->_features = world->lv2_features ->lv2_features(node.get());144 ret->_features = world->lv2_features()->lv2_features(node.get()); 145 145 SLV2UIInstance inst = slv2_ui_instantiate( 146 146 plugin, ui, lv2_ui_write, ret.get(), ret->_features->array()); -
trunk/ingen/src/client/PortModel.cpp
r2492 r2533 29 29 { 30 30 Raul::Atom& ret = ObjectModel::set_property(uri, value); 31 if (uri == Shared::LV2URIMap::instance().ingen_value)31 if (uri == _uris.ingen_value) 32 32 this->value(value); 33 33 return ret; … … 38 38 PortModel::supports(const Raul::URI& value_type) const 39 39 { 40 return has_property( Shared::LV2URIMap::instance().obj_supports, value_type);40 return has_property(_uris.obj_supports, value_type); 41 41 } 42 42 … … 45 45 PortModel::port_property(const std::string& uri) const 46 46 { 47 return has_property( Shared::LV2URIMap::instance().lv2_portProperty, Raul::URI(uri));47 return has_property(_uris.lv2_portProperty, Raul::URI(uri)); 48 48 } 49 49 … … 66 66 67 67 68 bool 69 PortModel::has_context(const Raul::URI& uri) 70 { 71 const Raul::Atom& context = get_property(_uris.ctx_context); 72 if (uri == _uris.ctx_AudioContext && !context.is_valid()) 73 return true; 74 else 75 return context == uri; 76 } 77 78 68 79 } // namespace Client 69 80 } // namespace Ingen -
trunk/ingen/src/client/PortModel.hpp
r2492 r2533 59 59 bool is_toggle() const { return port_property("http://lv2plug.in/ns/lv2core#toggled"); } 60 60 61 bool has_context(const Raul::URI& context); 62 61 63 inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); } 62 64 … … 85 87 friend class ClientStore; 86 88 87 PortModel(const Raul::Path& path, uint32_t index, Shared::PortType type, Direction dir) 88 : ObjectModel(path) 89 PortModel(Shared::LV2URIMap& uris, 90 const Raul::Path& path, uint32_t index, Shared::PortType type, Direction dir) 91 : ObjectModel(uris, path) 89 92 , _index(index) 90 93 , _direction(dir) -
trunk/ingen/src/common/interface/Node.hpp
r2468 r2533 22 22 #include "GraphObject.hpp" 23 23 24 #include <iostream>25 24 namespace Ingen { 26 25 namespace Shared { -
trunk/ingen/src/engine/BufferFactory.cpp
r2468 r2533 33 33 using namespace Shared; 34 34 35 BufferFactory::BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> map)35 BufferFactory::BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> a_uris) 36 36 : _engine(engine) 37 , _ map(map)37 , _uris(a_uris) 38 38 , _silent_buffer(NULL) 39 39 { 40 assert(_uris); 41 } 42 43 44 BufferFactory::~BufferFactory() 45 { 46 free_list(_free_audio.get()); 47 free_list(_free_control.get()); 48 free_list(_free_event.get()); 49 free_list(_free_object.get()); 50 } 51 52 53 void 54 BufferFactory::free_list(Buffer* head) 55 { 56 Buffer* next = head->_next; 57 delete head; 58 if (next) 59 free_list(next); 40 60 } 41 61 … … 88 108 89 109 if (!try_head) { 90 if ( ThreadManager::current_thread_id() != THREAD_PROCESS) {110 if (!ThreadManager::thread_is(THREAD_PROCESS)) { 91 111 return create(type, size); 92 112 } else { … … 114 134 if (type.is_control()) { 115 135 AudioBuffer* ret = new AudioBuffer(*this, type, size); 116 ret->object()->type = _ map->object_class_vector.id;117 ((LV2_Vector_Body*)ret->object()->body)->elem_type = _ map->object_class_float32.id;136 ret->object()->type = _uris->object_class_vector.id; 137 ((LV2_Vector_Body*)ret->object()->body)->elem_type = _uris->object_class_float32.id; 118 138 buffer = ret; 119 139 } else if (type.is_audio()) { 120 140 AudioBuffer* ret = new AudioBuffer(*this, type, size); 121 ret->object()->type = _ map->object_class_float32.id;141 ret->object()->type = _uris->object_class_float32.id; 122 142 buffer = ret; 123 143 } else if (type.is_events()) { -
trunk/ingen/src/engine/BufferFactory.hpp
r2468 r2533 38 38 class BufferFactory { 39 39 public: 40 BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> map); 40 BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> uris); 41 ~BufferFactory(); 41 42 42 43 typedef boost::intrusive_ptr<Buffer> Ref; … … 50 51 51 52 void set_block_length(SampleCount block_length); 53 54 Shared::LV2URIMap& uris() { assert(_uris); return *_uris.get(); } 52 55 53 56 private: … … 68 71 } 69 72 73 void free_list(Buffer* head); 74 70 75 Raul::AtomicPtr<Buffer> _free_audio; 71 76 Raul::AtomicPtr<Buffer> _free_control; … … 75 80 Glib::Mutex _mutex; 76 81 Engine& _engine; 77 SharedPtr<Shared::LV2URIMap> _ map;82 SharedPtr<Shared::LV2URIMap> _uris; 78 83 79 84 Ref _silent_buffer; -
trunk/ingen/src/engine/ClientBroadcaster.hpp
r2445 r2533 27 27 #include "NodeFactory.hpp" 28 28 29 #include <iostream>30 29 using namespace std; 31 30 -
trunk/ingen/src/engine/ConnectionImpl.cpp
r2495 r2533 128 128 ConnectionImpl::can_connect(const OutputPort* src, const InputPort* dst) 129 129 { 130 const LV2URIMap& uris = Shared::LV2URIMap::instance();130 const LV2URIMap& uris = src->bufs().uris(); 131 131 return ( 132 132 ( (src->is_a(PortType::CONTROL) || src->is_a(PortType::AUDIO)) -
trunk/ingen/src/engine/Context.hpp
r2487 r2533 21 21 #include "EventSink.hpp" 22 22 #include "tuning.hpp" 23 #include "types.hpp" 23 24 24 25 namespace Ingen { -
trunk/ingen/src/engine/ControlBindings.cpp
r2485 r2533 19 19 #include "raul/log.hpp" 20 20 #include "raul/midi_events.h" 21 #include "shared/LV2URIMap.hpp" 22 #include "module/World.hpp" 21 23 #include "events/SendPortValue.hpp" 22 24 #include "events/SendBinding.hpp" … … 37 39 38 40 39 ControlBindings::ControlBindings(Engine& engine , SharedPtr<Shared::LV2URIMap> map)41 ControlBindings::ControlBindings(Engine& engine) 40 42 : _engine(engine) 41 , _map(map)42 43 , _learn_port(NULL) 43 44 , _bindings(new Bindings()) … … 56 57 ControlBindings::port_binding(PortImpl* port) 57 58 { 58 const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();59 const Raul::Atom& binding = port->get_property(uris.ingen_controlBinding);59 const Shared::LV2URIMap& uris = *_engine.world()->uris().get(); 60 const Raul::Atom& binding = port->get_property(uris.ingen_controlBinding); 60 61 Key key; 61 62 if (binding.type() == Atom::DICT) { … … 115 116 ControlBindings::port_value_changed(ProcessContext& context, PortImpl* port) 116 117 { 118 const Shared::LV2URIMap& uris = *_engine.world()->uris().get(); 117 119 Key key = port_binding(port); 118 120 if (key) { … … 151 153 } 152 154 if (size > 0) 153 _feedback->append(0, 0, _map->midi_event.id, size, buf);155 _feedback->append(0, 0, uris.midi_event.id, size, buf); 154 156 } 155 157 } … … 167 169 ControlBindings::control_to_port_value(PortImpl* port, Type type, int16_t value) 168 170 { 169 const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();171 const Shared::LV2URIMap& uris = *_engine.world()->uris().get(); 170 172 171 173 // TODO: cache these to avoid the lookup … … 204 206 return 0; 205 207 206 const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();208 const Shared::LV2URIMap& uris = *_engine.world()->uris().get(); 207 209 208 210 // TODO: cache these to avoid the lookup … … 260 262 ControlBindings::bind(ProcessContext& context, Key key) 261 263 { 262 const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();264 const Shared::LV2URIMap& uris = *context.engine().world()->uris().get(); 263 265 assert(_learn_port); 264 266 if (key.type == MIDI_NOTE) { … … 337 339 _feedback->clear(); 338 340 341 const Shared::LV2URIMap& uris = *context.engine().world()->uris().get(); 342 339 343 // Learn from input if necessary 340 344 if (_learn_port) { … … 342 346 buffer->get_event(&frames, &subframes, &type, &size, &buf); 343 347 buffer->increment()) { 344 if (type != _map->midi_event.id)348 if (type != uris.midi_event.id) 345 349 continue; 346 350 … … 359 363 buffer->get_event(&frames, &subframes, &type, &size, &buf); 360 364 buffer->increment()) { 361 if (type != _map->midi_event.id)365 if (type != uris.midi_event.id) 362 366 continue; 363 367 -
trunk/ingen/src/engine/ControlBindings.hpp
r2442 r2533 57 57 typedef std::map<Key, PortImpl*> Bindings; 58 58 59 ControlBindings(Engine& engine , SharedPtr<Shared::LV2URIMap> map);59 ControlBindings(Engine& engine); 60 60 ~ControlBindings(); 61 61 … … 89 89 int16_t port_value_to_control(PortImpl* port, Type type); 90 90 91 Engine& _engine; 92 SharedPtr<Shared::LV2URIMap> _map; 93 PortImpl* _learn_port; 91 Engine& _engine; 92 PortImpl* _learn_port; 94 93 95 94 SharedPtr<Bindings> _bindings; -
trunk/ingen/src/engine/Driver.hpp
r2468 r2533 78 78 79 79 /** Activate driver (begin processing graph and events). */ 80 virtual void activate() = 0;80 virtual void activate() {} 81 81 82 82 /** Deactivate driver (stop processing graph and events). */ 83 virtual void deactivate() = 0;83 virtual void deactivate() {} 84 84 85 85 /** Return true iff driver is activated (processing graph and events). */ 86 virtual bool is_activated() const = 0;86 virtual bool is_activated() const { return true; } 87 87 88 88 /** Create a port ready to be inserted with add_input (non realtime). … … 98 98 99 99 /** Remove a system visible port. */ 100 virtual Raul:: List<DriverPort*>::Node* remove_port(const Raul::Path& path) = 0;100 virtual Raul::Deletable* remove_port(const Raul::Path& path, Ingen::DriverPort** port=NULL) = 0; 101 101 102 102 /** Return true iff this driver supports the given type of I/O */ -
trunk/ingen/src/engine/DuplexPort.cpp
r2494 r2533 51 51 { 52 52 assert(PortImpl::_parent == parent); 53 set_property( Shared::LV2URIMap::instance().ingen_polyphonic, polyphonic);53 set_property(bufs.uris().ingen_polyphonic, polyphonic); 54 54 } 55 55 -
trunk/ingen/src/engine/Engine.cpp
r2496 r2533 59 59 bool ThreadManager::single_threaded = true; 60 60 61 Engine::Engine(Ingen::Shared::World* world)62 : _world( world)61 Engine::Engine(Ingen::Shared::World* a_world) 62 : _world(a_world) 63 63 , _maid(new Raul::Maid(maid_queue_size)) 64 64 , _post_processor(new PostProcessor(*this, post_processor_queue_size)) 65 65 , _broadcaster(new ClientBroadcaster()) 66 , _node_factory(new NodeFactory( world))66 , _node_factory(new NodeFactory(a_world)) 67 67 , _message_context(new MessageContext(*this)) 68 , _buffer_factory(new BufferFactory(*this, world->uris)) 69 , _control_bindings(new ControlBindings(*this, world->uris)) 68 , _buffer_factory(new BufferFactory(*this, a_world->uris())) 69 //, _buffer_factory(NULL) 70 , _control_bindings(new ControlBindings(*this)) 70 71 , _quit_flag(false) 71 72 , _activated(false) 72 73 { 73 if ( world->store) {74 assert(PtrCast<EngineStore>( world->store));74 if (a_world->store()) { 75 assert(PtrCast<EngineStore>(a_world->store())); 75 76 } else { 76 world->store = SharedPtr<Shared::Store>(new EngineStore());77 a_world->set_store(SharedPtr<Shared::Store>(new EngineStore())); 77 78 } 78 79 } … … 102 103 Engine::engine_store() const 103 104 { 104 return PtrCast<EngineStore>(_world->store );105 return PtrCast<EngineStore>(_world->store()); 105 106 } 106 107 … … 138 139 139 140 140 Ingen::QueuedEngineInterface*141 Engine::new_local_interface()142 {143 return new Ingen::QueuedEngineInterface(*this, Ingen::event_queue_size);144 }145 146 147 141 void 148 142 Engine::add_event_source(SharedPtr<EventSource> source) … … 165 159 Engine::activate() 166 160 { 161 if (_activated) 162 return true; 163 167 164 assert(_driver); 165 //assert(ThreadManager::single_threaded == true); 166 ThreadManager::single_threaded = true; 168 167 169 168 _buffer_factory->set_block_length(_driver->block_length()); … … 171 170 _message_context->Thread::start(); 172 171 173 uint32_t parallelism = _world->conf ->option("parallelism").get_int32();172 uint32_t parallelism = _world->conf()->option("parallelism").get_int32(); 174 173 175 174 for (EventSources::iterator i = _event_sources.begin(); i != _event_sources.end(); ++i) 176 175 (*i)->activate_source(); 177 176 178 const LV2URIMap& uris = *world()->uris ;177 const LV2URIMap& uris = *world()->uris().get(); 179 178 180 179 // Create root patch … … 186 185 root_patch->set_property(uris.rdf_type, uris.ingen_Node); 187 186 root_patch->activate(*_buffer_factory); 188 _world->store ->add(root_patch);187 _world->store()->add(root_patch); 189 188 root_patch->compiled_patch(root_patch->compile()); 190 189 _driver->set_root_patch(root_patch); -
trunk/ingen/src/engine/Engine.hpp
r2409 r2533 62 62 * \ingroup engine 63 63 */ 64 class Engine : boost::noncopyable64 class Engine : public boost::noncopyable 65 65 { 66 66 public: … … 79 79 virtual void deactivate(); 80 80 81 v oid process_events(ProcessContext& context);81 virtual void process_events(ProcessContext& context); 82 82 83 83 virtual bool activated() { return _activated; } 84 84 85 BufferFactory* buffer_factory() const { return _buffer_factory; }86 ClientBroadcaster* broadcaster() const { return _broadcaster; }87 ControlBindings* control_bindings() const { return _control_bindings; }88 Driver* driver() const { return _driver.get(); }89 MessageContext* message_context() const { return _message_context; }90 NodeFactory* node_factory() const { return _node_factory; }91 PostProcessor* post_processor() const { return _post_processor; }92 Raul::Maid* maid() const { return _maid; }85 virtual BufferFactory* buffer_factory() const { return _buffer_factory; } 86 virtual ClientBroadcaster* broadcaster() const { return _broadcaster; } 87 virtual ControlBindings* control_bindings() const { return _control_bindings; } 88 virtual Driver* driver() const { return _driver.get(); } 89 virtual MessageContext* message_context() const { return _message_context; } 90 virtual NodeFactory* node_factory() const { return _node_factory; } 91 virtual PostProcessor* post_processor() const { return _post_processor; } 92 virtual Raul::Maid* maid() const { return _maid; } 93 93 94 SharedPtr<EngineStore> engine_store() const;94 virtual SharedPtr<EngineStore> engine_store() const; 95 95 96 96 virtual void set_driver(SharedPtr<Driver> driver) { _driver = driver; } … … 98 98 virtual void add_event_source(SharedPtr<EventSource> source); 99 99 100 Ingen::QueuedEngineInterface* new_local_interface(); 101 102 Ingen::Shared::World* world() { return _world; } 100 virtual Ingen::Shared::World* world() { return _world; } 103 101 104 102 typedef std::vector<ProcessSlave*> ProcessSlaves; 105 inlineconst ProcessSlaves& process_slaves() const { return _process_slaves; }106 inlineProcessSlaves& process_slaves() { return _process_slaves; }103 virtual const ProcessSlaves& process_slaves() const { return _process_slaves; } 104 virtual ProcessSlaves& process_slaves() { return _process_slaves; } 107 105 108 106 private: -
trunk/ingen/src/engine/EventSource.cpp
r2391 r2533 32 32 { 33 33 Thread::set_context(THREAD_PRE_PROCESS); 34 assert(context() == THREAD_PRE_PROCESS);35 34 set_name("EventSource"); 36 35 } -
trunk/ingen/src/engine/events/CreateNode.cpp
r2509 r2533 82 82 } 83 83 84 const LV2URIMap& uris = Shared::LV2URIMap::instance();85 const Resource::Properties::const_iterator p = properties.find(uris.ingen_polyphonic);84 const Resource::Properties::const_iterator p = properties.find( 85 engine.world()->uris()->ingen_polyphonic); 86 86 if (p != properties.end() && p->second.type() == Raul::Atom::BOOL 87 87 && p->second.get_bool()) -
trunk/ingen/src/engine/events/CreatePatch.cpp
r2479 r2533 84 84 poly = _poly; 85 85 86 const LV2URIMap& uris = *_engine.world()->uris .get();86 const LV2URIMap& uris = *_engine.world()->uris().get(); 87 87 88 88 _patch = new PatchImpl(_engine, path.symbol(), poly, _parent, -
trunk/ingen/src/engine/events/CreatePort.cpp
r2510 r2533 85 85 _patch = _engine.engine_store()->find_patch(_path.parent()); 86 86 87 const LV2URIMap& uris = *_engine.world()->uris .get();87 const LV2URIMap& uris = *_engine.world()->uris().get(); 88 88 89 89 if (_patch != NULL) { -
trunk/ingen/src/engine/events/Delete.cpp
r2486 r2533 43 43 , _path(path) 44 44 , _store_iterator(engine.engine_store()->end()) 45 , _garbage(NULL) 45 46 , _driver_port(NULL) 46 47 , _patch_node_listnode(NULL) … … 154 155 _port->parent_patch()->external_ports(_ports_array); 155 156 156 if ( ! _port->parent_patch()->parent()) { 157 _driver_port = _engine.driver()->remove_port(_port->path()); 158 } 157 if ( ! _port->parent_patch()->parent()) 158 _garbage = _engine.driver()->remove_port(_port->path(), &_driver_port); 159 159 } 160 160 … … 202 202 } 203 203 204 if (_driver_port) {205 _driver_port-> elem()->destroy();206 _engine.maid()->push(_driver_port); 207 }204 if (_driver_port) 205 _driver_port->destroy(); 206 207 _engine.maid()->push(_garbage); 208 208 } 209 209 -
trunk/ingen/src/engine/events/Delete.hpp
r2417 r2533 76 76 SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node 77 77 SharedPtr<PortImpl> _port; ///< Non-NULL iff a port 78 Raul::List<DriverPort*>::Node* _driver_port; 78 Raul::Deletable* _garbage; 79 DriverPort* _driver_port; 79 80 PatchImpl::Nodes::Node* _patch_node_listnode; 80 81 Raul::List<PortImpl*>::Node* _patch_port_listnode; -
trunk/ingen/src/engine/events/RequestMetadata.cpp
r2514 r2533 75 75 GraphObjectImpl* obj = dynamic_cast<GraphObjectImpl*>(_resource); 76 76 if (obj) { 77 if (_key == _engine.world()->uris ->ingen_value)77 if (_key == _engine.world()->uris()->ingen_value) 78 78 _special_type = PORT_VALUE; 79 79 else if (_is_meta) … … 102 102 IntrusivePtr<ObjectBuffer> obuf = PtrCast<ObjectBuffer>(port->buffer(0)); 103 103 if (obuf) { 104 LV2Object::to_atom( obuf->object(), _value);104 LV2Object::to_atom(*_engine.world()->uris().get(), obuf->object(), _value); 105 105 } 106 106 } … … 120 120 _request->respond_ok(); 121 121 _request->client()->set_property(_uri.str(), 122 _engine.world()->uris ->ingen_value, _value);122 _engine.world()->uris()->ingen_value, _value); 123 123 } else { 124 124 const string msg = "Get value for non-port " + _uri.str(); -
trunk/ingen/src/engine/events/SendBinding.cpp
r2412 r2533 32 32 SendBinding::post_process() 33 33 { 34 const LV2URIMap& uris = *_engine.world()->uris .get();34 const LV2URIMap& uris = *_engine.world()->uris().get(); 35 35 Raul::Atom::DictValue dict; 36 36 if (_type == ControlBindings::MIDI_CC) { -
trunk/ingen/src/engine/events/SendPortValue.cpp
r2445 r2533 34 34 _engine.broadcaster()->set_property( 35 35 _port->path(), 36 _engine.world()->uris ->ingen_value, _value);36 _engine.world()->uris()->ingen_value, _value); 37 37 } 38 38 -
trunk/ingen/src/engine/events/SetMetadata.cpp
r2514 r2533 112 112 } 113 113 114 const LV2URIMap& uris = *_engine.world()->uris .get();114 const LV2URIMap& uris = *_engine.world()->uris().get(); 115 115 116 116 if (is_graph_object && !_object) { … … 118 118 bool is_patch = false, is_node = false, is_port = false, is_output = false; 119 119 PortType data_type(PortType::UNKNOWN); 120 ResourceImpl::type( _properties, is_patch, is_node, is_port, is_output, data_type);120 ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output, data_type); 121 121 122 122 // Create a separate request without a source so EventSource isn't unblocked twice -
trunk/ingen/src/engine/events/SetPortValue.cpp
r2492 r2533 103 103 if (_port) { 104 104 _port->set_value(_value); 105 _port->set_property(_engine.world()->uris ->ingen_value, _value);105 _port->set_property(_engine.world()->uris()->ingen_value, _value); 106 106 } 107 107 … … 152 152 } 153 153 154 SharedPtr<LV2URIMap> uris = _engine.world()->uris;154 LV2URIMap& uris = *_engine.world()->uris().get(); 155 155 156 156 EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf); … … 160 160 // Size 0 event, pass it along to the plugin as a typed but empty event 161 161 if (_value.data_size() == 0) { 162 const uint32_t type_id = uris ->uri_to_id(NULL, _value.get_blob_type());162 const uint32_t type_id = uris.uri_to_id(NULL, _value.get_blob_type()); 163 163 ebuf->append(frames, 0, type_id, 0, NULL); 164 164 _port->raise_set_by_user_flag(); … … 167 167 } else if (!strcmp(_value.get_blob_type(), "http://lv2plug.in/ns/ext/midi#MidiEvent")) { 168 168 ebuf->prepare_write(context); 169 ebuf->append(frames, 0, uris ->midi_event.id, _value.data_size(),169 ebuf->append(frames, 0, uris.midi_event.id, _value.data_size(), 170 170 (const uint8_t*)_value.get_blob()); 171 171 _port->raise_set_by_user_flag(); … … 177 177 if (obuf) { 178 178 obuf->object()->size = obuf->size() - sizeof(LV2_Object); 179 if (LV2Object::from_atom( _value, obuf->object())) {179 if (LV2Object::from_atom(uris, _value, obuf->object())) { 180 180 debug << "Converted atom " << _value << " :: " << obuf->object()->type 181 181 << " * " << obuf->object()->size << " @ " << obuf->object() << endl; … … 201 201 _request->respond_ok(); 202 202 _engine.broadcaster()->set_property(_port_path, 203 _engine.world()->uris ->ingen_value, _value);203 _engine.world()->uris()->ingen_value, _value); 204 204 break; 205 205 case TYPE_MISMATCH: -
trunk/ingen/src/engine/GraphObjectImpl.cpp
r2514 r2533 29 29 30 30 31 GraphObjectImpl::GraphObjectImpl(GraphObjectImpl* parent, const Symbol& symbol) 32 : ResourceImpl(parent ? parent->path().child(symbol) : Raul::Path::root()) 31 GraphObjectImpl::GraphObjectImpl(Shared::LV2URIMap& uris, 32 GraphObjectImpl* parent, const Symbol& symbol) 33 : ResourceImpl(uris, parent ? parent->path().child(symbol) : Raul::Path::root()) 33 34 , _parent(parent) 34 35 , _path(parent ? parent->path().child(symbol) : "/") 35 36 , _symbol(symbol) 36 , _meta( ResourceImpl::meta_uri(uri()))37 , _meta(uris, ResourceImpl::meta_uri(uri())) 37 38 { 38 39 } -
trunk/ingen/src/engine/GraphObjectImpl.hpp
r2468 r2533 32 32 33 33 namespace Ingen { 34 35 namespace Shared { class LV2URIMap; } 34 36 35 37 class PatchImpl; … … 99 101 100 102 protected: 101 GraphObjectImpl(GraphObjectImpl* parent, const Raul::Symbol& symbol); 103 GraphObjectImpl(Shared::LV2URIMap& uris, 104 GraphObjectImpl* parent, const Raul::Symbol& symbol); 102 105 103 106 GraphObjectImpl* _parent; -
trunk/ingen/src/engine/HTTPClientSender.cpp
r2445 r2533 60 60 const string full_uri = _url + "/" + path; 61 61 62 Redland::Model model(*_engine.world()->rdf_world );62 Redland::Model model(*_engine.world()->rdf_world()); 63 63 for (Resource::Properties::const_iterator i = properties.begin(); i != properties.end(); ++i) 64 64 model.add_statement( 65 Redland::Resource(*_engine.world()->rdf_world , path),65 Redland::Resource(*_engine.world()->rdf_world(), path), 66 66 i->first.str(), 67 67 AtomRDF::atom_to_node(model, i->second)); … … 112 112 { 113 113 #if 0 114 Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world , value);114 Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world(), value); 115 115 const string msg = string( 116 116 "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" -
trunk/ingen/src/engine/HTTPEngineReceiver.cpp
r2514 r2533 56 56 LOG(info) << "Started HTTP server on port " << soup_server_get_port(_server) << endl; 57 57 58 if (!engine.world()->parser || !engine.world()->serialiser)58 if (!engine.world()->parser() || !engine.world()->serialiser()) 59 59 engine.world()->load("ingen_serialisation"); 60 60 … … 100 100 HTTPEngineReceiver* me = (HTTPEngineReceiver*)data; 101 101 102 SharedPtr<Store> store = me->_engine.world()->store ;102 SharedPtr<Store> store = me->_engine.world()->store(); 103 103 if (!store) { 104 104 soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); … … 111 111 } 112 112 113 SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser ;113 SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser(); 114 114 115 115 const string base_uri = "path:/"; … … 181 181 182 182 // Get serialiser 183 SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser ;183 SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser(); 184 184 if (!serialiser) { 185 185 soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); … … 201 201 202 202 // Get parser 203 SharedPtr<Parser> parser = me->_engine.world()->parser ;203 SharedPtr<Parser> parser = me->_engine.world()->parser(); 204 204 if (!parser) { 205 205 soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); -
trunk/ingen/src/engine/InputPort.cpp
r2495 r2533 50 50 , _num_connections(0) 51 51 { 52 const LV2URIMap& uris = Shared::LV2URIMap::instance();52 const LV2URIMap& uris = bufs.uris(); 53 53 54 54 if (!dynamic_cast<Patch*>(parent)) … … 82 82 InputPort::get_buffers(BufferFactory& bufs, Raul::Array<BufferFactory::Ref>* buffers, uint32_t poly) 83 83 { 84 size_t num_connections = (ThreadManager:: current_thread_id() == THREAD_PROCESS)84 size_t num_connections = (ThreadManager::thread_is(THREAD_PROCESS)) 85 85 ? _connections.size() : _num_connections; 86 86 … … 92 92 93 93 } else if (num_connections == 1) { 94 if (ThreadManager:: current_thread_id() == THREAD_PROCESS) {94 if (ThreadManager::thread_is(THREAD_PROCESS)) { 95 95 if (!_connections.front()->must_mix() && !_connections.front()->must_queue()) { 96 96 // Single non-mixing conneciton, use buffers directly -
trunk/ingen/src/engine/InternalPlugin.cpp
r2485 r2533 33 33 using namespace Internals; 34 34 35 InternalPlugin::InternalPlugin(const std::string& uri, const std::string& symbol) 36 : PluginImpl(Plugin::Internal, uri) 35 InternalPlugin::InternalPlugin(Shared::LV2URIMap& uris, 36 const std::string& uri, const std::string& symbol) 37 : PluginImpl(uris, Plugin::Internal, uri) 37 38 , _symbol(symbol) 38 39 { 39 const LV2URIMap& uris = Shared::LV2URIMap::instance();40 40 set_property(uris.rdf_type, uris.ingen_Internal); 41 41 } … … 54 54 55 55 const string uri_str = uri().str(); 56 56 57 if (uri_str == NS_INTERNALS "Controller") { 57 return new ControllerNode( bufs, name, polyphonic, parent, srate);58 return new ControllerNode(this, bufs, name, polyphonic, parent, srate); 58 59 } else if (uri_str == NS_INTERNALS "Delay") { 59 return new DelayNode( bufs, name, polyphonic, parent, srate);60 return new DelayNode(this, bufs, name, polyphonic, parent, srate); 60 61 } else if (uri_str == NS_INTERNALS "Note") { 61 return new NoteNode( bufs, name, polyphonic, parent, srate);62 return new NoteNode(this, bufs, name, polyphonic, parent, srate); 62 63 } else if (uri_str == NS_INTERNALS "Trigger") { 63 return new TriggerNode( bufs, name, polyphonic, parent, srate);64 return new TriggerNode(this, bufs, name, polyphonic, parent, srate); 64 65 } else { 65 66 return NULL; -
trunk/ingen/src/engine/InternalPlugin.hpp
r2398 r2533 21 21 #include "ingen-config.h" 22 22 23 #ifndef HAVE_SLV224 #error "This file requires SLV2, but HAVE_SLV2 is not defined. Please report."25 #endif26 27 23 #include <cstdlib> 28 24 #include <glibmm/module.h> … … 45 41 { 46 42 public: 47 InternalPlugin(const std::string& uri, const std::string& symbol); 43 InternalPlugin(Shared::LV2URIMap& uris, 44 const std::string& uri, const std::string& symbol); 48 45 49 46 NodeImpl* instantiate(BufferFactory& bufs, -
trunk/ingen/src/engine/ingen_engine.cpp
r2409 r2533 26 26 27 27 struct IngenEngineModule : public Ingen::Shared::Module { 28 v oid load(Ingen::Shared::World* world) {28 virtual void load(Ingen::Shared::World* world) { 29 29 set_denormal_flags(); 30 world->local_engine = SharedPtr<Engine>(new Engine(world)); 30 SharedPtr<Engine> engine(new Ingen::Engine(world)); 31 world->set_local_engine(engine); 31 32 SharedPtr<QueuedEngineInterface> interface( 32 new Ingen::QueuedEngineInterface(*world->local_engine, event_queue_size)); 33 world->engine = interface; 34 world->local_engine->add_event_source(interface); 33 new Ingen::QueuedEngineInterface(*engine.get(), event_queue_size)); 34 world->set_engine(interface); 35 engine->add_event_source(interface); 36 assert(world->local_engine() == engine); 35 37 } 36 38 }; -
trunk/ingen/src/engine/ingen_http.cpp
r2349 r2533 28 28 void load(Ingen::Shared::World* world) { 29 29 SharedPtr<HTTPEngineReceiver> interface( 30 new Ingen::HTTPEngineReceiver(*world->local_engine .get(),31 world->conf ->option("engine-port").get_int32()));32 world->local_engine ->add_event_source(interface);30 new Ingen::HTTPEngineReceiver(*world->local_engine().get(), 31 world->conf()->option("engine-port").get_int32())); 32 world->local_engine()->add_event_source(interface); 33 33 } 34 34 }; -
trunk/ingen/src/engine/ingen_jack.cpp
r2349 r2533 26 26 struct IngenJackModule : public Ingen::Shared::Module { 27 27 void load(Ingen::Shared::World* world) { 28 Ingen::JackDriver* driver = new Ingen::JackDriver(*world->local_engine .get());29 driver->attach(world->conf ->option("jack-server").get_string(),30 world->conf ->option("jack-client").get_string(), NULL);31 world->local_engine ->set_driver(SharedPtr<Driver>(driver));28 Ingen::JackDriver* driver = new Ingen::JackDriver(*world->local_engine().get()); 29 driver->attach(world->conf()->option("jack-server").get_string(), 30 world->conf()->option("jack-client").get_string(), NULL); 31 world->local_engine()->set_driver(SharedPtr<Driver>(driver)); 32 32 } 33 33 }; -
trunk/ingen/src/engine/ingen_lv2.cpp
r2527 r2533 17 17 */ 18 18 19 #ifndef PLUGIN_URI20 #error "This file requires PLUGIN_URI to be defined"21 #endif22 23 19 #include <stdlib.h> 20 #include <glibmm/miscutils.h> 21 #include <glibmm/convert.h> 22 #include <glib.h> 24 23 #include "lv2.h" 24 #include "ingen-config.h" 25 #include "raul/log.hpp" 26 #include "raul/Thread.hpp" 27 #include "raul/SharedPtr.hpp" 28 #include "engine/AudioBuffer.hpp" 25 29 #include "engine/Engine.hpp" 30 #include "engine/ThreadManager.hpp" 26 31 #include "engine/Driver.hpp" 27 32 #include "engine/ProcessContext.hpp" 28 33 #include "engine/PatchImpl.hpp" 34 #include "engine/QueuedEngineInterface.hpp" 29 35 #include "module/World.hpp" 30 31 extern "C" { 36 #include "module/ingen_module.hpp" 37 #include "shared/runtime_paths.hpp" 38 #include "shared/Configuration.hpp" 39 #include "serialisation/Parser.hpp" 40 #include "interface/EngineInterface.hpp" 32 41 33 42 using namespace Ingen; 34 43 35 /* Plugin */ 36 37 struct IngenLV2Driver : public Ingen::Driver { 38 IngenLV2Driver(Engine& engine, SampleCount buffer_size, SampleCount sample_rate) 44 namespace Ingen { 45 namespace LV2 { 46 47 /** Record of a patch found in this LV2 bundle */ 48 struct LV2Patch { 49 LV2Patch(const std::string& u, const std::string& f); 50 51 const std::string uri; 52 const std::string filename; 53 LV2_Descriptor descriptor; 54 }; 55 56 57 /* Static library data */ 58 typedef std::vector< SharedPtr<const LV2Patch> > LV2Patches; 59 static bool initialised = false; 60 static LV2Patches patches; 61 static Configuration conf; 62 static int argc = 0; 63 static char** argv = NULL; 64 static Shared::World* world = NULL; 65 66 67 struct LV2Driver; 68 69 class LV2Port : public DriverPort 70 { 71 public: 72 LV2Port(LV2Driver* driver, DuplexPort* patch_port) 73 : DriverPort(patch_port) 74 , _driver(driver) 75 , _buffer(NULL) 76 {} 77 78 // TODO: LV2 dynamic ports 79 void create() {} 80 void destroy() {} 81 void move(const Raul::Path& path) {} 82 83 void pre_process(ProcessContext& context) { 84 if (!is_input() || !_buffer) 85 return; 86 87 if (_patch_port->buffer_type() == PortType::AUDIO) { 88 AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); 89 patch_buf->copy((Sample*)_buffer, 0, context.nframes() - 1); 90 } else if (_patch_port->buffer_type() == PortType::EVENTS) { 91 //Raul::warn << "TODO: LV2 event I/O" << std::endl; 92 } 93 } 94 95 void post_process(ProcessContext& context) { 96 if (is_input() || !_buffer) 97 return; 98 99 if (_patch_port->buffer_type() == PortType::AUDIO) { 100 AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); 101 memcpy((Sample*)_buffer, patch_buf->data(), context.nframes() * sizeof(Sample)); 102 } else if (_patch_port->buffer_type() == PortType::EVENTS) { 103 //Raul::warn << "TODO: LV2 event I/O" << std::endl; 104 } 105 } 106 107 void* buffer() const { return _buffer; } 108 void set_buffer(void* buf) { _buffer = buf; } 109 110 private: 111 LV2Driver* _driver; 112 void* _buffer; 113 }; 114 115 116 struct LV2Driver : public Driver { 117 private: 118 typedef std::vector<LV2Port*> Ports; 119 120 public: 121 LV2Driver(Engine& engine, SampleCount buffer_size, SampleCount sample_rate) 39 122 : _context(engine) 123 , _root_patch(NULL) 40 124 , _buffer_size(buffer_size) 41 125 , _sample_rate(sample_rate) 42 126 , _frame_time(0) 43 , _root_patch(NULL)44 127 {} 45 46 void activate() {}47 void deactivate() {}48 bool is_activated() const { return true; }49 128 50 129 void run(uint32_t nframes) { 51 130 _context.locate(_frame_time, nframes, 0); 131 132 for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) 133 (*i)->pre_process(_context); 134 52 135 if (_root_patch) 53 136 _root_patch->process(_context); 137 138 for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) 139 (*i)->post_process(_context); 140 54 141 _frame_time += nframes; 55 142 } 56 143 57 virtual void set_root_patch(PatchImpl* patch) {} 58 virtual PatchImpl* root_patch() { return NULL; } 59 60 virtual void add_port(DriverPort* port) {} 61 virtual DriverPort* remove_port(const Raul::Path& path) { return NULL; } 62 63 virtual DriverPort* create_port(DuplexPort* patch_port) { return NULL; } 64 65 virtual DriverPort* driver_port(const Raul::Path& path) { return NULL; } 66 67 virtual SampleCount buffer_size() const { return _buffer_size; } 144 virtual void set_root_patch(PatchImpl* patch) { _root_patch = patch; } 145 virtual PatchImpl* root_patch() { return _root_patch; } 146 147 virtual void add_port(DriverPort* port) { 148 // Note this doesn't have to be realtime safe since there's no dynamic LV2 ports 149 ThreadManager::assert_thread(THREAD_PROCESS); 150 assert(dynamic_cast<LV2Port*>(port)); 151 assert(port->patch_port()->index() == _ports.size()); 152 _ports.push_back((LV2Port*)port); 153 } 154 155 virtual Raul::Deletable* remove_port(const Raul::Path& path, Ingen::DriverPort** port=NULL) { 156 // Note this doesn't have to be realtime safe since there's no dynamic LV2 ports 157 ThreadManager::assert_thread(THREAD_PROCESS); 158 159 for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { 160 if ((*i)->patch_port()->path() == path) { 161 _ports.erase(i); 162 return NULL; 163 } 164 } 165 166 Raul::warn << "Unable to find port " << path << std::endl; 167 return NULL; 168 } 169 170 171 virtual bool supports(Shared::PortType port_type, Shared::EventType event_type) { 172 return true; 173 } 174 175 virtual DriverPort* create_port(DuplexPort* patch_port) { 176 return new LV2Port(this, patch_port); 177 } 178 179 virtual DriverPort* driver_port(const Raul::Path& path) { 180 ThreadManager::assert_thread(THREAD_PROCESS); 181 182 for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) 183 if ((*i)->patch_port()->path() == path) 184 return (*i); 185 186 return NULL; 187 } 188 189 virtual SampleCount block_length() const { return _buffer_size; } 68 190 virtual SampleCount sample_rate() const { return _sample_rate; } 69 191 virtual SampleCount frame_time() const { return _frame_time;} … … 78 200 SampleCount _sample_rate; 79 201 SampleCount _frame_time; 202 Ports _ports; 80 203 }; 81 204 205 } // namespace LV2 206 } // namespace Ingen 207 208 209 /* LV2 Plugin Interface */ 210 211 extern "C" { 212 82 213 83 214 struct IngenPlugin { 84 Ingen::Shared::World* world; 85 SharedPtr<Ingen::Engine> engine; 215 Ingen::Shared::World* world; 86 216 }; 87 88 89 static void90 ingen_activate(LV2_Handle instance)91 {92 IngenPlugin* plugin = (IngenPlugin*)instance;93 plugin->engine->activate(1);94 }95 96 97 static void98 ingen_cleanup(LV2_Handle instance)99 {100 IngenPlugin* plugin = (IngenPlugin*)instance;101 plugin->engine.reset();102 ingen_destroy_world();103 free(instance);104 }105 106 107 static void108 ingen_connect_port(LV2_Handle instance, uint32_t port, void* data)109 {110 }111 217 112 218 … … 117 223 const LV2_Feature*const* features) 118 224 { 225 Shared::set_bundle_path(bundle_path); 226 227 using namespace LV2; 228 229 const LV2Patch* patch = NULL; 230 for (LV2Patches::iterator i = patches.begin(); i != patches.end(); ++i) { 231 if (&(*i)->descriptor == descriptor) { 232 patch = (*i).get(); 233 break; 234 } 235 } 236 237 if (!patch) { 238 Raul::error << "Could not find patch " << descriptor->URI << std::endl; 239 return NULL; 240 } 241 119 242 IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin)); 120 121 Shared::bundle_path = bundle_path; 122 123 plugin->world = ingen_get_world(); 124 plugin->engine = SharedPtr<Engine>(new Engine(plugin->world)); 125 plugin->world->local_engine = plugin->engine; 126 127 // FIXME: fixed buffer size 128 plugin->engine->set_driver(PortType::AUDIO, 129 SharedPtr<Driver>(new IngenLV2Driver(*plugin->engine, rate, 4096))); 243 //plugin->world = ingen_world_new(&conf, argc, argv); 244 plugin->world = LV2::world; 245 246 SharedPtr<Engine> engine(new Engine(plugin->world)); 247 plugin->world->set_local_engine(engine); 248 249 SharedPtr<QueuedEngineInterface> interface( 250 new Ingen::QueuedEngineInterface(*plugin->world->local_engine(), event_queue_size)); 251 plugin->world->set_engine(interface); 252 plugin->world->local_engine()->add_event_source(interface); 253 254 Raul::Thread::get().set_context(THREAD_PRE_PROCESS); 255 ThreadManager::single_threaded = true; 256 257 ProcessContext context(*engine.get()); 258 259 // FIXME: fixed (or at least maximum) buffer size 260 engine->set_driver(SharedPtr<Driver>(new LV2Driver(*engine.get(), rate, 4096))); 261 262 engine->activate(); 263 ThreadManager::single_threaded = true; 264 265 // FIXME: don't load all plugins, only necessary ones 266 plugin->world->engine()->load_plugins(); 267 engine->process_events(context); 268 269 plugin->world->parser()->parse_document(plugin->world, 270 plugin->world->engine().get(), patch->filename); 271 engine->process_events(context); 272 273 engine->deactivate(); 274 275 // Activate and deactivate to create root patch, allocate buffers, etc 276 //engine->activate(); 277 //engine->deactivate(); 130 278 131 279 return (LV2_Handle)plugin; … … 134 282 135 283 static void 284 ingen_connect_port(LV2_Handle instance, uint32_t port, void* data) 285 { 286 } 287 288 289 static void 290 ingen_activate(LV2_Handle instance) 291 { 292 IngenPlugin* me = (IngenPlugin*)instance; 293 me->world->local_engine()->activate(); 294 } 295 296 297 static void 136 298 ingen_run(LV2_Handle instance, uint32_t sample_count) 137 299 { 138 IngenPlugin* plugin = (IngenPlugin*)instance; 139 ((IngenLV2Driver*)plugin->engine->driver())->run(sample_count); 300 IngenPlugin* me = (IngenPlugin*)instance; 301 // FIXME: don't do this every call 302 Raul::Thread::get().set_context(THREAD_PROCESS); 303 ((LV2::LV2Driver*)me->world->local_engine()->driver())->run(sample_count); 304 } 305 306 307 static void 308 ingen_deactivate(LV2_Handle instance) 309 { 310 IngenPlugin* me = (IngenPlugin*)instance; 311 me->world->local_engine()->deactivate(); 312 } 313 314 315 static void 316 ingen_cleanup(LV2_Handle instance) 317 { 318 IngenPlugin* me = (IngenPlugin*)instance; 319 me->world->set_local_engine(SharedPtr<Engine>()); 320 me->world->set_engine(SharedPtr<EngineInterface>()); 321 //ingen_world_free(me->world); 322 free(instance); 140 323 } 141 324 … … 148 331 149 332 150 static void 151 ingen_deactivate(LV2_Handle instance) 152 { 153 IngenPlugin* plugin = (IngenPlugin*)instance; 154 plugin->engine->deactivate(); 155 } 156 157 158 /* Library */ 159 160 static LV2_Descriptor *ingen_descriptor = NULL; 161 162 static void 163 init_descriptor() 164 { 165 ingen_descriptor = (LV2_Descriptor*)malloc(sizeof(LV2_Descriptor)); 166 167 ingen_descriptor->URI = PLUGIN_URI; 168 ingen_descriptor->instantiate = ingen_instantiate; 169 ingen_descriptor->connect_port = ingen_connect_port; 170 ingen_descriptor->activate = ingen_activate; 171 ingen_descriptor->run = ingen_run; 172 ingen_descriptor->deactivate = ingen_deactivate; 173 ingen_descriptor->cleanup = ingen_cleanup; 174 ingen_descriptor->extension_data = ingen_extension_data; 175 } 176 333 /* Library Code */ 334 335 namespace Ingen { 336 namespace LV2 { 337 338 LV2Patch::LV2Patch(const std::string& u, const std::string& f) 339 : uri(u), filename(f) 340 { 341 descriptor.URI = uri.c_str(); 342 descriptor.instantiate = ingen_instantiate; 343 descriptor.connect_port = ingen_connect_port; 344 descriptor.activate = ingen_activate; 345 descriptor.run = ingen_run; 346 descriptor.deactivate = ingen_deactivate; 347 descriptor.cleanup = ingen_cleanup; 348 descriptor.extension_data = ingen_extension_data; 349 } 350 351 } // namespace LV2 352 } // namespace Ingen 353 354 355 static void 356 init() 357 { 358 Shared::set_bundle_path_from_code((void*)&init); 359 360 using namespace LV2; 361 362 //Shared::World* world = ingen_world_new(&conf, argc, argv); 363 364 world = ingen_world_new(&conf, argc, argv); 365 if (!world->load("ingen_serialisation")) { 366 Raul::error << "Unable to load serialisation module" << std::endl; 367 //ingen_world_free(world); 368 return; 369 } 370 371 372 Serialisation::Parser::PatchRecords records( 373 world->parser()->find_patches(world, 374 Glib::filename_to_uri(Shared::bundle_file_path("manifest.ttl")))); 375 376 for (Serialisation::Parser::PatchRecords::iterator i = records.begin(); 377 i != records.end(); ++i) { 378 patches.push_back(SharedPtr<const LV2Patch>( 379 new LV2Patch(i->uri.str(), i->filename))); 380 } 381 382 383 //ingen_world_free(world); 384 385 initialised = true; 386 } 387 388 389 /* LV2 Library Interface */ 390 391 extern "C" { 177 392 178 393 LV2_SYMBOL_EXPORT … … 180 395 lv2_descriptor(uint32_t index) 181 396 { 182 if (!ingen_descriptor) 183 init_descriptor(); 184 185 switch (index) { 186 case 0: 187 return ingen_descriptor; 188 default: 397 if (!LV2::initialised) 398 init(); 399 400 if (index >= LV2::patches.size()) 189 401 return NULL; 190 } 402 else 403 return &LV2::patches[index]->descriptor; 404 } 405 191 406 } 192 407 -
trunk/ingen/src/engine/ingen_osc.cpp
r2349 r2533 28 28 void load(Ingen::Shared::World* world) { 29 29 SharedPtr<OSCEngineReceiver> interface( 30 new Ingen::OSCEngineReceiver(*world->local_engine .get(),30 new Ingen::OSCEngineReceiver(*world->local_engine().get(), 31 31 event_queue_size, 32 world->conf ->option("engine-port").get_int32()));33 world->local_engine ->add_event_source(interface);32 world->conf()->option("engine-port").get_int32())); 33 world->local_engine()->add_event_source(interface); 34 34 } 35 35 }; -
trunk/ingen/src/engine/internals/Controller.cpp
r2486 r2533 37 37 using namespace Shared; 38 38 39 static InternalPlugin controller_plugin(NS_INTERNALS "Controller", "controller"); 39 InternalPlugin* ControllerNode::internal_plugin(Shared::LV2URIMap& uris) { 40 return new InternalPlugin(uris, NS_INTERNALS "Controller", "controller"); 41 } 40 42 41 InternalPlugin& ControllerNode::internal_plugin() { return controller_plugin; } 42 43 ControllerNode::ControllerNode(BufferFactory& bufs, 44 const string& path, 45 bool polyphonic, 46 PatchImpl* parent, 47 SampleRate srate) 48 : NodeImpl(&controller_plugin, path, false, parent, srate) 43 ControllerNode::ControllerNode(InternalPlugin* plugin, 44 BufferFactory& bufs, 45 const string& path, 46 bool polyphonic, 47 PatchImpl* parent, 48 SampleRate srate) 49 : NodeImpl(plugin, path, false, parent, srate) 49 50 , _learning(false) 50 51 { 51 const LV2URIMap& uris = Shared::LV2URIMap::instance();52 const LV2URIMap& uris = bufs.uris(); 52 53 _ports = new Raul::Array<PortImpl*>(6); 53 54 -
trunk/ingen/src/engine/internals/Controller.hpp
r2486 r2533 41 41 { 42 42 public: 43 ControllerNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); 43 ControllerNode( 44 InternalPlugin* plugin, 45 BufferFactory& bufs, 46 const std::string& path, 47 bool polyphonic, 48 PatchImpl* parent, 49 SampleRate srate); 44 50 45 51 void process(ProcessContext& context); … … 49 55 void learn() { _learning = true; } 50 56 51 static InternalPlugin & internal_plugin();57 static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); 52 58 53 59 private: -
trunk/ingen/src/engine/internals/Delay.cpp
r2486 r2533 50 50 static const float MAX_DELAY_SECONDS = 8.0f; 51 51 52 static InternalPlugin note_plugin(NS_INTERNALS "Delay", "delay"); 53 54 InternalPlugin& DelayNode::internal_plugin() { return note_plugin; } 55 56 DelayNode::DelayNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate) 57 : NodeImpl(¬e_plugin, path, polyphonic, parent, srate) 52 InternalPlugin* DelayNode::internal_plugin(Shared::LV2URIMap& uris) { 53 return new InternalPlugin(uris, NS_INTERNALS "Delay", "delay"); 54 } 55 56 DelayNode::DelayNode( 57 InternalPlugin* plugin, 58 BufferFactory& bufs, 59 const std::string& path, 60 bool polyphonic, 61 PatchImpl* parent, 62 SampleRate srate) 63 : NodeImpl(plugin, path, polyphonic, parent, srate) 58 64 , _buffer(0) 59 65 , _buffer_length(0) … … 61 67 , _write_phase(0) 62 68 { 63 const LV2URIMap& uris = Shared::LV2URIMap::instance();69 const LV2URIMap& uris = bufs.uris(); 64 70 _ports = new Raul::Array<PortImpl*>(3); 65 71 -
trunk/ingen/src/engine/internals/Delay.hpp
r2486 r2533 45 45 { 46 46 public: 47 DelayNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); 47 DelayNode( 48 InternalPlugin* plugin, 49 BufferFactory& bufs, 50 const std::string& path, 51 bool polyphonic, 52 PatchImpl* parent, 53 SampleRate srate); 54 48 55 ~DelayNode(); 49 56 … … 52 59 void process(ProcessContext& context); 53 60 54 static InternalPlugin & internal_plugin();61 static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); 55 62 56 63 float delay_samples() const { return _delay_samples; } -
trunk/ingen/src/engine/internals/Note.cpp
r2486 r2533 44 44 using namespace Shared; 45 45 46 static InternalPlugin note_plugin(NS_INTERNALS "Note", "note"); 47 48 InternalPlugin& NoteNode::internal_plugin() { return note_plugin; } 49 50 NoteNode::NoteNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate) 51 : NodeImpl(¬e_plugin, path, polyphonic, parent, srate) 46 InternalPlugin* NoteNode::internal_plugin(Shared::LV2URIMap& uris) { 47 return new InternalPlugin(uris, NS_INTERNALS "Note", "note"); 48 } 49 50 NoteNode::NoteNode( 51 InternalPlugin* plugin, 52 BufferFactory& bufs, 53 const std::string& path, 54 bool polyphonic, 55 PatchImpl* parent, 56 SampleRate srate) 57 : NodeImpl(plugin, path, polyphonic, parent, srate) 52 58 , _voices(new Raul::Array<Voice>(_polyphony)) 53 59 , _prepared_voices(NULL) 54 60 , _sustain(false) 55 61 { 56 const LV2URIMap& uris = Shared::LV2URIMap::instance();62 const LV2URIMap& uris = bufs.uris(); 57 63 _ports = new Raul::Array<PortImpl*>(5); 64 65 66 std::cout << "NEW NOTE NODE" << std::endl; 58 67 59 68 _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); -
trunk/ingen/src/engine/internals/Note.hpp
r2486 r2533 41 41 { 42 42 public: 43 NoteNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); 43 NoteNode( 44 InternalPlugin* plugin, 45 BufferFactory& bufs, 46 const std::string& path, 47 bool polyphonic, 48 PatchImpl* parent, 49 SampleRate srate); 50 44 51 ~NoteNode(); 45 52 … … 56 63 void sustain_off(ProcessContext& context, FrameTime time); 57 64 58 static InternalPlugin & internal_plugin();65 static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); 59 66 60 67 private: -
trunk/ingen/src/engine/internals/Trigger.cpp
r2486 r2533 40 40 using namespace Shared; 41 41 42 static InternalPlugin trigger_plugin(NS_INTERNALS "Trigger", "trigger"); 42 InternalPlugin* TriggerNode::internal_plugin(Shared::LV2URIMap& uris) { 43 return new InternalPlugin(uris, NS_INTERNALS "Trigger", "trigger"); 44 } 43 45 44 InternalPlugin& TriggerNode::internal_plugin() { return trigger_plugin; } 45 46 TriggerNode::TriggerNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate) 47 : NodeImpl(&trigger_plugin, path, false, parent, srate) 46 TriggerNode::TriggerNode( 47 InternalPlugin* plugin, 48 BufferFactory& bufs, 49 const std::string& path, 50 bool polyphonic, 51 PatchImpl* parent, 52 SampleRate srate) 53 : NodeImpl(plugin, path, false, parent, srate) 48 54 , _learning(false) 49 55 { 50 const LV2URIMap& uris = LV2URIMap::instance();56 const LV2URIMap& uris = bufs.uris(); 51 57 _ports = new Raul::Array<PortImpl*>(5); 52 58 -
trunk/ingen/src/engine/internals/Trigger.hpp
r2486 r2533 44 44 { 45 45 public: 46 TriggerNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); 46 TriggerNode( 47 InternalPlugin* plugin, 48 BufferFactory& bufs, 49 const std::string& path, 50 bool polyphonic, 51 PatchImpl* parent, 52 SampleRate srate); 47 53 48 54 void process(ProcessContext& context); … … 53 59 void learn() { _learning = true; } 54 60 55 static InternalPlugin & internal_plugin();61 static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); 56 62 57 63 private: -
trunk/ingen/src/engine/JackDriver.cpp
r2492 r2533 193 193 , _root_patch(NULL) 194 194 { 195 _midi_event_type = _engine.world()->uris ->uri_to_id(195 _midi_event_type = _engine.world()->uris()->uri_to_id( 196 196 NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent"); 197 197 } … … 275 275 276 276 if (!_client) 277 attach(_engine.world()->conf ->option("jack-server").get_string(),278 _engine.world()->conf ->option("jack-client").get_string(), NULL);277 attach(_engine.world()->conf()->option("jack-server").get_string(), 278 _engine.world()->conf()->option("jack-client").get_string(), NULL); 279 279 280 280 jack_set_process_callback(_client, process_cb, this); … … 339 339 * It is the callers responsibility to delete the returned port. 340 340 */ 341 Raul:: List<DriverPort*>::Node*342 JackDriver::remove_port(const Path& path )341 Raul::Deletable* 342 JackDriver::remove_port(const Path& path, DriverPort** port) 343 343 { 344 344 ThreadManager::assert_thread(THREAD_PROCESS); 345 345 346 for (Raul::List<JackPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) 347 if ((*i)->patch_port()->path() == path) 348 return (Raul::List<DriverPort*>::Node*)(_ports.erase(i)); 346 for (Raul::List<JackPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) { 347 if ((*i)->patch_port()->path() == path) { 348 Raul::List<Ingen::JackPort*>::Node* node = _ports.erase(i); 349 if (port) 350 *port = node->elem(); 351 return node; 352 } 353 } 349 354 350 355 LOG(warn) << "Unable to find port " << path << endl; -
trunk/ingen/src/engine/JackDriver.hpp
r2468 r2533 98 98 DriverPort* driver_port(const Raul::Path& path); 99 99 100 Raul:: List<DriverPort*>::Node* remove_port(const Raul::Path& path);100 Raul::Deletable* remove_port(const Raul::Path& path, DriverPort** port=NULL); 101 101 102 102 PatchImpl* root_patch() { return _root_patch; } -
trunk/ingen/src/engine/LADSPANode.cpp
r2492 r2533 134 134 LADSPANode::instantiate(BufferFactory& bufs) 135 135 { 136 const LV2URIMap& uris = Shared::LV2URIMap::instance();136 const LV2URIMap& uris = bufs.uris(); 137 137 if (!_ports) 138 138 _ports = new Raul::Array<PortImpl*>(_descriptor->PortCount); -
trunk/ingen/src/engine/LADSPAPlugin.cpp
r2468 r2533 32 32 33 33 LADSPAPlugin::LADSPAPlugin( 34 Shared::LV2URIMap& uris, 34 35 const std::string& library_path, 35 36 const std::string& uri, … … 37 38 const std::string& label, 38 39 const std::string& name) 39 : PluginImpl( Plugin::LADSPA, uri, library_path)40 : PluginImpl(uris, Plugin::LADSPA, uri, library_path) 40 41 , _id(id) 41 42 , _label(label) 42 43 , _name(name) 43 44 { 44 const LV2URIMap& uris = Shared::LV2URIMap::instance();45 45 set_property(uris.rdf_type, uris.ingen_LADSPAPlugin); 46 46 set_property(uris.lv2_symbol, Symbol::symbolify(label)); … … 52 52 LADSPAPlugin::get_property(const Raul::URI& uri) const 53 53 { 54 if (uri == Shared::LV2URIMap::instance().doap_name)54 if (uri == _uris.doap_name) 55 55 return _name; 56 56 else -
trunk/ingen/src/engine/LADSPAPlugin.hpp
r2398 r2533 38 38 { 39 39 public: 40 LADSPAPlugin(const std::string& library_path, 41 const std::string& uri, 42 unsigned long id, 43 const std::string& label, 44 const std::string& name); 40 LADSPAPlugin( 41 Shared::LV2URIMap& uris, 42 const std::string& library_path, 43 const std::string& uri, 44 unsigned long id, 45 const std::string& label, 46 const std::string& name); 45 47 46 48 NodeImpl* instantiate(BufferFactory& bufs, -
trunk/ingen/src/engine/LV2Info.cpp
r2349 r2533 32 32 33 33 LV2Info::LV2Info(Ingen::Shared::World* world) 34 : input_class(slv2_value_new_uri(world->slv2_world , SLV2_PORT_CLASS_INPUT))35 , output_class(slv2_value_new_uri(world->slv2_world , SLV2_PORT_CLASS_OUTPUT))36 , control_class(slv2_value_new_uri(world->slv2_world , SLV2_PORT_CLASS_CONTROL))37 , audio_class(slv2_value_new_uri(world->slv2_world , SLV2_PORT_CLASS_AUDIO))38 , event_class(slv2_value_new_uri(world->slv2_world , SLV2_PORT_CLASS_EVENT))39 , value_port_class(slv2_value_new_uri(world->slv2_world , LV2_OBJECT_URI "#ValuePort"))40 , message_port_class(slv2_value_new_uri(world->slv2_world , LV2_OBJECT_URI "#MessagePort"))34 : input_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_INPUT)) 35 , output_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_OUTPUT)) 36 , control_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_CONTROL)) 37 , audio_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_AUDIO)) 38 , event_class(slv2_value_new_uri(world->slv2_world(), SLV2_PORT_CLASS_EVENT)) 39 , value_port_class(slv2_value_new_uri(world->slv2_world(), LV2_OBJECT_URI "#ValuePort")) 40 , message_port_class(slv2_value_new_uri(world->slv2_world(), LV2_OBJECT_URI "#MessagePort")) 41 41 , _world(world) 42 42 { 43 43 assert(world); 44 44 45 world->lv2_features ->add_feature(LV2_EVENT_URI,45 world->lv2_features()->add_feature(LV2_EVENT_URI, 46 46 SharedPtr<Shared::LV2Features::Feature>(new EventFeature())); 47 world->lv2_features ->add_feature(LV2_BLOB_SUPPORT_URI,47 world->lv2_features()->add_feature(LV2_BLOB_SUPPORT_URI, 48 48 SharedPtr<Shared::LV2Features::Feature>(new BlobFeature())); 49 world->lv2_features ->add_feature(LV2_RESIZE_PORT_URI,49 world->lv2_features()->add_feature(LV2_RESIZE_PORT_URI, 50 50 SharedPtr<Shared::LV2Features::Feature>(new ResizeFeature())); 51 51 } -
trunk/ingen/src/engine/LV2Info.hpp
r2398 r2533 55 55 56 56 Ingen::Shared::World& world() { return *_world; } 57 SLV2World lv2_world() { return _world->slv2_world ; }57 SLV2World lv2_world() { return _world->slv2_world(); } 58 58 59 59 private: -
trunk/ingen/src/engine/LV2Node.cpp
r2518 r2533 139 139 LV2Node::instantiate(BufferFactory& bufs) 140 140 { 141 const LV2URIMap& uris = Shared::LV2URIMap::instance();141 const LV2URIMap& uris = bufs.uris(); 142 142 SharedPtr<LV2Info> info = _lv2_plugin->lv2_info(); 143 143 SLV2Plugin plug = _lv2_plugin->slv2_plugin(); … … 149 149 _instances = new Instances(_polyphony, SharedPtr<void>()); 150 150 151 _features = info->world().lv2_features ->lv2_features(this);151 _features = info->world().lv2_features()->lv2_features(this); 152 152 153 153 uint32_t port_buffer_size = 0; … … 310 310 for (uint32_t i = 0; i < slv2_values_size(types); ++i) { 311 311 SLV2Value type = slv2_values_get_at(types, i); 312 std::cout<< path() << " port " << id << " supports " <<313 slv2_value_as_uri(type) << std::endl;312 Raul::info << path() << " port " << id << " supports " << 313 slv2_value_as_uri(type) << std::endl; 314 314 if (slv2_value_is_uri(type)) { 315 315 port->add_property(uris.obj_supports, Raul::URI(slv2_value_as_uri(type))); -
trunk/ingen/src/engine/LV2Plugin.cpp
r2468 r2533 33 33 34 34 LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri) 35 : PluginImpl( Plugin::LV2, uri)35 : PluginImpl(*lv2_info->world().uris().get(), Plugin::LV2, uri) 36 36 , _slv2_plugin(NULL) 37 37 , _lv2_info(lv2_info) 38 38 { 39 const LV2URIMap& uris = Shared::LV2URIMap::instance(); 40 set_property(uris.rdf_type, uris.lv2_Plugin); 39 set_property(_uris.rdf_type, _uris.lv2_Plugin); 41 40 } 42 41 … … 74 73 load(); // FIXME: unload at some point 75 74 76 Glib::Mutex::Lock lock(engine.world()->rdf_world ->mutex());75 Glib::Mutex::Lock lock(engine.world()->rdf_world()->mutex()); 77 76 LV2Node* n = new LV2Node(this, name, polyphonic, parent, srate); 78 77 -
trunk/ingen/src/engine/MessageContext.cpp
r2491 r2533 38 38 MessageContext::run(PortImpl* port, FrameTime time) 39 39 { 40 if (ThreadManager:: current_thread_id() == THREAD_PRE_PROCESS) {40 if (ThreadManager::thread_is(THREAD_PRE_PROCESS)) { 41 41 assert(port); 42 42 Glib::Mutex::Lock lock(_mutex); … … 44 44 _sem.post(); 45 45 _cond.wait(_mutex); 46 } else if (ThreadManager:: current_thread_id() == THREAD_PROCESS) {46 } else if (ThreadManager::thread_is(THREAD_PROCESS)) { 47 47 Request r(time, port); 48 48 _requests.write(sizeof(Request), &r); 49 49 // signal() will be called at the end of this process cycle 50 } else if (ThreadManager:: current_thread_id() == THREAD_MESSAGE) {50 } else if (ThreadManager::thread_is(THREAD_MESSAGE)) { 51 51 warn << "Message context recursion at " << port->path() << endl; 52 52 } else { -
trunk/ingen/src/engine/NodeFactory.cpp
r2518 r2533 67 67 { 68 68 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) 69 if (i->second->type() != Shared::Plugin::Internal) 70 delete i->second; 69 delete i->second; 71 70 72 71 _plugins.clear(); … … 112 111 ThreadManager::assert_thread(THREAD_PRE_PROCESS); 113 112 114 _world->rdf_world ->mutex().lock();113 _world->rdf_world()->mutex().lock(); 115 114 116 115 // Only load if we havn't already, so every client connecting doesn't cause … … 133 132 } 134 133 135 _world->rdf_world ->mutex().unlock();134 _world->rdf_world()->mutex().unlock(); 136 135 } 137 136 … … 140 139 NodeFactory::load_internal_plugins() 141 140 { 142 InternalPlugin& controller_plug = ControllerNode::internal_plugin(); 143 _plugins.insert(make_pair(controller_plug.uri(), &controller_plug)); 144 145 InternalPlugin& delay_plug = DelayNode::internal_plugin(); 146 _plugins.insert(make_pair(delay_plug.uri(), &delay_plug)); 147 148 InternalPlugin& note_plug = NoteNode::internal_plugin(); 149 _plugins.insert(make_pair(note_plug.uri(), ¬e_plug)); 150 151 InternalPlugin& trigger_plug = TriggerNode::internal_plugin(); 152 _plugins.insert(make_pair(trigger_plug.uri(), &trigger_plug)); 141 Shared::LV2URIMap& uris = *_world->uris().get(); 142 InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris); 143 _plugins.insert(make_pair(controller_plug->uri(), controller_plug)); 144 145 InternalPlugin* delay_plug = DelayNode::internal_plugin(uris); 146 _plugins.insert(make_pair(delay_plug->uri(), delay_plug)); 147 148 InternalPlugin* note_plug = NoteNode::internal_plugin(uris); 149 _plugins.insert(make_pair(note_plug->uri(), note_plug)); 150 151 InternalPlugin* trigger_plug = TriggerNode::internal_plugin(uris); 152 _plugins.insert(make_pair(trigger_plug->uri(), trigger_plug)); 153 153 } 154 154 … … 160 160 NodeFactory::load_lv2_plugins() 161 161 { 162 SLV2Plugins plugins = slv2_world_get_all_plugins(_world->slv2_world );162 SLV2Plugins plugins = slv2_world_get_all_plugins(_world->slv2_world()); 163 163 164 164 for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) { … … 178 178 } 179 179 180 slv2_plugins_free(_world->slv2_world , plugins);180 slv2_plugins_free(_world->slv2_world(), plugins); 181 181 } 182 182 #endif // HAVE_SLV2 … … 255 255 256 256 if (i == _plugins.end()) { 257 LADSPAPlugin* plugin = new LADSPAPlugin(lib_path, uri, 258 descriptor->UniqueID, 259 descriptor->Label, 260 descriptor->Name); 257 LADSPAPlugin* plugin = new LADSPAPlugin(*_world->uris().get(), 258 lib_path, uri, 259 descriptor->UniqueID, 260 descriptor->Label, 261 descriptor->Name); 261 262 262 263 _plugins.insert(make_pair(uri, plugin)); -
trunk/ingen/src/engine/NodeImpl.cpp
r2501 r2533 37 37 38 38 NodeImpl::NodeImpl(PluginImpl* plugin, const Raul::Symbol& symbol, bool polyphonic, PatchImpl* parent, SampleRate srate) 39 : GraphObjectImpl(p arent, symbol)39 : GraphObjectImpl(plugin->uris(), parent, symbol) 40 40 , _plugin(plugin) 41 41 , _polyphonic(polyphonic) -
trunk/ingen/src/engine/ObjectSender.cpp
r2492 r2533 137 137 client->put(port->meta_uri(), port->meta().properties()); 138 138 139 const Shared::LV2URIMap& map = Shared::LV2URIMap::instance();140 141 139 client->put(port->path(), port->properties()); 142 140 143 141 // Send control value 144 142 if (port->is_a(PortType::CONTROL)) 145 client->set_property(port->path(), map.ingen_value, port->value());143 client->set_property(port->path(), port->bufs().uris().ingen_value, port->value()); 146 144 147 145 if (bundle) -
trunk/ingen/src/engine/OutputPort.cpp
r2494 r2533 40 40 : PortImpl(bufs, parent, symbol, index, poly, type, value, buffer_size) 41 41 { 42 const LV2URIMap& uris = Shared::LV2URIMap::instance();43 44 42 if (!dynamic_cast<Patch*>(parent)) 45 add_property( uris.rdf_type, uris.lv2_OutputPort);43 add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort); 46 44 47 45 if (type == PortType::CONTROL) -
trunk/ingen/src/engine/PatchImpl.cpp
r2499 r2533 19 19 #include <cmath> 20 20 #include "raul/log.hpp" 21 #include "module/World.hpp" 22 #include "shared/LV2URIMap.hpp" 21 23 #include "ThreadManager.hpp" 22 24 #include "NodeImpl.hpp" … … 40 42 41 43 PatchImpl::PatchImpl(Engine& engine, const Raul::Symbol& symbol, uint32_t poly, PatchImpl* parent, SampleRate srate, uint32_t internal_poly) 42 : NodeImpl(new PatchPlugin("http://example.org/FIXME", "patch", "Ingen Patch"), 44 : NodeImpl(new PatchPlugin(*engine.world()->uris().get(), 45 engine.world()->uris()->ingen_Patch.c_str(), "patch", "Ingen Patch"), 43 46 symbol, poly, parent, srate) 44 47 , _engine(engine) … … 339 342 PatchImpl::num_ports() const 340 343 { 341 ThreadID context = ThreadManager::current_thread_id(); 342 343 if (context == THREAD_PROCESS) 344 if (ThreadManager::thread_is(THREAD_PROCESS)) 344 345 return NodeImpl::num_ports(); 345 346 else -
trunk/ingen/src/engine/PatchPlugin.hpp
r2398 r2533 36 36 { 37 37 public: 38 PatchPlugin(const std::string& uri, 39 const std::string& symbol, 40 const std::string& name) 41 : PluginImpl(Plugin::Patch, uri) 38 PatchPlugin( 39 Shared::LV2URIMap& uris, 40 const std::string& uri, 41 const std::string& symbol, 42 const std::string& name) 43 : PluginImpl(uris, Plugin::Patch, uri) 42 44 {} 43 45 -
trunk/ingen/src/engine/PluginImpl.hpp
r2398 r2533 29 29 namespace Ingen { 30 30 31 namespace Shared { class LV2URIMap; } 32 31 33 class PatchImpl; 32 34 class NodeImpl; … … 44 46 { 45 47 public: 46 PluginImpl(Type type, const std::string& uri, const std::string library_path="") 47 : ResourceImpl(uri) 48 PluginImpl(Shared::LV2URIMap& uris, 49 Type type, const std::string& uri, const std::string library_path="") 50 : ResourceImpl(uris, uri) 48 51 , _type(type) 49 52 , _library_path(library_path) -
trunk/ingen/src/engine/PortImpl.cpp
r2494 r2533 49 49 const Atom& value, 50 50 size_t buffer_size) 51 : GraphObjectImpl( node, name)51 : GraphObjectImpl(bufs.uris(), node, name) 52 52 , _bufs(bufs) 53 53 , _index(index) … … 70 70 _buffer_size = bufs.default_buffer_size(type); 71 71 72 const LV2URIMap& uris = Shared::LV2URIMap::instance();72 const LV2URIMap& uris = bufs.uris(); 73 73 add_property(uris.rdf_type, type.uri()); 74 74 set_property(uris.lv2_index, Atom((int32_t)index)); … … 89 89 PortImpl::supports(const Raul::URI& value_type) const 90 90 { 91 return has_property( Shared::LV2URIMap::instance().obj_supports, value_type);91 return has_property(_bufs.uris().obj_supports, value_type); 92 92 } 93 93 … … 228 228 case PortType::VALUE: 229 229 case PortType::MESSAGE: 230 LV2Object::to_atom( ((ObjectBuffer*)buffer(0).get())->object(), val);230 LV2Object::to_atom(_bufs.uris(), ((ObjectBuffer*)buffer(0).get())->object(), val); 231 231 break; 232 232 } … … 243 243 PortImpl::set_context(Context::ID c) 244 244 { 245 const LV2URIMap& uris = Shared::LV2URIMap::instance();245 const LV2URIMap& uris = _bufs.uris(); 246 246 _context = c; 247 247 switch (c) { 248 248 case Context::AUDIO: 249 set_property(uris.ctx_context, uris.ctx_AudioContext);249 remove_property(uris.ctx_context, uris.wildcard); 250 250 break; 251 251 case Context::MESSAGE: -
trunk/ingen/src/engine/PortImpl.hpp
r2494 r2533 137 137 void set_context(Context::ID c); 138 138 139 BufferFactory& bufs() const { return _bufs; } 140 139 141 protected: 140 142 PortImpl(BufferFactory& bufs, -
trunk/ingen/src/engine/QueuedEngineInterface.cpp
r2504 r2533 226 226 Path path = meta ? (string("/") + path.chop_start("/")) : uri.str(); 227 227 Resource::Properties remove; 228 remove.insert(make_pair(predicate, Shared::LV2URIMap::instance().wildcard));228 remove.insert(make_pair(predicate, _engine.world()->uris()->wildcard)); 229 229 Resource::Properties add; 230 230 add.insert(make_pair(predicate, value)); -
trunk/ingen/src/engine/ThreadManager.hpp
r2398 r2533 35 35 class ThreadManager { 36 36 public: 37 inline static ThreadID current_thread_id() {38 return (ThreadID)Raul::Thread::get().context();37 inline static bool thread_is(ThreadID id) { 38 return Raul::Thread::get().is_context(id); 39 39 } 40 40 41 41 inline static void assert_thread(ThreadID id) { 42 assert(single_threaded || current_thread_id() == id);42 assert(single_threaded || Raul::Thread::get().is_context(id)); 43 43 } 44 44 45 45 inline static void assert_not_thread(ThreadID id) { 46 assert(single_threaded || current_thread_id() != id);46 assert(single_threaded || !Raul::Thread::get().is_context(id)); 47 47 } 48 48 -
trunk/ingen/src/engine/wscript
r2506 r2533 59 59 internals/Trigger.cpp 60 60 ''' 61 61 62 if bld.env['HAVE_LADSPA_H'] == 1: 63 core_source += ' LADSPAPlugin.cpp LADSPANode.cpp ' 64 if bld.env['HAVE_SLV2'] == 1: 65 core_source += ' LV2Info.cpp LV2Plugin.cpp LV2Node.cpp ' 66 62 67 obj = bld.new_task_gen('cxx', 'shlib') 63 68 obj.source = core_source 64 if bld.env['HAVE_LADSPA_H'] == 1:65 obj.source += ' LADSPAPlugin.cpp LADSPANode.cpp '66 if bld.env['HAVE_SLV2'] == 1:67 obj.source += ' LV2Info.cpp LV2Plugin.cpp LV2Node.cpp '68 69 obj.export_incdirs = ['.'] 69 70 obj.includes = ['.', '..', '../..', '../common'] … … 116 117 autowaf.use_lib(bld, obj, core_libs + ' JACK') 117 118 118 # Lightweight ingen/lv2 wrapper 119 #obj = bld.new_task_gen('cxx', 'shlib') 120 #obj.source = core_source 121 #if bld.env['HAVE_LADSPA_H'] == 1: 122 # obj.source += ' LADSPAPlugin.cpp LADSPANode.cpp ' 123 #if bld.env['HAVE_SLV2'] == 1: 124 # obj.source += ' LV2Plugin.cpp LV2Node.cpp ' 125 #obj.export_incdirs = ['.'] 126 #obj.includes = ['.', '..', '../common', './events'] 127 #obj.name = 'ingen_lv2' 128 #obj.target = 'ingen.lv2/ingen_lv2' 129 #obj.install_path = '' 130 #core_libs = 'GLIBMM GTHREAD LV2CORE SLV2 RAUL REDLANDMM' 131 #autowaf.use_lib(bld, obj, core_libs) 132 133 119 # Ingen LV2 wrapper 120 obj = bld.new_task_gen('cxx', 'shlib') 121 obj.source = ' ingen_lv2.cpp ' 122 obj.export_incdirs = ['.'] 123 obj.includes = ['.', '..', '../..', '../common'] 124 obj.name = 'libingen_lv2' 125 obj.target = 'ingen_lv2' 126 obj.install_path = '${LIBDIR}/ingen' 127 obj.uselib_local = 'libingen_shared libingen_module' 128 obj.add_objects = 'libingen_engine' 129 autowaf.use_lib(bld, obj, core_libs) -
trunk/ingen/src/gui/App.cpp
r2515 r2533 91 91 _about_dialog->property_logo_icon_name() = "ingen"; 92 92 93 PluginModel::set_rdf_world(*world->rdf_world );93 PluginModel::set_rdf_world(*world->rdf_world()); 94 94 95 95 #ifdef HAVE_SLV2 96 PluginModel::set_slv2_world(world->slv2_world );96 PluginModel::set_slv2_world(world->slv2_world()); 97 97 #endif 98 98 } … … 110 110 { 111 111 Gnome::Canvas::init(); 112 _main = new Gtk::Main( world->argc, world->argv);112 _main = new Gtk::Main(&world->argc(), &world->argv()); 113 113 114 114 if (!_instance) … … 170 170 assert( ! _loader); 171 171 172 _world->engine ->register_client(client.get());172 _world->engine()->register_client(client.get()); 173 173 174 174 _client = client; 175 175 _handle = handle; 176 _store = SharedPtr<ClientStore>(new ClientStore(_world-> engine, client));177 _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world-> engine));176 _store = SharedPtr<ClientStore>(new ClientStore(_world->uris(), _world->engine(), client)); 177 _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->uris(), _world->engine())); 178 178 179 179 _patch_tree_window->init(*_store); … … 187 187 App::detach() 188 188 { 189 if (_world->engine ) {189 if (_world->engine()) { 190 190 _window_factory->clear(); 191 191 _store->clear(); … … 195 195 _client.reset(); 196 196 _handle.reset(); 197 _world-> engine.reset();198 } 199 } 200 201 202 const SharedPtr<Serialiser>& 197 _world->set_engine(SharedPtr<EngineInterface>()); 198 } 199 } 200 201 202 SharedPtr<Serialiser> 203 203 App::serialiser() 204 204 { 205 if (!_world->serialiser )205 if (!_world->serialiser()) 206 206 _world->load("ingen_serialisation"); 207 207 208 return _world->serialiser ;208 return _world->serialiser(); 209 209 } 210 210 … … 300 300 return false; 301 301 302 if (_world->local_engine ) {303 _world->local_engine ->main_iteration();302 if (_world->local_engine()) { 303 _world->local_engine()->main_iteration(); 304 304 } else { 305 305 _enable_signal = false; … … 327 327 { 328 328 bool quit = true; 329 if (App::instance().world()->local_engine ) {329 if (App::instance().world()->local_engine()) { 330 330 Gtk::MessageDialog d(dialog_parent, 331 331 "The engine is running in this process. Quitting will terminate Ingen." -
trunk/ingen/src/gui/App.hpp
r2492 r2533 106 106 Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const std::string& path, int size); 107 107 108 const SharedPtr<Shared::EngineInterface>& engine() const { return _world->engine; }109 const SharedPtr<Client::SigClientInterface>&client() const { return _client; }110 const SharedPtr<Client::ClientStore>&store() const { return _store; }111 const SharedPtr<ThreadedLoader>&loader() const { return _loader; }108 SharedPtr<Shared::EngineInterface> engine() const { return _world->engine(); } 109 SharedPtr<Client::SigClientInterface> client() const { return _client; } 110 SharedPtr<Client::ClientStore> store() const { return _store; } 111 SharedPtr<ThreadedLoader> loader() const { return _loader; } 112 112 113 const SharedPtr<Serialisation::Serialiser>&serialiser();113 SharedPtr<Serialisation::Serialiser> serialiser(); 114 114 115 115 static inline App& instance() { assert(_instance); return *_instance; } … … 119 119 120 120 inline Ingen::Shared::World* world() const { return _world; } 121 inline Ingen::Shared::LV2URIMap& uris() const { return *_world->uris ; }121 inline Ingen::Shared::LV2URIMap& uris() const { return *_world->uris(); } 122 122 123 123 protected: -
trunk/ingen/src/gui/ConnectWindow.cpp
r2504 r2533 75 75 ConnectWindow::start(Ingen::Shared::World* world) 76 76 { 77 if (world->local_engine ) {77 if (world->local_engine()) { 78 78 _mode = INTERNAL; 79 79 if (_widgets_loaded) … … 81 81 } 82 82 83 set_connected_to(world->engine );83 set_connected_to(world->engine()); 84 84 85 85 connect(true); … … 90 90 ConnectWindow::set_connected_to(SharedPtr<Shared::EngineInterface> engine) 91 91 { 92 App::instance().world()-> engine = engine;92 App::instance().world()->set_engine(engine); 93 93 94 94 if (!_widgets_loaded) … … 112 112 _disconnect_button->set_sensitive(false); 113 113 114 if (App::instance().world()->local_engine )114 if (App::instance().world()->local_engine()) 115 115 _internal_radio->set_sensitive(true); 116 116 else … … 179 179 180 180 if (existing) 181 uri = world->engine ->uri().str();181 uri = world->engine()->uri().str(); 182 182 183 183 // Create client-side listener … … 199 199 #ifdef HAVE_LIBLO 200 200 if (scheme == "osc.udp" || scheme == "osc.tcp") 201 world-> engine = SharedPtr<EngineInterface>(new OSCEngineSender(uri));201 world->set_engine(SharedPtr<EngineInterface>(new OSCEngineSender(uri))); 202 202 #endif 203 203 #ifdef HAVE_SOUP 204 204 if (scheme == "http") 205 world-> engine = SharedPtr<EngineInterface>(new HTTPEngineSender(world, uri));205 world->set_engine(SharedPtr<EngineInterface>(new HTTPEngineSender(world, uri))); 206 206 #endif 207 207 } else { 208 uri = world->engine ->uri().str();208 uri = world->engine()->uri().str(); 209 209 scheme = uri.substr(0, uri.find(":")); 210 210 } … … 224 224 225 225 if (Raul::Process::launch(cmd)) { 226 world-> engine =SharedPtr<EngineInterface>(227 new OSCEngineSender(string("osc.udp://localhost:").append(port_str))) ;226 world->set_engine(SharedPtr<EngineInterface>( 227 new OSCEngineSender(string("osc.udp://localhost:").append(port_str)))); 228 228 229 229 // FIXME: static args … … 247 247 #endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP) 248 248 if (_mode == INTERNAL) { 249 if (!world->local_engine )249 if (!world->local_engine()) 250 250 world->load("ingen_engine"); 251 251 252 252 SharedPtr<SigClientInterface> client(new SigClientInterface()); 253 253 254 if (!world->local_engine ->driver())254 if (!world->local_engine()->driver()) 255 255 world->load("ingen_jack"); 256 256 257 world->local_engine ->activate();257 world->local_engine()->activate(); 258 258 259 259 App::instance().attach(client); -
trunk/ingen/src/gui/LoadRemotePatchWindow.cpp
r2332 r2533 67 67 _initial_data = data; 68 68 69 Redland::Model model(*App::instance().world()->rdf_world ,69 Redland::Model model(*App::instance().world()->rdf_world(), 70 70 "http://rdf.drobilla.net/ingen_patches/index.ttl", 71 71 "http://rdf.drobilla.net/ingen_patches/"); 72 72 73 Redland::Query query(*App::instance().world()->rdf_world , Glib::ustring(73 Redland::Query query(*App::instance().world()->rdf_world(), Glib::ustring( 74 74 "SELECT DISTINCT ?name ?uri WHERE {" 75 75 " ?uri a ingen:Patch ;" … … 77 77 "}")); 78 78 79 Redland::Query::Results results = query.run(*App::instance().world()->rdf_world , model);79 Redland::Query::Results results = query.run(*App::instance().world()->rdf_world(), model); 80 80 81 81 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { -
trunk/ingen/src/gui/NodeModule.cpp
r2492 r2533 121 121 122 122 if (b && node()->plugin()) { 123 Glib::Mutex::Lock lock(App::instance().world()->rdf_world ->mutex());123 Glib::Mutex::Lock lock(App::instance().world()->rdf_world()->mutex()); 124 124 const Raul::Atom& name_property = node()->get_property(uris.lv2_name); 125 125 if (name_property.type() == Atom::STRING) -
trunk/ingen/src/gui/PatchCanvas.cpp
r2523 r2533 662 662 ++_paste_count; 663 663 664 Builder builder(*App::instance().engine()); 665 ClientStore clipboard; 664 const LV2URIMap& uris = App::instance().uris(); 665 666 Builder builder(App::instance().world()->uris(), *App::instance().engine()); 667 ClientStore clipboard(App::instance().world()->uris()); 666 668 clipboard.set_plugins(App::instance().store()->plugins()); 667 669 668 const LV2URIMap& uris = App::instance().uris();669 670 670 671 // mkdir -p -
trunk/ingen/src/gui/Port.cpp
r2492 r2533 193 193 Ingen::Shared::World* const world = app.world(); 194 194 app.engine()->set_property(model()->path(), 195 world->uris ->ingen_value, Atom(value));195 world->uris()->ingen_value, Atom(value)); 196 196 PatchWindow* pw = app.window_factory()->patch_window( 197 197 PtrCast<PatchModel>(model()->parent())); … … 242 242 return NULL; 243 243 244 const Raul::Atom& context = pm->get_property(uris.ctx_context); 245 if (!context.is_valid() || context.type() != Atom::URI || context == uris.ctx_AudioContext) 244 if (pm->has_context(uris.ctx_AudioContext)) 246 245 return NULL; 247 246 -
trunk/ingen/src/gui/PropertiesWindow.cpp
r2469 r2533 19 19 #include <string> 20 20 #include "raul/log.hpp" 21 #include "module/ingen_module.hpp"22 21 #include "module/World.hpp" 23 22 #include "client/NodeModel.hpp" … … 90 89 set_title(model->path().chop_scheme() + " Properties - Ingen"); 91 90 92 Shared::World* world = ingen_get_world();91 Shared::World* world = App::instance().world(); 93 92 94 93 ostringstream ss; … … 101 100 102 101 // Column 0: Property 103 Gtk::Label* lab = manage(new Gtk::Label(world->rdf_world ->qualify(i->first.str()), 0.0, 0.5));102 Gtk::Label* lab = manage(new Gtk::Label(world->rdf_world()->qualify(i->first.str()), 0.0, 0.5)); 104 103 _table->attach(*lab, 0, 1, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK); 105 104 -
trunk/ingen/src/gui/ThreadedLoader.cpp
r2525 r2533 32 32 33 33 34 ThreadedLoader::ThreadedLoader(SharedPtr< EngineInterface> engine)34 ThreadedLoader::ThreadedLoader(SharedPtr<Shared::LV2URIMap> uris, SharedPtr<EngineInterface> engine) 35 35 : _engine(engine) 36 , _deprecated_loader( engine)36 , _deprecated_loader(uris, engine) 37 37 { 38 38 set_name("Loader"); … … 48 48 ThreadedLoader::parser() 49 49 { 50 Ingen::Shared::World* world = ingen_get_world();50 Ingen::Shared::World* world = App::instance().world(); 51 51 52 if (!world->parser )52 if (!world->parser()) 53 53 world->load("ingen_serialisation"); 54 54 55 return world->parser ;55 return world->parser(); 56 56 } 57 57 … … 80 80 _mutex.lock(); 81 81 82 Ingen::Shared::World* world = ingen_get_world();82 Ingen::Shared::World* world = App::instance().world(); 83 83 84 84 Glib::ustring engine_base = ""; … … 102 102 } else { 103 103 _events.push_back(sigc::hide_return(sigc::bind( 104 sigc::mem_fun(world->parser .get(), &Ingen::Serialisation::Parser::parse_document),104 sigc::mem_fun(world->parser().get(), &Ingen::Serialisation::Parser::parse_document), 105 105 App::instance().world(), 106 App::instance().world()->engine .get(),106 App::instance().world()->engine().get(), 107 107 document_uri, 108 108 data_path, -
trunk/ingen/src/gui/ThreadedLoader.hpp
r2398 r2533 56 56 { 57 57 public: 58 ThreadedLoader(SharedPtr< EngineInterface> engine);58 ThreadedLoader(SharedPtr<Shared::LV2URIMap> uris, SharedPtr<EngineInterface> engine); 59 59 60 60 void load_patch(bool merge, -
trunk/ingen/src/ingen/main.cpp
r2525 r2533 31 31 #include "redlandmm/World.hpp" 32 32 #include "interface/EngineInterface.hpp" 33 #include "shared/Configuration.hpp" 33 34 #include "shared/runtime_paths.hpp" 34 35 #include "module/ingen_module.hpp" … … 45 46 using namespace Ingen; 46 47 47 SharedPtr<Ingen::Engine> engine;48 Ingen::Shared::World* world = NULL; 48 49 49 50 void … … 51 52 { 52 53 cout << "ingen: Interrupted" << endl; 53 engine->quit(); 54 if (world->local_engine()) 55 world->local_engine()->quit(); 56 ingen_world_free(world); 57 exit(1); 54 58 } 55 59 … … 58 62 { 59 63 cerr << "ingen: Error: " << msg << endl; 60 ingen_ destroy_world();64 ingen_world_free(world); 61 65 exit(1); 62 66 } … … 65 69 main(int argc, char** argv) 66 70 { 67 Raul::Configuration conf("A realtime modular audio processor.", 68 "Ingen is a flexible modular system that be used in various ways.\n" 69 "The engine can run as a stand-alone server controlled via a network protocol\n" 70 "(e.g. OSC), or internal to another process (e.g. the GUI). The GUI, or other\n" 71 "clients, can communicate with the engine via any supported protocol, or host the\n" 72 "engine in the same process. Many clients can connect to an engine at once.\n\n" 73 "Examples:\n" 74 " ingen -e # Run an engine, listen for OSC\n" 75 " ingen -g # Run a GUI, connect via OSC\n" 76 " ingen -eg # Run an engine and a GUI in one process\n" 77 " ingen -egl patch.ing.ttl # Run an engine and a GUI and load a patch file\n" 78 " ingen -egl patch.ing.lv2 # Run an engine and a GUI and load a patch bundle"); 79 80 conf.add("client-port", 'C', "Client OSC port", Atom::INT, Atom()) 81 .add("connect", 'c', "Connect to engine URI", Atom::STRING, "osc.udp://localhost:16180") 82 .add("engine", 'e', "Run (JACK) engine", Atom::BOOL, false) 83 .add("engine-port", 'E', "Engine listen port", Atom::INT, 16180) 84 .add("gui", 'g', "Launch the GTK graphical interface", Atom::BOOL, false) 85 .add("help", 'h', "Print this help message", Atom::BOOL, false) 86 .add("jack-client", 'n', "JACK client name", Atom::STRING, "ingen") 87 .add("jack-server", 's', "JACK server name", Atom::STRING, "default") 88 .add("load", 'l', "Load patch", Atom::STRING, Atom()) 89 .add("parallelism", 'p', "Number of concurrent process threads", Atom::INT, 1) 90 .add("path", 'L', "Target path for loaded patch", Atom::STRING, Atom()) 91 .add("run", 'r', "Run script", Atom::STRING, Atom()); 71 Shared::Configuration conf; 92 72 93 73 // Parse command line options … … 108 88 } 109 89 90 #ifdef BUNDLE 110 91 // Set bundle path from executable location so resources/modules can be found 111 92 Shared::set_bundle_path_from_code((void*)&main); 93 #endif 112 94 113 95 SharedPtr<Shared::EngineInterface> engine_interface; … … 118 100 #endif 119 101 120 Ingen::Shared::World* world = ingen_get_world(); 121 122 world->argc = argc; 123 world->argv = argv; 124 world->conf = &conf; 125 126 // Set up RDF namespaces 127 world->rdf_world->add_prefix("dc", "http://purl.org/dc/elements/1.1/"); 128 world->rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#"); 129 world->rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#"); 130 world->rdf_world->add_prefix("ingenui", "http://drobilla.net/ns/ingenuity#"); 131 world->rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#"); 132 world->rdf_world->add_prefix("lv2ev", "http://lv2plug.in/ns/ext/event#"); 133 world->rdf_world->add_prefix("ctx", "http://lv2plug.in/ns/dev/contexts#"); 134 world->rdf_world->add_prefix("lv2midi", "http://lv2plug.in/ns/ext/midi#"); 135 world->rdf_world->add_prefix("midi", "http://drobilla.net/ns/dev/midi#"); 136 world->rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#"); 137 world->rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); 138 world->rdf_world->add_prefix("sp", "http://lv2plug.in/ns/dev/string-port#"); 139 world->rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); 102 Ingen::Shared::World* world = ingen_world_new(&conf, argc, argv); 103 104 assert(!world->local_engine()); 140 105 141 106 // Run engine … … 144 109 ingen_abort("Unable to load engine module"); 145 110 146 if (!world->local_engine )111 if (!world->local_engine()) 147 112 ingen_abort("Unable to create engine"); 148 113 149 engine = world->local_engine; 150 engine_interface = world->engine; 114 engine_interface = world->engine(); 151 115 152 116 // Not loading a GUI, load network engine interfaces … … 176 140 177 141 // Activate the engine, if we have one 178 if ( engine) {142 if (world->local_engine()) { 179 143 if (!world->load("ingen_jack")) 180 144 ingen_abort("Unable to load jack module"); 181 145 182 engine->activate();183 } 184 185 world-> engine = engine_interface;146 world->local_engine()->activate(); 147 } 148 149 world->set_engine(engine_interface); 186 150 187 151 // Load a patch … … 207 171 ingen_abort("Unable to load serialisation module"); 208 172 209 if (world->parser ) {173 if (world->parser()) { 210 174 // Assumption: Containing ':' means URI, otherwise filename 211 175 string uri = conf.option("load").get_string(); … … 221 185 if (conf.option("gui").get_bool()) 222 186 engine_interface->get("ingen:plugins"); 223 world->parser ->parse_document(187 world->parser()->parse_document( 224 188 world, engine_interface.get(), uri, data_path, parent, symbol); 225 189 … … 246 210 247 211 // Listen to OSC and run main loop 248 } else if ( engine&& !conf.option("gui").get_bool()) {212 } else if (world->local_engine() && !conf.option("gui").get_bool()) { 249 213 signal(SIGINT, ingen_interrupt); 250 214 signal(SIGTERM, ingen_interrupt); 251 engine->main(); // Block here215 world->local_engine()->main(); // Block here 252 216 } 253 217 254 218 // Shut down 255 if (engine) { 256 engine->deactivate(); 257 engine.reset(); 258 } 259 260 ingen_destroy_world(); 219 if (world->local_engine()) 220 world->local_engine()->deactivate(); 221 222 ingen_world_free(world); 261 223 262 224 return 0; -
trunk/ingen/src/module/ingen_module.cpp
r2408 r2533 29 29 extern "C" { 30 30 31 static Ingen::Shared::World* world = NULL;32 33 31 Ingen::Shared::World* 34 ingen_ get_world()32 ingen_world_new(Raul::Configuration* conf, int& argc, char**& argv) 35 33 { 36 static Ingen::Shared::World* world = NULL; 37 38 if (!world) { 39 world = new Ingen::Shared::World(); 40 world->rdf_world = new Redland::World(); 41 #ifdef HAVE_SLV2 42 world->slv2_world = slv2_world_new_using_rdf_world(world->rdf_world->world()); 43 world->lv2_features = new Ingen::Shared::LV2Features(); 44 world->uris = PtrCast<Ingen::Shared::LV2URIMap>( 45 world->lv2_features->feature(LV2_URI_MAP_URI)); 46 slv2_world_load_all(world->slv2_world); 47 #else 48 world->uris = SharedPtr<Ingen::Shared::LV2URIMap>( 49 new Ingen::Shared::LV2URIMap()); 50 #endif 51 world->engine.reset(); 52 world->local_engine.reset(); 53 } 54 55 return world; 34 return new Ingen::Shared::World(conf, argc, argv); 56 35 } 57 36 58 37 void 59 ingen_ destroy_world()38 ingen_world_free(Ingen::Shared::World* world) 60 39 { 61 if (world) { 62 world->unload_all(); 63 #ifdef HAVE_SLV2 64 slv2_world_free(world->slv2_world); 65 delete world->lv2_features; 66 #endif 67 delete world->rdf_world; 68 delete world; 69 world = NULL; 70 } 40 delete world; 71 41 } 72 42 -
trunk/ingen/src/module/ingen_module.hpp
r2398 r2533 19 19 #define INGEN_MODULE_HPP 20 20 21 namespace Raul { class Configuration; } 22 21 23 namespace Ingen { namespace Shared { class World; } } 22 24 23 25 extern "C" { 24 26 25 Ingen::Shared::World* ingen_ get_world();26 void ingen_ destroy_world();27 Ingen::Shared::World* ingen_world_new(Raul::Configuration* conf, int& argc, char**& argv); 28 void ingen_world_free(Ingen::Shared::World* world); 27 29 28 30 } // extern "C" -
trunk/ingen/src/module/World.cpp
r2414 r2533 16 16 */ 17 17 18 #include "ingen-config.h" 19 #include <boost/utility.hpp> 18 20 #include <glibmm/module.h> 19 21 #include <glibmm/miscutils.h> 20 22 #include <glibmm/fileutils.h> 23 #ifdef HAVE_SLV2 24 #include "slv2/slv2.h" 25 #endif 21 26 #include "raul/log.hpp" 22 #include " ingen-config.h"27 #include "redlandmm/World.hpp" 23 28 #include "shared/runtime_paths.hpp" 29 #include "shared/LV2Features.hpp" 30 #include "shared/LV2URIMap.hpp" 24 31 #include "World.hpp" 25 32 … … 86 93 } 87 94 95 96 struct WorldImpl : public boost::noncopyable { 97 WorldImpl(Raul::Configuration* conf, int& a_argc, char**& a_argv) 98 : argc(a_argc) 99 , argv(a_argv) 100 , conf(conf) 101 , lv2_features(NULL) 102 , rdf_world(new Redland::World()) 103 , uris(new Shared::LV2URIMap()) 104 #ifdef HAVE_SLV2 105 , slv2_world(slv2_world_new_using_rdf_world(rdf_world->c_obj())) 106 #endif 107 { 108 #ifdef HAVE_SLV2 109 lv2_features = new Ingen::Shared::LV2Features(); 110 lv2_features->add_feature(LV2_URI_MAP_URI, uris); 111 slv2_world_load_all(slv2_world); 112 #endif 113 114 // Set up RDF namespaces 115 rdf_world->add_prefix("dc", "http://purl.org/dc/elements/1.1/"); 116 rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#"); 117 rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#"); 118 rdf_world->add_prefix("ingenui", "http://drobilla.net/ns/ingenuity#"); 119 rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#"); 120 rdf_world->add_prefix("lv2ev", "http://lv2plug.in/ns/ext/event#"); 121 rdf_world->add_prefix("ctx", "http://lv2plug.in/ns/dev/contexts#"); 122 rdf_world->add_prefix("lv2midi", "http://lv2plug.in/ns/ext/midi#"); 123 rdf_world->add_prefix("midi", "http://drobilla.net/ns/dev/midi#"); 124 rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#"); 125 rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); 126 rdf_world->add_prefix("sp", "http://lv2plug.in/ns/dev/string-port#"); 127 rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); 128 } 129 130 virtual ~WorldImpl() 131 { 132 modules.clear(); 133 interface_factories.clear(); 134 script_runners.clear(); 135 136 #ifdef HAVE_SLV2 137 slv2_world_free(slv2_world); 138 slv2_world = NULL; 139 #endif 140 141 delete rdf_world; 142 rdf_world = NULL; 143 144 delete lv2_features; 145 lv2_features = NULL; 146 147 uris.reset(); 148 } 149 150 typedef std::map< const std::string, SharedPtr<Module> > Modules; 151 Modules modules; 152 153 typedef std::map<const std::string, World::InterfaceFactory> InterfaceFactories; 154 InterfaceFactories interface_factories; 155 156 typedef bool (*ScriptRunner)(World* world, const char* filename); 157 typedef std::map<const std::string, ScriptRunner> ScriptRunners; 158 ScriptRunners script_runners; 159 160 int& argc; 161 char**& argv; 162 Raul::Configuration* conf; 163 LV2Features* lv2_features; 164 Redland::World* rdf_world; 165 SharedPtr<LV2URIMap> uris; 166 SharedPtr<EngineInterface> engine; 167 SharedPtr<Engine> local_engine; 168 SharedPtr<Serialisation::Serialiser> serialiser; 169 SharedPtr<Serialisation::Parser> parser; 170 SharedPtr<Store> store; 171 #ifdef HAVE_SLV2 172 SLV2World slv2_world; 173 #endif 174 }; 175 176 177 World::World(Raul::Configuration* conf, int& argc, char**& argv) 178 : _impl(new WorldImpl(conf, argc, argv)) 179 { 180 } 181 182 183 World::~World() 184 { 185 unload_all(); 186 delete _impl; 187 } 188 189 void World::set_local_engine(SharedPtr<Engine> e) { _impl->local_engine = e; } 190 void World::set_engine(SharedPtr<EngineInterface> e) { _impl->engine = e; } 191 void World::set_serialiser(SharedPtr<Serialisation::Serialiser> s) { _impl->serialiser = s; } 192 void World::set_parser(SharedPtr<Serialisation::Parser> p) { _impl->parser = p; } 193 void World::set_store(SharedPtr<Store> s) { _impl->store = s; } 194 void World::set_conf(Raul::Configuration* c) { _impl->conf = c; } 195 196 int& World::argc() { return _impl->argc; } 197 char**& World::argv() { return _impl->argv; } 198 SharedPtr<Engine> World::local_engine() { return _impl->local_engine; } 199 SharedPtr<EngineInterface> World::engine() { return _impl->engine; } 200 SharedPtr<Serialisation::Serialiser> World::serialiser() { return _impl->serialiser; } 201 SharedPtr<Serialisation::Parser> World::parser() { return _impl->parser; } 202 SharedPtr<Store> World::store() { return _impl->store; } 203 Raul::Configuration* World::conf() { return _impl->conf; } 204 LV2Features* World::lv2_features() { return _impl->lv2_features; } 205 206 #ifdef HAVE_SLV2 207 SLV2World World::slv2_world() { return _impl->slv2_world; } 208 #endif 209 Redland::World* World::rdf_world() { return _impl->rdf_world; } 210 SharedPtr<LV2URIMap> World::uris() { return _impl->uris; } 211 212 88 213 /** Load an Ingen module. 89 214 * @return true on success, false on failure … … 98 223 module->library = lib; 99 224 module->load(this); 100 modules.insert(make_pair(string(name), module));225 _impl->modules.insert(make_pair(string(name), module)); 101 226 return true; 102 227 } else { … … 112 237 World::unload_all() 113 238 { 114 modules.clear();239 _impl->modules.clear(); 115 240 } 116 241 … … 122 247 { 123 248 const string scheme = url.substr(0, url.find(":")); 124 const InterfaceFactories::const_iterator i =interface_factories.find(scheme);125 if (i == interface_factories.end()) {249 const WorldImpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme); 250 if (i == _impl->interface_factories.end()) { 126 251 warn << "Unknown URI scheme `" << scheme << "'" << endl; 127 252 return SharedPtr<Ingen::Shared::EngineInterface>(); … … 136 261 World::run(const std::string& mime_type, const std::string& filename) 137 262 { 138 const ScriptRunners::const_iterator i =script_runners.find(mime_type);139 if (i == script_runners.end()) {263 const WorldImpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); 264 if (i == _impl->script_runners.end()) { 140 265 warn << "Unknown script MIME type `" << mime_type << "'" << endl; 141 266 return false; … … 148 273 World::add_interface_factory(const std::string& scheme, InterfaceFactory factory) 149 274 { 150 interface_factories.insert(make_pair(scheme, factory));275 _impl->interface_factories.insert(make_pair(scheme, factory)); 151 276 } 152 277 -
trunk/ingen/src/module/World.hpp
r2484 r2533 22 22 #include <string> 23 23 #include <boost/shared_ptr.hpp> 24 #include <boost/utility.hpp> 24 25 #include <glibmm/module.h> 26 #include "ingen-config.h" 25 27 #include "raul/Configuration.hpp" 28 #include "raul/SharedPtr.hpp" 26 29 #include "Module.hpp" 30 #include "module/ingen_module.hpp" 27 31 32 #ifdef HAVE_SLV2 28 33 typedef struct _SLV2World* SLV2World; 34 #endif 29 35 30 36 namespace Redland { class World; } … … 42 48 class LV2Features; 43 49 class LV2URIMap; 50 struct WorldImpl; 44 51 45 52 … … 53 60 * set World::serialiser and World::parser to valid objects. 54 61 */ 55 struct World { 56 World() : argc(0), argv(0), conf(0), rdf_world(0), slv2_world(0), lv2_features(0) {} 62 class World : public boost::noncopyable { 63 friend Ingen::Shared::World* ::ingen_world_new(Raul::Configuration*, int&, char**&); 64 World(Raul::Configuration* conf, int& argc, char**& argv); 57 65 58 bool load(const char* name); 59 void unload_all(); 66 friend void ::ingen_world_free(Ingen::Shared::World* world); 67 virtual ~World(); 68 69 WorldImpl* _impl; 70 71 public: 72 virtual bool load(const char* name); 73 virtual void unload_all(); 60 74 61 75 typedef SharedPtr<Ingen::Shared::EngineInterface> (*InterfaceFactory)( 62 76 World* world, const std::string& engine_url); 63 77 64 v oid add_interface_factory(const std::string& scheme, InterfaceFactory factory);65 SharedPtr<Ingen::Shared::EngineInterface> interface(const std::string& engine_url);78 virtual void add_interface_factory(const std::string& scheme, InterfaceFactory factory); 79 virtual SharedPtr<Ingen::Shared::EngineInterface> interface(const std::string& engine_url); 66 80 67 bool run(const std::string& mime_type, const std::string& filename);81 virtual bool run(const std::string& mime_type, const std::string& filename); 68 82 69 int argc; 70 char** argv; 71 Raul::Configuration* conf; 83 virtual void set_local_engine(SharedPtr<Engine> e); 84 virtual void set_engine(SharedPtr<EngineInterface> e); 85 virtual void set_serialiser(SharedPtr<Serialisation::Serialiser> s); 86 virtual void set_parser(SharedPtr<Serialisation::Parser> p); 87 virtual void set_store(SharedPtr<Store> s); 72 88 73 Redland::World* rdf_world; 74 SLV2World slv2_world; 75 LV2Features* lv2_features; 89 virtual SharedPtr<Engine> local_engine(); 90 virtual SharedPtr<EngineInterface> engine(); 91 virtual SharedPtr<Serialisation::Serialiser> serialiser(); 92 virtual SharedPtr<Serialisation::Parser> parser(); 93 virtual SharedPtr<Store> store(); 76 94 77 boost::shared_ptr<LV2URIMap> uris; 95 virtual Redland::World* rdf_world(); 96 virtual SharedPtr<LV2URIMap> uris(); 78 97 79 boost::shared_ptr<EngineInterface> engine; 80 boost::shared_ptr<Engine> local_engine; 81 boost::shared_ptr<Serialisation::Serialiser> serialiser; 82 boost::shared_ptr<Serialisation::Parser> parser; 83 boost::shared_ptr<Store> store; 98 virtual int& argc(); 99 virtual char**& argv(); 84 100 85 private: 86 typedef std::map< const std::string, boost::shared_ptr<Module> > Modules; 87 Modules modules; 101 virtual Raul::Configuration* conf(); 102 virtual void set_conf(Raul::Configuration* c); 88 103 89 typedef std::map<const std::string, InterfaceFactory> InterfaceFactories; 90 InterfaceFactories interface_factories; 104 virtual LV2Features* lv2_features(); 91 105 92 typedef bool (*ScriptRunner)(World* world, const char* filename); 93 typedef std::map<const std::string, ScriptRunner> ScriptRunners;94 ScriptRunners script_runners; 106 #ifdef HAVE_SLV2 107 virtual SLV2World slv2_world(); 108 #endif 95 109 }; 96 110 -
trunk/ingen/src/serialisation/Parser.cpp
r2525 r2533 72 72 73 73 74 Parser::PatchRecords 75 Parser::find_patches( 76 Ingen::Shared::World* world, 77 const Glib::ustring& manifest_uri) 78 { 79 Redland::Model model(*world->rdf_world(), manifest_uri, manifest_uri); 80 Redland::Query query(*world->rdf_world(), 81 "SELECT DISTINCT ?patch ?file WHERE {\n" 82 "?patch a ingen:Patch ;\n" 83 " rdfs:seeAlso ?file .\n" 84 "}"); 85 86 std::list<PatchRecord> records; 87 88 Redland::Query::Results results(query.run(*world->rdf_world(), model, manifest_uri)); 89 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { 90 const Redland::Node& patch((*i)["patch"]); 91 const Redland::Node& file((*i)["file"]); 92 records.push_back(PatchRecord(patch.to_c_string(), file.to_c_string())); 93 } 94 95 return records; 96 } 97 98 74 99 /** Parse a patch from RDF into a CommonInterface (engine or client). 75 100 * @return whether or not load was successful. … … 97 122 } 98 123 99 Redland::Model model(*world->rdf_world , document_uri, document_uri);124 Redland::Model model(*world->rdf_world(), document_uri, document_uri); 100 125 101 126 LOG(info) << "Parsing " << document_uri << endl; … … 132 157 boost::optional<GraphObject::Properties> data) 133 158 { 134 Redland::Model model(*world->rdf_world , str.c_str(), str.length(), base_uri);159 Redland::Model model(*world->rdf_world(), str.c_str(), str.length(), base_uri); 135 160 136 161 LOG(info) << "Parsing " << (data_path ? data_path->str() : "*") << " from string"; … … 140 165 141 166 bool ret = parse(world, target, model, base_uri, data_path, parent, symbol, data); 142 Redland::Resource subject(*world->rdf_world , base_uri);167 Redland::Resource subject(*world->rdf_world(), base_uri); 143 168 parse_connections(world, target, model, subject, parent ? *parent : "/"); 144 169 … … 158 183 boost::optional<GraphObject::Properties> data) 159 184 { 160 Redland::Model model(*world->rdf_world, str.c_str(), str.length(), base_uri); 161 162 std::cout << "PARSE UPDATE " << str << endl; 185 Redland::Model model(*world->rdf_world(), str.c_str(), str.length(), base_uri); 163 186 164 187 // Delete anything explicitly declared to not exist 165 188 Glib::ustring query_str = Glib::ustring("SELECT DISTINCT ?o WHERE { ?o a owl:Nothing }"); 166 Redland::Query query(*world->rdf_world , query_str);167 Redland::Query::Results results = query.run(*world->rdf_world , model, base_uri);189 Redland::Query query(*world->rdf_world(), query_str); 190 Redland::Query::Results results = query.run(*world->rdf_world(), model, base_uri); 168 191 169 192 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { … … 173 196 174 197 // Properties 175 query = Redland::Query(*world->rdf_world ,198 query = Redland::Query(*world->rdf_world(), 176 199 "SELECT DISTINCT ?s ?p ?o WHERE {\n" 177 200 "?s ?p ?o .\n" 178 201 "}"); 179 202 180 results = Redland::Query::Results(query.run(*world->rdf_world , model, base_uri));203 results = Redland::Query::Results(query.run(*world->rdf_world(), model, base_uri)); 181 204 182 205 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { 183 Glib::Mutex::Lock lock(world->rdf_world ->mutex());206 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 184 207 string obj_uri((*i)["s"].to_string()); 185 208 const string key((*i)["p"].to_string()); … … 195 218 196 219 // Connections 197 Redland::Resource subject(*world->rdf_world , base_uri);220 Redland::Resource subject(*world->rdf_world(), base_uri); 198 221 parse_connections(world, target, model, subject, "/"); 199 222 200 223 // Port values 201 query = Redland::Query(*world->rdf_world ,224 query = Redland::Query(*world->rdf_world(), 202 225 "SELECT DISTINCT ?path ?value WHERE {\n" 203 226 "?path ingen:value ?value .\n" 204 227 "}"); 205 228 206 results = Redland::Query::Results(query.run(*world->rdf_world , model, base_uri));229 results = Redland::Query::Results(query.run(*world->rdf_world(), model, base_uri)); 207 230 208 231 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { 209 Glib::Mutex::Lock lock(world->rdf_world ->mutex());232 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 210 233 const string obj_path = (*i)["path"].to_string(); 211 234 const Redland::Node& val_node = (*i)["value"]; 212 235 const Atom a(AtomRDF::node_to_atom(model, val_node)); 213 target->set_property(obj_path, world->uris ->ingen_value, a);236 target->set_property(obj_path, world->uris()->ingen_value, a); 214 237 } 215 238 … … 235 258 : Glib::ustring("SELECT DISTINCT ?s ?t WHERE { ?s a ?t . }"); 236 259 237 Redland::Query query(*world->rdf_world , query_str);238 Redland::Query::Results results(query.run(*world->rdf_world , model, document_uri));260 Redland::Query query(*world->rdf_world(), query_str); 261 Redland::Query::Results results(query.run(*world->rdf_world(), model, document_uri)); 239 262 240 263 #define NS_INGEN "http://drobilla.net/ns/ingen#" 241 264 #define NS_LV2 "http://lv2plug.in/ns/lv2core#" 242 265 243 const Redland::Node patch_class (*world->rdf_world , res, NS_INGEN "Patch");244 const Redland::Node node_class (*world->rdf_world , res, NS_INGEN "Node");245 const Redland::Node internal_class (*world->rdf_world , res, NS_INGEN "Internal");246 const Redland::Node ladspa_class (*world->rdf_world , res, NS_INGEN "LADSPAPlugin");247 const Redland::Node in_port_class (*world->rdf_world , res, NS_LV2 "InputPort");248 const Redland::Node out_port_class (*world->rdf_world , res, NS_LV2 "OutputPort");249 const Redland::Node lv2_class (*world->rdf_world , res, NS_LV2 "Plugin");266 const Redland::Node patch_class (*world->rdf_world(), res, NS_INGEN "Patch"); 267 const Redland::Node node_class (*world->rdf_world(), res, NS_INGEN "Node"); 268 const Redland::Node internal_class (*world->rdf_world(), res, NS_INGEN "Internal"); 269 const Redland::Node ladspa_class (*world->rdf_world(), res, NS_INGEN "LADSPAPlugin"); 270 const Redland::Node in_port_class (*world->rdf_world(), res, NS_LV2 "InputPort"); 271 const Redland::Node out_port_class (*world->rdf_world(), res, NS_LV2 "OutputPort"); 272 const Redland::Node lv2_class (*world->rdf_world(), res, NS_LV2 "Plugin"); 250 273 251 274 const Redland::Node subject_node = (data_path && !data_path->is_root()) 252 ? Redland::Node(*world->rdf_world , res, data_path->chop_start("/"))275 ? Redland::Node(*world->rdf_world(), res, data_path->chop_start("/")) 253 276 : model.base_uri(); 254 277 … … 299 322 } else if (rdf_class == in_port_class || rdf_class == out_port_class) { 300 323 parse_properties(world, target, model, subject, path, data); 324 ret = path; 301 325 } 302 326 … … 334 358 boost::optional<GraphObject::Properties> data) 335 359 { 336 const LV2URIMap& uris = *world->uris .get();360 const LV2URIMap& uris = *world->uris().get(); 337 361 uint32_t patch_poly = 0; 338 362 … … 350 374 /* Load polyphony from file if necessary */ 351 375 if (patch_poly == 0) { 352 Redland::Query query(*world->rdf_world , Glib::ustring(376 Redland::Query query(*world->rdf_world(), Glib::ustring( 353 377 "SELECT DISTINCT ?poly WHERE { ") + subject + " ingen:polyphony ?poly }"); 354 378 355 Results results = query.run(*world->rdf_world , model);379 Results results = query.run(*world->rdf_world(), model); 356 380 if (results.size() > 0) { 357 381 const Redland::Node& poly_node = (*results.begin())["poly"]; … … 396 420 397 421 /* Find patches in document */ 398 Redland::Query query(*world->rdf_world , Glib::ustring(422 Redland::Query query(*world->rdf_world(), Glib::ustring( 399 423 "SELECT DISTINCT ?patch WHERE {\n") + 400 424 "?patch a ingen:Patch .\n" 401 425 "}"); 402 426 set<string> patches; 403 Results results = query.run(*world->rdf_world , model, base_uri);427 Results results = query.run(*world->rdf_world(), model, base_uri); 404 428 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 405 Glib::Mutex::Lock lock(world->rdf_world ->mutex());429 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 406 430 patches.insert((*i)["patch"].to_string()); 407 431 } … … 414 438 415 439 /* Find nodes on this patch */ 416 query = Redland::Query(*world->rdf_world , Glib::ustring(440 query = Redland::Query(*world->rdf_world(), Glib::ustring( 417 441 "SELECT DISTINCT ?node ?type WHERE {\n") + 418 442 subject + " ingen:node ?node .\n" … … 423 447 Resources resources; 424 448 Types types; 425 results = query.run(*world->rdf_world , model, base_uri);449 results = query.run(*world->rdf_world(), model, base_uri); 426 450 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 427 Glib::Mutex::Lock lock(world->rdf_world ->mutex());451 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 428 452 Redland::Node& node = (*i)["node"]; 429 453 Redland::Node& type = (*i)["type"]; … … 441 465 442 466 /* Load nodes on this patch */ 443 query = Redland::Query(*world->rdf_world , Glib::ustring(467 query = Redland::Query(*world->rdf_world(), Glib::ustring( 444 468 "SELECT DISTINCT ?node ?predicate ?object WHERE {\n") + 445 469 subject + " ingen:node ?node .\n" 446 470 "?node ?predicate ?object .\n" 447 471 "}"); 448 results = query.run(*world->rdf_world , model, base_uri);472 results = query.run(*world->rdf_world(), model, base_uri); 449 473 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 450 Glib::Mutex::Lock lock(world->rdf_world ->mutex());474 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 451 475 Redland::Node& node = (*i)["node"]; 452 476 Redland::Node& predicate = (*i)["predicate"]; … … 479 503 continue; 480 504 parse_patch(world, target, model, res_i->second, patch_path, Symbol(node_path.symbol())); 481 Glib::Mutex::Lock lock(world->rdf_world ->mutex());505 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 482 506 target->put(node_path, i->second); 483 507 } … … 498 522 499 523 /* Load node ports */ 500 query = Redland::Query(*world->rdf_world , Glib::ustring(524 query = Redland::Query(*world->rdf_world(), Glib::ustring( 501 525 "SELECT DISTINCT ?node ?port ?key ?val WHERE {\n") + 502 526 subject + " ingen:node ?node .\n" … … 505 529 "}"); 506 530 Objects node_ports; 507 results = query.run(*world->rdf_world , model, base_uri);531 results = query.run(*world->rdf_world(), model, base_uri); 508 532 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 509 Glib::Mutex::Lock lock(world->rdf_world ->mutex());533 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 510 534 const string node_uri = (*i)["node"].to_string(); 511 535 const string port_uri = (*i)["port"].to_string(); … … 532 556 533 557 /* Find ports on this patch */ 534 query = Redland::Query(*world->rdf_world , Glib::ustring(558 query = Redland::Query(*world->rdf_world(), Glib::ustring( 535 559 "SELECT DISTINCT ?port ?type WHERE {\n") + 536 560 subject + " lv2:port ?port .\n" … … 538 562 "}"); 539 563 Objects patch_ports; 540 results = query.run(*world->rdf_world , model, base_uri);564 results = query.run(*world->rdf_world(), model, base_uri); 541 565 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 542 Glib::Mutex::Lock lock(world->rdf_world ->mutex());566 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 543 567 Redland::Node& port = (*i)["port"]; 544 568 Redland::Node& type = (*i)["type"]; … … 551 575 552 576 /* Load patch ports */ 553 query = Redland::Query(*world->rdf_world , Glib::ustring(577 query = Redland::Query(*world->rdf_world(), Glib::ustring( 554 578 "SELECT DISTINCT ?port ?key ?val WHERE {\n") + 555 579 subject + " lv2:port ?port .\n" 556 580 "?port ?key ?val .\n" 557 581 "}"); 558 results = query.run(*world->rdf_world , model, base_uri);582 results = query.run(*world->rdf_world(), model, base_uri); 559 583 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 560 Glib::Mutex::Lock lock(world->rdf_world ->mutex());584 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 561 585 const string port_uri = (*i)["port"].to_string(); 562 586 const Path port_path = patch_path.child(relative_uri(base_uri, port_uri, false)); … … 604 628 for (uint32_t index = 0; index < patch_ports.size(); ++index) { 605 629 Objects::iterator i = ports_by_index[index]; 606 Glib::Mutex::Lock lock(world->rdf_world ->mutex());630 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 607 631 const Path port_path = patch_path.child(relative_uri(base_uri, i->first, false)); 608 632 std::pair<Properties::iterator,Properties::iterator> types_range … … 642 666 643 667 /* Enable */ 644 query = Redland::Query(*world->rdf_world , Glib::ustring(668 query = Redland::Query(*world->rdf_world(), Glib::ustring( 645 669 "SELECT DISTINCT ?enabled WHERE {\n") 646 670 + subject + " ingen:enabled ?enabled .\n" 647 671 "}"); 648 672 649 results = query.run(*world->rdf_world , model, base_uri);673 results = query.run(*world->rdf_world(), model, base_uri); 650 674 for (Results::iterator i = results.begin(); i != results.end(); ++i) { 651 Glib::Mutex::Lock lock(world->rdf_world ->mutex());675 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 652 676 const Redland::Node& enabled_node = (*i)["enabled"]; 653 677 if (enabled_node.is_bool() && enabled_node) { … … 672 696 boost::optional<GraphObject::Properties> data) 673 697 { 674 const LV2URIMap& uris = *world->uris .get();698 const LV2URIMap& uris = *world->uris().get(); 675 699 676 700 /* Get plugin */ 677 Redland::Query query(*world->rdf_world , Glib::ustring(701 Redland::Query query(*world->rdf_world(), Glib::ustring( 678 702 "SELECT DISTINCT ?plug WHERE {\n") 679 703 + subject.to_turtle_token() + " rdf:instanceOf ?plug .\n" 680 704 "}"); 681 705 682 Redland::Query::Results results = query.run(*world->rdf_world , model);706 Redland::Query::Results results = query.run(*world->rdf_world(), model); 683 707 684 708 if (results.size() == 0) { … … 693 717 } 694 718 695 const string plugin_uri = world->rdf_world ->expand_uri(plugin_node.to_c_string());719 const string plugin_uri = world->rdf_world()->expand_uri(plugin_node.to_c_string()); 696 720 Resource::Properties props; 697 721 props.insert(make_pair(uris.rdf_type, Raul::URI(uris.ingen_Node))); … … 712 736 const Raul::Path& parent) 713 737 { 714 Redland::Query query(*world->rdf_world , Glib::ustring(738 Redland::Query query(*world->rdf_world(), Glib::ustring( 715 739 "SELECT DISTINCT ?src ?dst WHERE {\n") 716 740 + subject.to_turtle_token() + " ingen:connection ?connection .\n" … … 721 745 const Glib::ustring& base_uri = model.base_uri().to_string(); 722 746 723 Redland::Query::Results results = query.run(*world->rdf_world , model);747 Redland::Query::Results results = query.run(*world->rdf_world(), model); 724 748 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { 725 Glib::Mutex::Lock lock(world->rdf_world ->mutex());749 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 726 750 const Path src_path(parent.child(relative_uri(base_uri, (*i)["src"].to_string(), false))); 727 751 const Path dst_path(parent.child(relative_uri(base_uri, (*i)["dst"].to_string(), false))); … … 744 768 const Glib::ustring& subject = subject_node.to_turtle_token(); 745 769 746 Redland::Query query(*world->rdf_world , Glib::ustring(770 Redland::Query query(*world->rdf_world(), Glib::ustring( 747 771 "SELECT DISTINCT ?key ?val WHERE {\n") + 748 772 subject + " ?key ?val .\n" … … 750 774 751 775 Resource::Properties properties; 752 Redland::Query::Results results = query.run(*world->rdf_world , model);776 Redland::Query::Results results = query.run(*world->rdf_world(), model); 753 777 for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { 754 Glib::Mutex::Lock lock(world->rdf_world ->mutex());778 Glib::Mutex::Lock lock(world->rdf_world()->mutex()); 755 779 const string key = string((*i)["key"]); 756 780 const Redland::Node& val = (*i)["val"]; -
trunk/ingen/src/serialisation/Parser.hpp
r2409 r2533 20 20 21 21 #include <string> 22 #include <list> 22 23 #include <glibmm/ustring.h> 23 24 #include <boost/optional.hpp> … … 69 70 boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(), 70 71 boost::optional<Properties> data=boost::optional<Properties>()); 72 73 struct PatchRecord { 74 PatchRecord(const Raul::URI& u, const Glib::ustring& f) : uri(u), filename(f) {} 75 const Raul::URI uri; 76 const Glib::ustring filename; 77 }; 78 79 typedef std::list<PatchRecord> PatchRecords; 80 81 virtual PatchRecords find_patches( 82 Ingen::Shared::World* world, 83 const Glib::ustring& manifest_uri); 71 84 72 85 private: -
trunk/ingen/src/serialisation/Serialiser.cpp
r2525 r2533 30 30 #include <glib/gstdio.h> 31 31 #include <glibmm/convert.h> 32 #include <glibmm/miscutils.h> 33 #include <glibmm/fileutils.h> 32 34 #include "raul/log.hpp" 33 35 #include "raul/Atom.hpp" … … 102 104 const Records& records) 103 105 { 104 const string filename = Glib::filename_from_uri(bundle_uri) + "manifest.ttl"; 106 const string bundle_path(Glib::filename_from_uri(bundle_uri)); 107 const string filename(Glib::build_filename(bundle_path, "manifest.ttl")); 105 108 start_to_filename(filename); 106 109 _model->set_base_uri(bundle_uri); … … 108 111 SharedPtr<Patch> patch = PtrCast<Patch>(i->object); 109 112 if (patch) { 110 const Redland::Resource subject(_model->world(), uri_to_symbol(i->uri)); 113 const std::string filename = uri_to_symbol(i->uri) + INGEN_PATCH_FILE_EXT; 114 const Redland::Resource subject(_model->world(), filename); 111 115 _model->add_statement(subject, "rdf:type", 112 116 Redland::Resource(_model->world(), "ingen:Patch")); … … 114 118 Redland::Resource(_model->world(), "lv2:Plugin")); 115 119 _model->add_statement(subject, "rdfs:seeAlso", 116 Redland::Resource(_model->world(), i->uri)); 120 Redland::Resource(_model->world(), filename)); 121 _model->add_statement(subject, "lv2:binary", 122 Redland::Resource(_model->world(), 123 Glib::Module::build_path("", "ingen_lv2"))); 124 symlink(Glib::Module::build_path(INGEN_MODULE_DIR, "ingen_lv2").c_str(), 125 Glib::Module::build_path(bundle_path, "ingen_lv2").c_str()); 117 126 } 118 127 } … … 179 188 else 180 189 _base_uri = filename; 181 _model = new Redland::Model(*_world.rdf_world );190 _model = new Redland::Model(*_world.rdf_world()); 182 191 _model->set_base_uri(_base_uri); 183 192 _mode = TO_FILE; … … 202 211 _root_path = root; 203 212 _base_uri = base_uri; 204 _model = new Redland::Model(*_world.rdf_world );213 _model = new Redland::Model(*_world.rdf_world()); 205 214 _model->set_base_uri(base_uri); 206 215 _mode = TO_STRING; … … 311 320 Redland::Resource(_model->world(), "lv2:Plugin")); 312 321 313 GraphObject::Properties::const_iterator s = patch->properties().find("lv2:symbol"); 314 // If symbol is stored as a property, write that 315 if (s != patch->properties().end() && s->second.is_valid()) { 316 _model->add_statement(patch_id, "lv2:symbol", 317 Redland::Literal(_model->world(), s->second.get_string())); 318 // Otherwise take the one from our path (if possible) 319 } else if (!patch->path().is_root()) { 320 _model->add_statement(patch_id, "lv2:symbol", 321 Redland::Literal(_model->world(), patch->path().symbol())); 322 const LV2URIMap& uris = *_world.uris().get(); 323 324 // Always write a symbol (required by Ingen) 325 string symbol; 326 GraphObject::Properties::const_iterator s = patch->properties().find(uris.lv2_symbol); 327 if (s == patch->properties().end() 328 || !s->second.type() == Atom::STRING 329 || !Symbol::is_valid(s->second.get_string())) { 330 symbol = Glib::path_get_basename(Glib::filename_from_uri(_model->base_uri().to_c_string())); 331 symbol = Symbol::symbolify(symbol.substr(0, symbol.find('.'))); 332 _model->add_statement(patch_id, uris.lv2_symbol.c_str(), 333 Redland::Literal(_model->world(), symbol)); 322 334 } else { 323 LOG(warn) << "Patch has no lv2:symbol" << endl; 324 } 335 symbol = s->second.get_string(); 336 } 337 338 // If the patch has no doap:name (required by LV2), use the symbol 339 if (patch->meta().properties().find(uris.doap_name) == patch->meta().properties().end()) 340 _model->add_statement(patch_id, uris.doap_name.c_str(), 341 Redland::Literal(_model->world(), symbol)); 325 342 326 343 serialise_properties(patch_id, NULL, patch->meta().properties()); … … 428 445 class_rdf_node(port->path())); 429 446 447 _model->add_statement(port_id, "lv2:symbol", 448 Redland::Literal(_model->world(), port->path().symbol())); 449 430 450 serialise_properties(port_id, &port->meta(), port->properties()); 431 451 } … … 450 470 _model->add_statement(port_id, "lv2:index", 451 471 AtomRDF::atom_to_node(*_model, Atom((int)port->index()))); 472 473 _model->add_statement(port_id, "lv2:symbol", 474 Redland::Literal(_model->world(), port->path().symbol())); 452 475 453 476 if (!port->get_property("http://lv2plug.in/ns/lv2core#default").is_valid()) { … … 481 504 : class_rdf_node(connection->dst_port_path()); 482 505 483 const Redland::Node connection_node = _world.rdf_world ->blank_id();506 const Redland::Node connection_node = _world.rdf_world()->blank_id(); 484 507 _model->add_statement(connection_node, "ingen:source", src_node); 485 508 _model->add_statement(connection_node, "ingen:destination", dst_node); -
trunk/ingen/src/serialisation/serialisation.cpp
r2314 r2533 26 26 struct IngenModule : public Shared::Module { 27 27 void load(Shared::World* world) { 28 world-> parser =SharedPtr<Serialisation::Parser>(29 new Serialisation::Parser()) ;30 world->se rialiser =SharedPtr<Serialisation::Serialiser>(31 new Serialisation::Serialiser(*world, world->store ));28 world->set_parser(SharedPtr<Serialisation::Parser>( 29 new Serialisation::Parser())); 30 world->set_serialiser(SharedPtr<Serialisation::Serialiser>( 31 new Serialisation::Serialiser(*world, world->store()))); 32 32 } 33 33 }; -
trunk/ingen/src/shared/Builder.cpp
r2491 r2533 33 33 34 34 35 Builder::Builder(CommonInterface& interface) 36 : _interface(interface) 35 Builder::Builder(SharedPtr<Shared::LV2URIMap> uris, CommonInterface& interface) 36 : _uris(uris) 37 , _interface(interface) 37 38 { 38 39 } … … 42 43 Builder::build(SharedPtr<const GraphObject> object) 43 44 { 44 const LV2URIMap& uris = Shared::LV2URIMap::instance();45 const LV2URIMap& uris = *_uris.get(); 45 46 SharedPtr<const Patch> patch = PtrCast<const Patch>(object); 46 47 if (patch) { -
trunk/ingen/src/shared/Builder.hpp
r2398 r2533 26 26 namespace Shared { 27 27 28 class CommonInterface; 28 29 class GraphObject; 29 class CommonInterface;30 class LV2URIMap; 30 31 31 32 … … 37 38 { 38 39 public: 39 Builder( CommonInterface& interface);40 Builder(SharedPtr<Shared::LV2URIMap> uris, CommonInterface& interface); 40 41 virtual ~Builder() {} 41 42 … … 46 47 void build_object(SharedPtr<const GraphObject> object); 47 48 48 CommonInterface& _interface; 49 SharedPtr<Shared::LV2URIMap> _uris; 50 CommonInterface& _interface; 49 51 }; 50 52 -
trunk/ingen/src/shared/LV2Features.cpp
r2408 r2533 29 29 LV2Features::LV2Features() 30 30 { 31 add_feature(LV2_URI_MAP_URI, SharedPtr<Feature>(new LV2URIMap()));32 31 } 33 32 -
trunk/ingen/src/shared/LV2Object.cpp
r2409 r2533 33 33 34 34 bool 35 to_atom(const LV2_Object* object, Raul::Atom& atom)35 to_atom(const Shared::LV2URIMap& uris, const LV2_Object* object, Raul::Atom& atom) 36 36 { 37 const LV2URIMap& uris = Shared::LV2URIMap::instance();38 39 37 if (object->type == uris.object_class_string.id) { 40 38 atom = Raul::Atom((char*)(object + 1)); … … 58 56 */ 59 57 bool 60 from_atom(const Raul::Atom& atom, LV2_Object* object)58 from_atom(const Shared::LV2URIMap& uris, const Raul::Atom& atom, LV2_Object* object) 61 59 { 62 const LV2URIMap& uris = Shared::LV2URIMap::instance();63 64 60 char* str; 65 61 switch (atom.type()) { -
trunk/ingen/src/shared/LV2Object.hpp
r2492 r2533 26 26 27 27 class World; 28 class LV2URIMap; 28 29 29 30 namespace LV2Object { 30 31 31 bool to_atom(const LV2_Object* object, Raul::Atom& atom);32 bool from_atom(const Raul::Atom& atom, LV2_Object* object);32 bool to_atom(const Shared::LV2URIMap& uris, const LV2_Object* object, Raul::Atom& atom); 33 bool from_atom(const Shared::LV2URIMap& uris, const Raul::Atom& atom, LV2_Object* object); 33 34 34 35 } // namespace LV2Object -
trunk/ingen/src/shared/LV2URIMap.cpp
r2492 r2533 20 20 #include <stdint.h> 21 21 #include <glib.h> 22 #include <boost/shared_ptr.hpp> 22 23 #include "raul/log.hpp" 23 24 #include "object.lv2/object.h" 24 25 #include "LV2URIMap.hpp" 25 #include "module/ingen_module.hpp"26 #include "module/World.hpp"27 26 28 27 using namespace std; … … 37 36 , id(g_quark_from_string(c_str)) 38 37 { 38 } 39 40 const char* 41 LV2URIMap::Quark::c_str() const 42 { 43 return g_quark_to_string(id); 39 44 } 40 45 … … 115 120 116 121 117 const LV2URIMap& 118 LV2URIMap::instance() 119 { 120 return *ingen_get_world()->uris; 121 } 122 struct null_deleter { void operator()(void const *) const {} }; 122 123 123 124 … … 126 127 const char* uri) 127 128 { 128 const uint32_t ret = static_cast<uint32_t>(g_quark_from_string(uri)); 129 debug << "[LV2URIMap] "; 130 if (map) 131 debug << map << " : "; 132 debug << uri << " => " << ret << endl; 133 return ret; 129 return static_cast<uint32_t>(g_quark_from_string(uri)); 134 130 } 135 131 -
trunk/ingen/src/shared/LV2URIMap.hpp
r2492 r2533 39 39 } 40 40 41 uint32_t uri_to_id(const char* map, const char* uri); 42 43 static const LV2URIMap& instance(); 41 virtual uint32_t uri_to_id(const char* map, const char* uri); 44 42 45 43 private: … … 54 52 struct Quark : public Raul::URI { 55 53 Quark(const char* str); 54 const char* c_str() const; 56 55 uint32_t id; 57 56 }; -
trunk/ingen/src/shared/ResourceImpl.cpp
r2468 r2533 68 68 ResourceImpl::remove_property(const Raul::URI& uri, const Raul::Atom& value) 69 69 { 70 const LV2URIMap& uris = Shared::LV2URIMap::instance(); 71 if (value == uris.wildcard) { 70 if (value == _uris.wildcard) { 72 71 _properties.erase(uri); 73 72 } else { … … 114 113 bool 115 114 ResourceImpl::type( 115 const LV2URIMap& uris, 116 116 const Properties& properties, 117 117 bool& patch, … … 120 120 { 121 121 typedef Resource::Properties::const_iterator iterator; 122 const LV2URIMap& uris = Shared::LV2URIMap::instance();123 122 const std::pair<iterator,iterator> types_range = properties.equal_range(uris.rdf_type); 124 123 … … 199 198 ResourceImpl::remove_properties(const Properties& p) 200 199 { 201 const LV2URIMap& uris = Shared::LV2URIMap::instance();202 200 typedef Resource::Properties::const_iterator iterator; 203 201 for (iterator i = p.begin(); i != p.end(); ++i) { 204 if (i->second == uris.wildcard) {202 if (i->second == _uris.wildcard) { 205 203 _properties.erase(i->first); 206 204 } else { -
trunk/ingen/src/shared/ResourceImpl.hpp
r2442 r2533 22 22 #include <sigc++/sigc++.h> 23 23 #include "raul/URI.hpp" 24 #include "raul/SharedPtr.hpp" 24 25 #include "interface/Resource.hpp" 25 26 #include "interface/PortType.hpp" … … 28 29 namespace Shared { 29 30 31 class LV2URIMap; 32 30 33 class ResourceImpl : virtual public Resource 31 34 { 32 35 public: 33 ResourceImpl(const Raul::URI& uri) : _uri(uri) {} 36 ResourceImpl(LV2URIMap& uris, const Raul::URI& uri) 37 : _uris(uris), _uri(uri) {} 38 39 LV2URIMap& uris() const { return _uris; } 34 40 35 41 virtual void set_uri(const Raul::URI& uri) { _uri = uri; } … … 57 63 */ 58 64 static bool type( 65 const LV2URIMap& uris, 59 66 const Properties& properties, 60 67 bool& patch, … … 67 74 protected: 68 75 Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const; 76 77 LV2URIMap& _uris; 69 78 70 79 private: -
trunk/ingen/src/shared/runtime_paths.cpp
r2518 r2533 42 42 dladdr(function, &dli); 43 43 44 #ifdef BUNDLE 44 45 char bin_loc[PATH_MAX]; 45 46 realpath(dli.dli_fname, bin_loc); 47 #else 48 const char* bin_loc = dli.dli_fname; 49 #endif 46 50 47 #ifdef BUNDLE48 51 string bundle = bin_loc; 49 52 bundle = bundle.substr(0, bundle.find_last_of(G_DIR_SEPARATOR)); 50 53 bundle_path = bundle; 51 #endif52 54 } 53 55 56 57 void 58 set_bundle_path(const char* path) 59 { 60 bundle_path = path; 61 } 62 63 64 /** Return the absolute path of a file in an Ingen LV2 bundle 65 */ 66 std::string 67 bundle_file_path(const std::string& name) 68 { 69 return Glib::build_filename(bundle_path, name); 70 } 54 71 55 72 /** Return the absolute path of a 'resource' file. … … 58 75 data_file_path(const std::string& name) 59 76 { 60 std::string ret;61 77 #ifdef BUNDLE 62 ret =Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name));78 return Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name)); 63 79 #else 64 ret =Glib::build_filename(INGEN_DATA_DIR, name);80 return Glib::build_filename(INGEN_DATA_DIR, name); 65 81 #endif 66 return ret;67 82 } 68 83 … … 73 88 module_path(const std::string& name) 74 89 { 75 std::string ret;76 90 #ifdef BUNDLE 77 ret =Glib::Module::build_path(Glib::build_path(bundle_path, INGEN_MODULE_DIR), name);91 return Glib::Module::build_path(Glib::build_path(bundle_path, INGEN_MODULE_DIR), name); 78 92 #else 79 ret =Glib::Module::build_path(INGEN_MODULE_DIR, name);93 return Glib::Module::build_path(INGEN_MODULE_DIR, name); 80 94 #endif 81 return ret;82 95 } 83 96 -
trunk/ingen/src/shared/runtime_paths.hpp
r2398 r2533 28 28 namespace Shared { 29 29 30 void set_bundle_path(const char* path); 30 31 void set_bundle_path_from_code(void* function); 31 32 33 std::string bundle_file_path(const std::string& name); 32 34 std::string data_file_path(const std::string& name); 33 35 std::string module_path(const std::string& name); -
trunk/ingen/src/shared/wscript
r2334 r2533 10 10 Builder.cpp 11 11 ClashAvoider.cpp 12 Configuration.cpp 12 13 LV2Features.cpp 13 14 LV2Object.cpp -
trunk/raul/raul/Thread.hpp
r2364 r2533 19 19 #define RAUL_THREAD_HPP 20 20 21 #include <set> 21 22 #include <string> 22 23 #include <iostream> … … 60 61 void set_name(const std::string& name) { _name = name; } 61 62 62 unsigned context() const { return _context; }63 void set_context(unsigned context) { _context = context; }63 bool is_context(unsigned context) const { return _contexts.find(context) != _contexts.end(); } 64 void set_context(unsigned context) { _contexts.insert(context); } 64 65 65 66 protected: … … 93 94 static pthread_once_t _thread_key_once; 94 95 95 unsigned _context;96 std::string _name;97 bool _pthread_exists;98 bool _own_thread;99 pthread_t _pthread;96 std::set<unsigned> _contexts; 97 std::string _name; 98 bool _pthread_exists; 99 bool _own_thread; 100 pthread_t _pthread; 100 101 }; 101 102 -
trunk/raul/src/Thread.cpp
r2432 r2533 33 33 Thread::Thread(const std::string& name) 34 34 : _exit_flag(false) 35 , _context(0)36 35 , _name(name) 37 36 , _pthread_exists(false) … … 46 45 Thread::Thread(pthread_t thread, const std::string& name) 47 46 : _exit_flag(false) 48 , _context(0)49 47 , _name(name) 50 48 , _pthread_exists(true) -
trunk/raul/wscript
r2514 r2533 5 5 6 6 # Version of this package (even if built as a child) 7 RAUL_VERSION = '0.6. 5'7 RAUL_VERSION = '0.6.6' 8 8 9 9 # Library version (UNIX style major, minor, micro) … … 21 21 # 0.6.4 = 7,0,0 (unreleased) 22 22 # 0.6.5 = 8,0,0 (unreleased) 23 RAUL_LIB_VERSION = '8.0.0' 23 # 0.6.6 = 9,0,0 (unreleased) 24 RAUL_LIB_VERSION = '9.0.0' 24 25 25 26 # Variables for 'waf dist'
