summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ingen/DataAccess.hpp4
-rw-r--r--ingen/InstanceAccess.hpp4
-rw-r--r--ingen/LV2Features.hpp7
-rw-r--r--ingen/Log.hpp2
-rw-r--r--ingen/Module.hpp4
-rw-r--r--ingen/URIMap.hpp2
-rw-r--r--ingen/World.hpp2
-rw-r--r--ingen/client/PluginModel.hpp2
-rw-r--r--ingen/client/PluginUI.hpp8
-rw-r--r--ingen/client/SocketClient.hpp12
-rw-r--r--src/LV2Features.cpp2
-rw-r--r--src/Log.cpp4
-rw-r--r--src/World.cpp10
-rw-r--r--src/client/PluginModel.cpp2
-rw-r--r--src/client/PluginUI.cpp52
-rw-r--r--src/client/ingen_client.cpp2
-rw-r--r--src/gui/App.cpp58
-rw-r--r--src/gui/App.hpp16
-rw-r--r--src/gui/ConnectWindow.cpp43
-rw-r--r--src/gui/ConnectWindow.hpp2
-rw-r--r--src/gui/GraphBox.cpp18
-rw-r--r--src/gui/GraphCanvas.cpp18
-rw-r--r--src/gui/GraphPortModule.cpp4
-rw-r--r--src/gui/LoadGraphWindow.cpp6
-rw-r--r--src/gui/NodeModule.cpp6
-rw-r--r--src/gui/Port.cpp34
-rw-r--r--src/gui/PropertiesWindow.cpp41
-rw-r--r--src/gui/RDFS.cpp76
-rw-r--r--src/gui/RDFS.hpp18
-rw-r--r--src/gui/ThreadedLoader.cpp20
-rw-r--r--src/gui/URIEntry.cpp12
-rw-r--r--src/gui/ingen_gui.cpp20
-rw-r--r--src/gui/ingen_gui_lv2.cpp2
-rw-r--r--src/ingen/ingen.cpp2
-rw-r--r--src/server/BlockFactory.cpp24
-rw-r--r--src/server/BlockFactory.hpp4
-rw-r--r--src/server/BufferFactory.cpp4
-rw-r--r--src/server/CompiledGraph.cpp2
-rw-r--r--src/server/ControlBindings.cpp18
-rw-r--r--src/server/Engine.cpp58
-rw-r--r--src/server/Engine.hpp6
-rw-r--r--src/server/GraphImpl.cpp4
-rw-r--r--src/server/JackDriver.cpp34
-rw-r--r--src/server/LV2Block.cpp49
-rw-r--r--src/server/LV2Block.hpp2
-rw-r--r--src/server/LV2Options.hpp2
-rw-r--r--src/server/LV2Plugin.cpp20
-rw-r--r--src/server/LV2Plugin.hpp6
-rw-r--r--src/server/LV2ResizeFeature.hpp2
-rw-r--r--src/server/PortAudioDriver.cpp4
-rw-r--r--src/server/PortImpl.cpp8
-rw-r--r--src/server/PreProcessor.cpp6
-rw-r--r--src/server/RunContext.cpp4
-rw-r--r--src/server/SocketListener.cpp38
-rw-r--r--src/server/Worker.cpp2
-rw-r--r--src/server/Worker.hpp2
-rw-r--r--src/server/events/Copy.cpp20
-rw-r--r--src/server/events/CreateBlock.cpp2
-rw-r--r--src/server/events/CreateGraph.cpp4
-rw-r--r--src/server/events/CreatePort.cpp8
-rw-r--r--src/server/events/Delete.cpp4
-rw-r--r--src/server/events/Delta.cpp14
-rw-r--r--src/server/events/Get.cpp2
-rw-r--r--src/server/events/SetPortValue.cpp8
-rw-r--r--src/server/ingen_engine.cpp10
-rw-r--r--src/server/ingen_jack.cpp14
-rw-r--r--src/server/ingen_lv2.cpp40
-rw-r--r--src/server/ingen_portaudio.cpp10
68 files changed, 472 insertions, 478 deletions
diff --git a/ingen/DataAccess.hpp b/ingen/DataAccess.hpp
index fb3e3a79..34b59a49 100644
--- a/ingen/DataAccess.hpp
+++ b/ingen/DataAccess.hpp
@@ -41,8 +41,8 @@ struct DataAccess : public ingen::LV2Features::Feature
const char* uri() const override { return "http://lv2plug.in/ns/ext/data-access"; }
- SPtr<LV2_Feature> feature(World* world, Node* node) override {
- Node* store_node = world->store()->get(node->path());
+ SPtr<LV2_Feature> feature(World& world, Node* node) override {
+ Node* store_node = world.store()->get(node->path());
if (!store_node) {
return SPtr<LV2_Feature>();
}
diff --git a/ingen/InstanceAccess.hpp b/ingen/InstanceAccess.hpp
index 85fdae16..27ae0d4e 100644
--- a/ingen/InstanceAccess.hpp
+++ b/ingen/InstanceAccess.hpp
@@ -34,8 +34,8 @@ struct InstanceAccess : public ingen::LV2Features::Feature
{
const char* uri() const override { return "http://lv2plug.in/ns/ext/instance-access"; }
- SPtr<LV2_Feature> feature(World* world, Node* node) override {
- Node* store_node = world->store()->get(node->path());
+ SPtr<LV2_Feature> feature(World& world, Node* node) override {
+ Node* store_node = world.store()->get(node->path());
if (!store_node) {
return SPtr<LV2_Feature>();
}
diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp
index 541af576..db5d530f 100644
--- a/ingen/LV2Features.hpp
+++ b/ingen/LV2Features.hpp
@@ -44,7 +44,7 @@ public:
virtual const char* uri() const = 0;
- virtual SPtr<LV2_Feature> feature(World* world,
+ virtual SPtr<LV2_Feature> feature(World& world,
Node* block) = 0;
protected:
@@ -57,7 +57,7 @@ protected:
const char* uri() const override { return _uri; }
- SPtr<LV2_Feature> feature(World* world, Node* block) override {
+ SPtr<LV2_Feature> feature(World& world, Node* block) override {
return SPtr<LV2_Feature>();
}
@@ -82,8 +82,7 @@ protected:
void add_feature(SPtr<Feature> feature);
bool is_supported(const std::string& uri) const;
- SPtr<FeatureArray> lv2_features(World* world,
- Node* node) const;
+ SPtr<FeatureArray> lv2_features(World& world, Node* node) const;
private:
typedef std::vector< SPtr<Feature> > Features;
diff --git a/ingen/Log.hpp b/ingen/Log.hpp
index ed964447..4d1bd1ee 100644
--- a/ingen/Log.hpp
+++ b/ingen/Log.hpp
@@ -47,7 +47,7 @@ public:
struct Feature : public LV2Features::Feature {
const char* uri() const override { return LV2_LOG__log; }
- SPtr<LV2_Feature> feature(World* world, Node* block) override;
+ SPtr<LV2_Feature> feature(World& world, Node* block) override;
struct Handle {
LV2_Log_Log lv2_log;
diff --git a/ingen/Module.hpp b/ingen/Module.hpp
index 405f4fa1..17f7b10b 100644
--- a/ingen/Module.hpp
+++ b/ingen/Module.hpp
@@ -40,8 +40,8 @@ public:
Module(const Module&) = delete;
Module& operator=(const Module&) = delete;
- virtual void load(ingen::World* world) = 0;
- virtual void run(ingen::World* world) {}
+ virtual void load(ingen::World& world) = 0;
+ virtual void run(ingen::World& world) {}
/** Library implementing this module.
*
diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp
index 1dbb950c..f1825439 100644
--- a/ingen/URIMap.hpp
+++ b/ingen/URIMap.hpp
@@ -57,7 +57,7 @@ public:
const char* uri() const override { return _feature.URI; }
- SPtr<LV2_Feature> feature(World*, Node*) override {
+ SPtr<LV2_Feature> feature(World&, Node*) override {
return SPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>);
}
diff --git a/ingen/World.hpp b/ingen/World.hpp
index 89dc983b..d895b742 100644
--- a/ingen/World.hpp
+++ b/ingen/World.hpp
@@ -89,7 +89,7 @@ public:
virtual bool run_module(const char* name);
/** A function to create a new remote Interface. */
- typedef SPtr<Interface> (*InterfaceFactory)(World* world,
+ typedef SPtr<Interface> (*InterfaceFactory)(World& world,
const URI& engine_uri,
SPtr<Interface> respondee);
diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp
index 97fbd2a0..08a0fec9 100644
--- a/ingen/client/PluginModel.hpp
+++ b/ingen/client/PluginModel.hpp
@@ -83,7 +83,7 @@ public:
bool has_ui() const;
- SPtr<PluginUI> ui(ingen::World* world,
+ SPtr<PluginUI> ui(ingen::World& world,
SPtr<const BlockModel> block) const;
std::string documentation(bool html) const;
diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp
index 6a6d6db9..f17c8f61 100644
--- a/ingen/client/PluginUI.hpp
+++ b/ingen/client/PluginUI.hpp
@@ -48,7 +48,7 @@ public:
* connected first. The caller should connect to signal_property_changed,
* then call instantiate().
*/
- static SPtr<PluginUI> create(ingen::World* world,
+ static SPtr<PluginUI> create(ingen::World& world,
SPtr<const BlockModel> block,
const LilvPlugin* plugin);
@@ -81,17 +81,17 @@ public:
const Atom&, // Object
Resource::Graph); // Context
- ingen::World* world() const { return _world; }
+ ingen::World& world() const { return _world; }
SPtr<const BlockModel> block() const { return _block; }
private:
- PluginUI(ingen::World* world,
+ PluginUI(ingen::World& world,
SPtr<const BlockModel> block,
LilvUIs* uis,
const LilvUI* ui,
const LilvNode* ui_type);
- ingen::World* _world;
+ ingen::World& _world;
SPtr<const BlockModel> _block;
SuilInstance* _instance;
LilvUIs* _uis;
diff --git a/ingen/client/SocketClient.hpp b/ingen/client/SocketClient.hpp
index 9703cf29..bce5ab38 100644
--- a/ingen/client/SocketClient.hpp
+++ b/ingen/client/SocketClient.hpp
@@ -47,7 +47,7 @@ public:
}
static SPtr<ingen::Interface>
- new_socket_interface(ingen::World* world,
+ new_socket_interface(ingen::World& world,
const URI& uri,
SPtr<ingen::Interface> respondee)
{
@@ -57,16 +57,16 @@ public:
SPtr<Raul::Socket> sock(new Raul::Socket(type));
if (!sock->connect(uri)) {
- world->log().error(fmt("Failed to connect <%1%> (%2%)\n")
+ world.log().error(fmt("Failed to connect <%1%> (%2%)\n")
% sock->uri() % strerror(errno));
return SPtr<Interface>();
}
- return SPtr<Interface>(new SocketClient(*world, uri, sock, respondee));
+ return SPtr<Interface>(new SocketClient(world, uri, sock, respondee));
}
- static void register_factories(World* world) {
- world->add_interface_factory("unix", &new_socket_interface);
- world->add_interface_factory("tcp", &new_socket_interface);
+ static void register_factories(World& world) {
+ world.add_interface_factory("unix", &new_socket_interface);
+ world.add_interface_factory("tcp", &new_socket_interface);
}
private:
diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp
index b63ed980..dbe8f540 100644
--- a/src/LV2Features.cpp
+++ b/src/LV2Features.cpp
@@ -68,7 +68,7 @@ LV2Features::is_supported(const std::string& uri) const
}
SPtr<LV2Features::FeatureArray>
-LV2Features::lv2_features(World* world, Node* node) const
+LV2Features::lv2_features(World& world, Node* node) const
{
FeatureArray::FeatureVector vec;
for (const auto& f : _features) {
diff --git a/src/Log.cpp b/src/Log.cpp
index c1f8cb0a..c325a8ed 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -143,13 +143,13 @@ free_log_feature(LV2_Feature* feature) {
}
SPtr<LV2_Feature>
-Log::Feature::feature(World* world, Node* block)
+Log::Feature::feature(World& world, Node* block)
{
Handle* handle = (Handle*)calloc(1, sizeof(Handle));
handle->lv2_log.handle = handle;
handle->lv2_log.printf = log_printf;
handle->lv2_log.vprintf = log_vprintf;
- handle->log = &world->log();
+ handle->log = &world.log();
handle->node = block;
LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature));
diff --git a/src/World.cpp b/src/World.cpp
index 2daff6a6..fd13d643 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -188,7 +188,7 @@ public:
typedef std::map<const std::string, World::InterfaceFactory> InterfaceFactories;
InterfaceFactories interface_factories;
- typedef bool (*ScriptRunner)(World* world, const char* filename);
+ typedef bool (*ScriptRunner)(World& world, const char* filename);
typedef std::map<const std::string, ScriptRunner> ScriptRunners;
ScriptRunners script_runners;
@@ -283,7 +283,7 @@ World::load_module(const char* name)
Module* module = module_load();
if (module) {
module->library = std::move(lib);
- module->load(this);
+ module->load(*this);
_impl->modules.emplace(string(name), module);
return true;
}
@@ -302,7 +302,7 @@ World::run_module(const char* name)
return false;
}
- i->second->run(this);
+ i->second->run(*this);
return true;
}
@@ -318,7 +318,7 @@ World::new_interface(const URI& engine_uri, SPtr<Interface> respondee)
return SPtr<Interface>();
}
- return i->second(this, engine_uri, respondee);
+ return i->second(*this, engine_uri, respondee);
}
/** Run a script of type `mime_type` at filename `filename` */
@@ -331,7 +331,7 @@ World::run(const std::string& mime_type, const std::string& filename)
return false;
}
- return i->second(this, filename.c_str());
+ return i->second(*this, filename.c_str());
}
void
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 99269831..1770022e 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -240,7 +240,7 @@ PluginModel::has_ui() const
}
SPtr<PluginUI>
-PluginModel::ui(ingen::World* world,
+PluginModel::ui(ingen::World& world,
SPtr<const BlockModel> block) const
{
if (!_lilv_plugin) {
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 2368ad63..5f954b85 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -32,7 +32,7 @@ static SPtr<const PortModel>
get_port(PluginUI* ui, uint32_t port_index)
{
if (port_index >= ui->block()->ports().size()) {
- ui->world()->log().error(
+ ui->world().log().error(
fmt("%1% UI tried to access invalid port %2%\n")
% ui->block()->plugin()->uri().c_str() % port_index);
return SPtr<const PortModel>();
@@ -48,7 +48,7 @@ lv2_ui_write(SuilController controller,
const void* buffer)
{
PluginUI* const ui = (PluginUI*)controller;
- const URIs& uris = ui->world()->uris();
+ const URIs& uris = ui->world().uris();
SPtr<const PortModel> port = get_port(ui, port_index);
if (!port) {
return;
@@ -57,7 +57,7 @@ lv2_ui_write(SuilController controller,
// float (special case, always 0)
if (format == 0) {
if (buffer_size != 4) {
- ui->world()->log().error(
+ ui->world().log().error(
fmt("%1% UI wrote corrupt float with bad size\n")
% ui->block()->plugin()->uri().c_str());
return;
@@ -71,19 +71,19 @@ lv2_ui_write(SuilController controller,
ui->signal_property_changed()(
port->uri(),
uris.ingen_value,
- ui->world()->forge().make(value),
+ ui->world().forge().make(value),
Resource::Graph::DEFAULT);
} else if (format == uris.atom_eventTransfer.urid.get<LV2_URID>()) {
const LV2_Atom* atom = (const LV2_Atom*)buffer;
- Atom val = ui->world()->forge().alloc(
+ Atom val = ui->world().forge().alloc(
atom->size, atom->type, LV2_ATOM_BODY_CONST(atom));
ui->signal_property_changed()(port->uri(),
uris.ingen_activity,
val,
Resource::Graph::DEFAULT);
} else {
- ui->world()->log().warn(
+ ui->world().log().warn(
fmt("Unknown value format %1% from LV2 UI\n")
% format % ui->block()->plugin()->uri().c_str());
}
@@ -117,8 +117,8 @@ lv2_ui_subscribe(SuilController controller,
ui->signal_property_changed()(
ui->block()->ports()[port_index]->uri(),
- ui->world()->uris().ingen_broadcast,
- ui->world()->forge().make(true),
+ ui->world().uris().ingen_broadcast,
+ ui->world().forge().make(true),
Resource::Graph::DEFAULT);
return 0;
@@ -138,14 +138,14 @@ lv2_ui_unsubscribe(SuilController controller,
ui->signal_property_changed()(
ui->block()->ports()[port_index]->uri(),
- ui->world()->uris().ingen_broadcast,
- ui->world()->forge().make(false),
+ ui->world().uris().ingen_broadcast,
+ ui->world().forge().make(false),
Resource::Graph::DEFAULT);
return 0;
}
-PluginUI::PluginUI(ingen::World* world,
+PluginUI::PluginUI(ingen::World& world,
SPtr<const BlockModel> block,
LilvUIs* uis,
const LilvUI* ui,
@@ -169,11 +169,11 @@ PluginUI::~PluginUI()
lilv_node_free(_ui_node);
lilv_node_free(_ui_type);
lilv_uis_free(_uis);
- lilv_world_unload_resource(_world->lilv_world(), lilv_ui_get_uri(_ui));
+ lilv_world_unload_resource(_world.lilv_world(), lilv_ui_get_uri(_ui));
}
SPtr<PluginUI>
-PluginUI::create(ingen::World* world,
+PluginUI::create(ingen::World& world,
SPtr<const BlockModel> block,
const LilvPlugin* plugin)
{
@@ -186,7 +186,7 @@ PluginUI::create(ingen::World* world,
static const char* gtk_ui_uri = LV2_UI__GtkUI;
- LilvNode* gtk_ui = lilv_new_uri(world->lilv_world(), gtk_ui_uri);
+ LilvNode* gtk_ui = lilv_new_uri(world.lilv_world(), gtk_ui_uri);
LilvUIs* uis = lilv_plugin_get_uis(plugin);
const LilvUI* ui = nullptr;
@@ -210,7 +210,7 @@ PluginUI::create(ingen::World* world,
// Create the PluginUI, but don't instantiate yet
SPtr<PluginUI> ret(new PluginUI(world, block, uis, ui, ui_type));
- ret->_features = world->lv2_features().lv2_features(
+ ret->_features = world.lv2_features().lv2_features(
world, const_cast<BlockModel*>(block.get()));
return ret;
@@ -219,9 +219,9 @@ PluginUI::create(ingen::World* world,
bool
PluginUI::instantiate()
{
- const URIs& uris = _world->uris();
+ const URIs& uris = _world.uris();
const std::string plugin_uri = _block->plugin()->uri();
- LilvWorld* lworld = _world->lilv_world();
+ LilvWorld* lworld = _world.lilv_world();
// Load seeAlso files to access data like portNotification descriptions
lilv_world_load_resource(lworld, lilv_ui_get_uri(_ui));
@@ -238,14 +238,14 @@ PluginUI::instantiate()
const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, nullptr);
const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, nullptr);
if (!plug) {
- _world->log().error(fmt("%1% UI %2% notification missing plugin\n")
- % plugin_uri % lilv_node_as_string(_ui_node));
+ _world.log().error(fmt("%1% UI %2% notification missing plugin\n")
+ % plugin_uri % lilv_node_as_string(_ui_node));
} else if (!sym) {
- _world->log().error(fmt("%1% UI %2% notification missing symbol\n")
- % plugin_uri % lilv_node_as_string(_ui_node));
+ _world.log().error(fmt("%1% UI %2% notification missing symbol\n")
+ % plugin_uri % lilv_node_as_string(_ui_node));
} else if (!lilv_node_is_uri(plug)) {
- _world->log().error(fmt("%1% UI %2% notification has non-URI plugin\n")
- % plugin_uri % lilv_node_as_string(_ui_node));
+ _world.log().error(fmt("%1% UI %2% notification has non-URI plugin\n")
+ % plugin_uri % lilv_node_as_string(_ui_node));
} else if (!strcmp(lilv_node_as_uri(plug), plugin_uri.c_str())) {
// Notification is valid and for this plugin
uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym));
@@ -280,7 +280,7 @@ PluginUI::instantiate()
lilv_free(bundle_path);
if (!_instance) {
- _world->log().error("Failed to instantiate LV2 UI\n");
+ _world.log().error("Failed to instantiate LV2 UI\n");
// Cancel any subscriptions
for (uint32_t i : _subscribed_ports) {
lv2_ui_unsubscribe(this, i, 0, nullptr);
@@ -307,14 +307,14 @@ PluginUI::port_event(uint32_t port_index,
suil_instance_port_event(
_instance, port_index, buffer_size, format, buffer);
} else {
- _world->log().warn("LV2 UI port event with no instance\n");
+ _world.log().warn("LV2 UI port event with no instance\n");
}
}
bool
PluginUI::is_resizable() const
{
- LilvWorld* w = _world->lilv_world();
+ LilvWorld* w = _world.lilv_world();
const LilvNode* s = _ui_node;
LilvNode* p = lilv_new_uri(w, LV2_CORE__optionalFeature);
LilvNode* fs = lilv_new_uri(w, LV2_UI__fixedSize);
diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp
index 0660b66d..e56f42e4 100644
--- a/src/client/ingen_client.cpp
+++ b/src/client/ingen_client.cpp
@@ -20,7 +20,7 @@
#include "ingen_config.h"
struct IngenClientModule : public ingen::Module {
- void load(ingen::World* world) override {}
+ void load(ingen::World& world) override {}
};
extern "C" {
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 8a33fe46..df4159a1 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -70,7 +70,7 @@ class Port;
Gtk::Main* App::_main = nullptr;
-App::App(ingen::World* world)
+App::App(ingen::World& world)
: _style(new Style(*this))
, _about_dialog(nullptr)
, _window_factory(new WindowFactory(*this))
@@ -85,7 +85,7 @@ App::App(ingen::World* world)
, _requested_plugins(false)
, _is_plugin(false)
{
- _world->conf().load_default("ingen", "gui.ttl");
+ _world.conf().load_default("ingen", "gui.ttl");
WidgetFactory::get_widget_derived("connect_win", _connect_window);
WidgetFactory::get_widget_derived("messages_win", _messages_window);
@@ -97,11 +97,11 @@ App::App(ingen::World* world)
_about_dialog->property_program_name() = "Ingen";
_about_dialog->property_logo_icon_name() = "ingen";
- PluginModel::set_rdf_world(*world->rdf_world());
- PluginModel::set_lilv_world(world->lilv_world());
+ PluginModel::set_rdf_world(*world.rdf_world());
+ PluginModel::set_lilv_world(world.lilv_world());
using namespace std::placeholders;
- world->log().set_sink(std::bind(&MessagesWindow::log, _messages_window, _1, _2, _3));
+ world.log().set_sink(std::bind(&MessagesWindow::log, _messages_window, _1, _2, _3));
}
App::~App()
@@ -111,9 +111,9 @@ App::~App()
}
SPtr<App>
-App::create(ingen::World* world)
+App::create(ingen::World& world)
{
- suil_init(&world->argc(), &world->argv(), SUIL_ARG_NONE);
+ suil_init(&world.argc(), &world.argv(), SUIL_ARG_NONE);
// Add RC file for embedded GUI Gtk style
const std::string rc_path = ingen::data_file_path("ingen_style.rc");
@@ -123,10 +123,10 @@ App::create(ingen::World* world)
if (!_main) {
Glib::set_application_name("Ingen");
gtk_window_set_default_icon_name("ingen");
- _main = new Gtk::Main(&world->argc(), &world->argv());
+ _main = new Gtk::Main(&world.argc(), &world.argv());
}
- App* app = new App(world);
+ auto app = SPtr<App>{new App(world)};
// Load configuration settings
app->style()->load_settings();
@@ -137,7 +137,7 @@ App::create(ingen::World* world)
app->_about_dialog->property_logo_icon_name() = "ingen";
gtk_window_set_default_icon_name("ingen");
- return SPtr<App>(app);
+ return app;
}
void
@@ -164,20 +164,20 @@ App::attach(SPtr<ingen::Interface> client)
assert(!_store);
assert(!_loader);
- if (_world->engine()) {
- _world->engine()->register_client(client);
+ if (_world.engine()) {
+ _world.engine()->register_client(client);
}
_client = client;
- _store = SPtr<ClientStore>(new ClientStore(_world->uris(), _world->log(), sig_client()));
- _loader = SPtr<ThreadedLoader>(new ThreadedLoader(*this, _world->interface()));
- if (!_world->store()) {
- _world->set_store(_store);
+ _store = SPtr<ClientStore>(new ClientStore(_world.uris(), _world.log(), sig_client()));
+ _loader = SPtr<ThreadedLoader>(new ThreadedLoader(*this, _world.interface()));
+ if (!_world.store()) {
+ _world.set_store(_store);
}
- if (_world->conf().option("dump").get<int32_t>()) {
- _dumper = SPtr<StreamWriter>(new StreamWriter(_world->uri_map(),
- _world->uris(),
+ if (_world.conf().option("dump").get<int32_t>()) {
+ _dumper = SPtr<StreamWriter>(new StreamWriter(_world.uri_map(),
+ _world.uris(),
URI("ingen:/client"),
stderr,
ColorContext::Color::CYAN));
@@ -193,14 +193,14 @@ App::attach(SPtr<ingen::Interface> client)
void
App::detach()
{
- if (_world->interface()) {
+ if (_world.interface()) {
_window_factory->clear();
_store->clear();
_loader.reset();
_store.reset();
_client.reset();
- _world->set_interface(SPtr<Interface>());
+ _world.set_interface(SPtr<Interface>());
}
}
@@ -208,7 +208,7 @@ void
App::request_plugins_if_necessary()
{
if (!_requested_plugins) {
- _world->interface()->get(URI("ingen:/plugins"));
+ _world.interface()->get(URI("ingen:/plugins"));
_requested_plugins = true;
}
}
@@ -226,7 +226,7 @@ App::sig_client()
SPtr<Serialiser>
App::serialiser()
{
- return _world->serialiser();
+ return _world.serialiser();
}
void
@@ -323,7 +323,7 @@ App::property_change(const URI& subject,
} else if (key == uris().ingen_maxRunLoad && value.type() == forge().Float) {
_max_run_load = value.get<float>();
} else {
- _world->log().warn(fmt("Unknown engine property %1%\n") % key);
+ _world.log().warn(fmt("Unknown engine property %1%\n") % key);
return;
}
@@ -421,8 +421,8 @@ App::gtk_main_iteration()
}
_enable_signal = false;
- if (_world->engine()) {
- if (!_world->engine()->main_iteration()) {
+ if (_world.engine()) {
+ if (!_world.engine()->main_iteration()) {
Gtk::Main::quit();
return false;
}
@@ -448,7 +448,7 @@ bool
App::quit(Gtk::Window* dialog_parent)
{
bool quit = true;
- if (_world->engine() && _connect_window->attached()) {
+ if (_world.engine() && _connect_window->attached()) {
Gtk::MessageDialog d(
"The engine is running in this process. Quitting will terminate Ingen."
"\n\n" "Are you sure you want to quit?",
@@ -468,8 +468,8 @@ App::quit(Gtk::Window* dialog_parent)
Gtk::Main::quit();
try {
- const std::string path = _world->conf().save(
- _world->uri_map(), "ingen", "gui.ttl", Configuration::GUI);
+ const std::string path = _world.conf().save(
+ _world.uri_map(), "ingen", "gui.ttl", Configuration::GUI);
std::cout << (fmt("Saved GUI settings to %1%\n") % path);
} catch (const std::exception& e) {
std::cerr << (fmt("Error saving GUI settings (%1%)\n")
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 76465bfb..1aa5cbc1 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -118,8 +118,8 @@ public:
Style* style() const { return _style; }
WindowFactory* window_factory() const { return _window_factory; }
- ingen::Forge& forge() const { return _world->forge(); }
- SPtr<ingen::Interface> interface() const { return _world->interface(); }
+ ingen::Forge& forge() const { return _world.forge(); }
+ SPtr<ingen::Interface> interface() const { return _world.interface(); }
SPtr<ingen::Interface> client() const { return _client; }
SPtr<client::ClientStore> store() const { return _store; }
SPtr<ThreadedLoader> loader() const { return _loader; }
@@ -128,7 +128,7 @@ public:
SPtr<Serialiser> serialiser();
- static SPtr<App> create(ingen::World* world);
+ static SPtr<App> create(ingen::World& world);
void run();
@@ -136,12 +136,12 @@ public:
sigc::signal<void, const std::string&> signal_status_text_changed;
- inline ingen::World* world() const { return _world; }
- inline ingen::URIs& uris() const { return _world->uris(); }
- inline ingen::Log& log() const { return _world->log(); }
+ inline ingen::World& world() const { return _world; }
+ inline ingen::URIs& uris() const { return _world.uris(); }
+ inline ingen::Log& log() const { return _world.log(); }
protected:
- explicit App(ingen::World* world);
+ explicit App(ingen::World& world);
void message(const ingen::Message& msg);
@@ -172,7 +172,7 @@ protected:
Gtk::AboutDialog* _about_dialog;
WindowFactory* _window_factory;
- ingen::World* _world;
+ ingen::World& _world;
int32_t _sample_rate;
int32_t _block_length;
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index e76fbc06..e2968ea2 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -96,22 +96,22 @@ ConnectWindow::error(const std::string& msg)
_progress_label->set_text(msg);
}
- if (_app && _app->world()) {
- _app->world()->log().error(msg + "\n");
+ if (_app) {
+ _app->world().log().error(msg + "\n");
}
}
void
-ConnectWindow::start(App& app, ingen::World* world)
+ConnectWindow::start(App& app, ingen::World& world)
{
_app = &app;
- if (world->engine()) {
+ if (world.engine()) {
_mode = Mode::INTERNAL;
}
- set_connected_to(world->interface());
- connect(bool(world->interface()));
+ set_connected_to(world.interface());
+ connect(bool(world.interface()));
}
void
@@ -131,7 +131,7 @@ ConnectWindow::ingen_response(int32_t id,
void
ConnectWindow::set_connected_to(SPtr<ingen::Interface> engine)
{
- _app->world()->set_interface(engine);
+ _app->world().set_interface(engine);
if (!_widgets_loaded) {
return;
@@ -193,14 +193,14 @@ ConnectWindow::set_connecting_widget_states()
bool
ConnectWindow::connect_remote(const URI& uri)
{
- ingen::World* world = _app->world();
+ ingen::World& world = _app->world();
SPtr<SigClientInterface> sci(new SigClientInterface());
SPtr<QueuedInterface> qi(new QueuedInterface(sci));
- SPtr<ingen::Interface> iface(world->new_interface(uri, qi));
+ SPtr<ingen::Interface> iface(world.new_interface(uri, qi));
if (iface) {
- world->set_interface(iface);
+ world.set_interface(iface);
_app->attach(qi);
_app->register_callbacks();
return true;
@@ -223,14 +223,15 @@ ConnectWindow::connect(bool existing)
set_connecting_widget_states();
_connect_stage = 0;
- ingen::World* world = _app->world();
+ ingen::World& world = _app->world();
if (_mode == Mode::CONNECT_REMOTE) {
- std::string uri_str = world->conf().option("connect").ptr<char>();
+ std::string uri_str = world.conf().option("connect").ptr<char>();
if (existing) {
- uri_str = world->interface()->uri();
+ uri_str = world.interface()->uri();
_connect_stage = 1;
- SPtr<client::SocketClient> client = dynamic_ptr_cast<client::SocketClient>(world->interface());
+ SPtr<client::SocketClient> client = dynamic_ptr_cast<client::SocketClient>(
+ world.interface());
if (client) {
_app->attach(client->respondee());
_app->register_callbacks();
@@ -261,14 +262,14 @@ ConnectWindow::connect(bool existing)
_connect_uri = URI(std::string("tcp://localhost:") + port);
} else if (_mode == Mode::INTERNAL) {
- if (!world->engine()) {
- if (!world->load_module("server")) {
+ if (!world.engine()) {
+ if (!world.load_module("server")) {
error("Failed to load server module");
return;
- } else if (!world->load_module("jack")) {
+ } else if (!world.load_module("jack")) {
error("Failed to load jack module");
return;
- } else if (!world->engine()->activate()) {
+ } else if (!world.engine()->activate()) {
error("Failed to activate engine");
return;
}
@@ -376,7 +377,7 @@ ConnectWindow::load_widgets()
_quit_button->signal_clicked().connect(
sigc::mem_fun(this, &ConnectWindow::quit_clicked));
- _url_entry->set_text(_app->world()->conf().option("connect").ptr<char>());
+ _url_entry->set_text(_app->world().conf().option("connect").ptr<char>());
if (URI::is_valid(_url_entry->get_text())) {
_connect_uri = URI(_url_entry->get_text());
}
@@ -384,7 +385,7 @@ ConnectWindow::load_widgets()
_port_spinbutton->set_range(1, std::numeric_limits<uint16_t>::max());
_port_spinbutton->set_increments(1, 100);
_port_spinbutton->set_value(
- _app->world()->conf().option("engine-port").get<int32_t>());
+ _app->world().conf().option("engine-port").get<int32_t>());
_progress_bar->set_pulse_step(0.01);
_widgets_loaded = true;
@@ -485,7 +486,7 @@ ConnectWindow::gtk_callback()
last = now;
if (_mode == Mode::INTERNAL) {
SPtr<SigClientInterface> client(new SigClientInterface());
- _app->world()->interface()->set_respondee(client);
+ _app->world().interface()->set_respondee(client);
_app->attach(client);
_app->register_callbacks();
next_stage();
diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp
index 151b8e92..093fafc0 100644
--- a/src/gui/ConnectWindow.hpp
+++ b/src/gui/ConnectWindow.hpp
@@ -50,7 +50,7 @@ public:
Glib::RefPtr<Gtk::Builder> xml);
void set_connected_to(SPtr<ingen::Interface> engine);
- void start(App& app, ingen::World* world);
+ void start(App& app, ingen::World& world);
bool attached() const { return _finished_connecting; }
bool quit_flag() const { return _quit_flag; }
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 966e8b9c..cb9edf98 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -345,9 +345,9 @@ GraphBox::set_graph(SPtr<const GraphModel> graph,
_alignment->show_all();
_menu_human_names->set_active(
- _app->world()->conf().option("human-names").get<int32_t>());
+ _app->world().conf().option("human-names").get<int32_t>());
_menu_show_port_names->set_active(
- _app->world()->conf().option("port-labels").get<int32_t>());
+ _app->world().conf().option("port-labels").get<int32_t>());
_doc_paned->set_position(std::numeric_limits<int>::max());
_doc_scrolledwindow->hide();
@@ -576,7 +576,7 @@ GraphBox::event_save_as()
// Set current folder to most sensible default
const Atom& document = _graph->get_property(uris.ingen_file);
- const Atom& dir = _app->world()->conf().option("graph-directory");
+ const Atom& dir = _app->world().conf().option("graph-directory");
if (document.type() == uris.forge.URI) {
dialog.set_uri(document.ptr<char>());
} else if (dir.is_valid()) {
@@ -649,9 +649,9 @@ GraphBox::event_save_as()
_app->forge().alloc_uri(uri.c_str()));
}
- _app->world()->conf().set(
+ _app->world().conf().set(
"graph-directory",
- _app->world()->forge().alloc(dialog.get_current_folder()));
+ _app->world().forge().alloc(dialog.get_current_folder()));
break;
}
@@ -898,17 +898,17 @@ void
GraphBox::event_human_names_toggled()
{
_view->canvas()->show_human_names(_menu_human_names->get_active());
- _app->world()->conf().set(
+ _app->world().conf().set(
"human-names",
- _app->world()->forge().make(_menu_human_names->get_active()));
+ _app->world().forge().make(_menu_human_names->get_active()));
}
void
GraphBox::event_port_names_toggled()
{
- _app->world()->conf().set(
+ _app->world().conf().set(
"port-labels",
- _app->world()->forge().make(_menu_show_port_names->get_active()));
+ _app->world().forge().make(_menu_show_port_names->get_active()));
if (_menu_show_port_names->get_active()) {
_view->canvas()->set_direction(GANV_DIRECTION_RIGHT);
_view->canvas()->show_port_names(true);
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 6ff2abed..47a0abcf 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -171,8 +171,8 @@ GraphCanvas::GraphCanvas(App& app,
_menu_properties->signal_activate().connect(
sigc::mem_fun(this, &GraphCanvas::menu_properties));
- show_human_names(app.world()->conf().option("human-names").get<int32_t>());
- show_port_names(app.world()->conf().option("port-labels").get<int32_t>());
+ show_human_names(app.world().conf().option("human-names").get<int32_t>());
+ show_port_names(app.world().conf().option("port-labels").get<int32_t>());
set_port_order(port_order, nullptr);
}
@@ -213,7 +213,7 @@ GraphCanvas::build_menus()
if (_plugin_menu) {
_plugin_menu->clear();
} else {
- _plugin_menu = Gtk::manage(new PluginMenu(*_app.world()));
+ _plugin_menu = Gtk::manage(new PluginMenu(_app.world()));
_menu->items().push_back(
Gtk::Menu_Helpers::ImageMenuElem(
"_Plugin",
@@ -280,7 +280,7 @@ void
GraphCanvas::show_human_names(bool b)
{
_human_names = b;
- _app.world()->conf().set("human-names", _app.forge().make(b));
+ _app.world().conf().set("human-names", _app.forge().make(b));
for_each_node(show_module_human_names, &b);
}
@@ -643,9 +643,9 @@ serialise_arc(GanvEdge* arc, void* data)
void
GraphCanvas::copy_selection()
{
- std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex());
+ std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
- Serialiser serialiser(*_app.world());
+ Serialiser serialiser(_app.world());
serialiser.start_to_string(_graph->path(), _graph->base_uri());
for_each_selected_node(serialise_node, &serialiser);
@@ -661,7 +661,7 @@ GraphCanvas::paste()
{
typedef Properties::const_iterator PropIter;
- std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex());
+ std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
const Glib::ustring str = Gtk::Clipboard::get()->wait_for_text();
SPtr<Parser> parser = _app.loader()->parser();
@@ -678,14 +678,14 @@ GraphCanvas::paste()
++_paste_count;
// Make a client store to serve as clipboard
- ClientStore clipboard(_app.world()->uris(), _app.log());
+ ClientStore clipboard(_app.world().uris(), _app.log());
clipboard.set_plugins(_app.store()->plugins());
clipboard.put(main_uri(),
{{uris.rdf_type, Property(uris.ingen_Graph)}});
// Parse clipboard text into clipboard store
boost::optional<URI> base_uri = parser->parse_string(
- *_app.world(), clipboard, str, main_uri());
+ _app.world(), clipboard, str, main_uri());
// Figure out the copy graph base path
Raul::Path copy_root("/");
diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp
index b5b234c4..a1ea6ce2 100644
--- a/src/gui/GraphPortModule.cpp
+++ b/src/gui/GraphPortModule.cpp
@@ -141,10 +141,10 @@ GraphPortModule::property_changed(const URI& key, const Atom& value)
}
} else if (value.type() == uris.forge.String) {
if (key == uris.lv2_name &&
- app().world()->conf().option("human-names").get<int32_t>()) {
+ app().world().conf().option("human-names").get<int32_t>()) {
set_name(value.ptr<char>());
} else if (key == uris.lv2_symbol &&
- !app().world()->conf().option("human-names").get<int32_t>()) {
+ !app().world().conf().option("human-names").get<int32_t>()) {
set_name(value.ptr<char>());
}
} else if (value.type() == uris.forge.Bool) {
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index a8bbd94a..d5ffa16e 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -126,7 +126,7 @@ LoadGraphWindow::set_graph(SPtr<const GraphModel> graph)
void
LoadGraphWindow::on_show()
{
- const Atom& dir = _app->world()->conf().option("graph-directory");
+ const Atom& dir = _app->world().conf().option("graph-directory");
if (dir.is_valid()) {
set_current_folder(dir.ptr<char>());
}
@@ -201,9 +201,9 @@ LoadGraphWindow::ok_clicked()
_graph.reset();
hide();
- _app->world()->conf().set(
+ _app->world().conf().set(
"graph-directory",
- _app->world()->forge().alloc(get_current_folder()));
+ _app->world().forge().alloc(get_current_folder()));
}
void
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 8605e91d..ae030067 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -295,8 +295,8 @@ NodeModule::embed_gui(bool embed)
void
NodeModule::rename()
{
- if (app().world()->conf().option("port-labels").get<int32_t>() &&
- !app().world()->conf().option("human-names").get<int32_t>()) {
+ if (app().world().conf().option("port-labels").get<int32_t>() &&
+ !app().world().conf().option("human-names").get<int32_t>()) {
set_label(_block->path().symbol());
}
}
@@ -484,7 +484,7 @@ NodeModule::property_changed(const URI& key, const Atom& value)
}
} else if (value.type() == uris.forge.String) {
if (key == uris.lv2_name
- && app().world()->conf().option("human-names").get<int32_t>()) {
+ && app().world().conf().option("human-names").get<int32_t>()) {
set_label(value.ptr<char>());
}
}
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 60e11471..82db9a0a 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -117,8 +117,8 @@ Port::port_label(App& app, SPtr<const PortModel> pm)
}
std::string label;
- if (app.world()->conf().option("port-labels").get<int32_t>()) {
- if (app.world()->conf().option("human-names").get<int32_t>()) {
+ if (app.world().conf().option("port-labels").get<int32_t>()) {
+ if (app.world().conf().option("human-names").get<int32_t>()) {
const Atom& name = pm->get_property(app.uris().lv2_name);
if (name.type() == app.forge().String) {
label = name.ptr<char>();
@@ -178,8 +178,8 @@ Port::show_menu(GdkEventButton* ev)
void
Port::moved()
{
- if (_app.world()->conf().option("port-labels").get<int32_t>() &&
- !_app.world()->conf().option("human-names").get<int32_t>()) {
+ if (_app.world().conf().option("port-labels").get<int32_t>() &&
+ !_app.world().conf().option("human-names").get<int32_t>()) {
set_label(model()->symbol().c_str());
}
}
@@ -199,7 +199,7 @@ Port::on_value_changed(double value)
const Atom atom = _app.forge().make(float(value));
_app.set_property(model()->uri(),
- _app.world()->uris().ingen_value,
+ _app.world().uris().ingen_value,
atom);
if (_entered) {
@@ -222,8 +222,8 @@ void
Port::on_scale_point_activated(float f)
{
_app.set_property(model()->uri(),
- _app.world()->uris().ingen_value,
- _app.world()->forge().make(f));
+ _app.world().uris().ingen_value,
+ _app.world().forge().make(f));
}
Gtk::Menu*
@@ -249,15 +249,15 @@ void
Port::on_uri_activated(const URI& uri)
{
_app.set_property(model()->uri(),
- _app.world()->uris().ingen_value,
- _app.world()->forge().make_urid(
- _app.world()->uri_map().map_uri(uri.c_str())));
+ _app.world().uris().ingen_value,
+ _app.world().forge().make_urid(
+ _app.world().uri_map().map_uri(uri.c_str())));
}
Gtk::Menu*
Port::build_uri_menu()
{
- World* world = _app.world();
+ World& world = _app.world();
SPtr<const BlockModel> block = dynamic_ptr_cast<BlockModel>(model()->parent());
Gtk::Menu* menu = Gtk::manage(new Gtk::Menu());
@@ -269,14 +269,14 @@ Port::build_uri_menu()
}
LilvNode* designation = lilv_new_uri(
- world->lilv_world(), world->forge().str(designation_atom, false).c_str());
+ world.lilv_world(), world.forge().str(designation_atom, false).c_str());
LilvNode* rdfs_range = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDFS "range");
+ world.lilv_world(), LILV_NS_RDFS "range");
// Get every class in the range of the port's property
rdfs::URISet ranges;
LilvNodes* range = lilv_world_find_nodes(
- world->lilv_world(), designation, rdfs_range, nullptr);
+ world.lilv_world(), designation, rdfs_range, nullptr);
LILV_FOREACH(nodes, r, range) {
ranges.insert(URI(lilv_node_as_string(lilv_nodes_get(range, r))));
}
@@ -288,7 +288,7 @@ Port::build_uri_menu()
// Add a menu item for each such class
for (const auto& v : values) {
if (!v.first.empty()) {
- const std::string qname = world->rdf_world()->prefixes().qualify(v.second);
+ const std::string qname = world.rdf_world()->prefixes().qualify(v.second);
const std::string label = qname + " - " + v.first;
menu->items().push_back(Gtk::Menu_Helpers::MenuElem(label));
Gtk::MenuItem* menu_item = &(menu->items().back());
@@ -482,8 +482,8 @@ Port::property_changed(const URI& key, const Atom& value)
port_properties_changed();
} else if (key == uris.lv2_name) {
if (value.type() == uris.forge.String &&
- _app.world()->conf().option("port-labels").get<int32_t>() &&
- _app.world()->conf().option("human-names").get<int32_t>()) {
+ _app.world().conf().option("port-labels").get<int32_t>() &&
+ _app.world().conf().option("human-names").get<int32_t>()) {
set_label(value.ptr<char>());
}
} else if (key == uris.rdf_type || key == uris.atom_bufferType) {
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 80565dd5..994ed224 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -102,16 +102,16 @@ PropertiesWindow::present(SPtr<const ObjectModel> model)
void
PropertiesWindow::add_property(const URI& key, const Atom& value)
{
- World* world = _app->world();
+ World& world = _app->world();
const unsigned n_rows = _table->property_n_rows() + 1;
_table->property_n_rows() = n_rows;
// Column 0: Property
- LilvNode* prop = lilv_new_uri(world->lilv_world(), key.c_str());
+ LilvNode* prop = lilv_new_uri(world.lilv_world(), key.c_str());
std::string name = rdfs::label(world, prop);
if (name.empty()) {
- name = world->rdf_world()->prefixes().qualify(key);
+ name = world.rdf_world()->prefixes().qualify(key);
}
Gtk::Label* label = new Gtk::Label(
std::string("<a href=\"") + key.string() + "\">" + name + "</a>",
@@ -125,7 +125,7 @@ PropertiesWindow::add_property(const URI& key, const Atom& value)
// Column 1: Value
Gtk::Alignment* align = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 1.0));
Gtk::CheckButton* present = manage(new Gtk::CheckButton());
- const char* type = _app->world()->uri_map().unmap_uri(value.type());
+ const char* type = _app->world().uri_map().unmap_uri(value.type());
Gtk::Widget* val_widget = create_value_widget(key, type, value);
present->set_active();
@@ -171,14 +171,13 @@ PropertiesWindow::datatype_supported(const rdfs::URISet& types,
bool
PropertiesWindow::class_supported(const rdfs::URISet& types)
{
- World* world = _app->world();
- LilvNode* rdf_type = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDF "type");
+ World& world = _app->world();
+ LilvNode* rdf_type = lilv_new_uri(world.lilv_world(), LILV_NS_RDF "type");
for (const auto& t : types) {
- LilvNode* range = lilv_new_uri(world->lilv_world(), t.c_str());
+ LilvNode* range = lilv_new_uri(world.lilv_world(), t.c_str());
LilvNodes* instances = lilv_world_find_nodes(
- world->lilv_world(), nullptr, rdf_type, range);
+ world.lilv_world(), nullptr, rdf_type, range);
const bool has_instance = (lilv_nodes_size(instances) > 0);
@@ -205,18 +204,18 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model)
set_title(model->path() + " Properties - Ingen");
- World* world = _app->world();
+ World& world = _app->world();
LilvNode* rdf_type = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDF "type");
+ world.lilv_world(), LILV_NS_RDF "type");
LilvNode* rdfs_DataType = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDFS "Datatype");
+ world.lilv_world(), LILV_NS_RDFS "Datatype");
// Populate key combo
const URISet props = rdfs::properties(world, model);
std::map<std::string, URI> entries;
for (const auto& p : props) {
- LilvNode* prop = lilv_new_uri(world->lilv_world(), p.c_str());
+ LilvNode* prop = lilv_new_uri(world.lilv_world(), p.c_str());
const std::string label = rdfs::label(world, prop);
URISet ranges = rdfs::range(world, prop, true);
@@ -226,7 +225,7 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model)
continue;
}
- LilvNode* range = lilv_new_uri(world->lilv_world(), (*ranges.begin()).c_str());
+ LilvNode* range = lilv_new_uri(world.lilv_world(), (*ranges.begin()).c_str());
if (rdfs::is_a(world, range, rdfs_DataType)) {
// Range is a datatype, show if type or any subtype is supported
rdfs::datatypes(_app->world(), ranges, false);
@@ -274,18 +273,18 @@ PropertiesWindow::create_value_widget(const URI& key,
}
URI type(type_uri);
- ingen::World* world = _app->world();
- LilvWorld* lworld = world->lilv_world();
+ ingen::World& world = _app->world();
+ LilvWorld* lworld = world.lilv_world();
// See if type is a datatype we support
std::set<URI> types{type};
- rdfs::datatypes(_app->world(), types, false);
+ rdfs::datatypes(world, types, false);
URI widget_type("urn:nothing");
const bool supported = datatype_supported(types, &widget_type);
if (supported) {
type = widget_type;
- _value_type = _app->world()->uri_map().map_uri(type);
+ _value_type = world.uri_map().map_uri(type);
}
if (type == _app->uris().atom_Int) {
@@ -329,7 +328,7 @@ PropertiesWindow::create_value_widget(const URI& key,
return widget;
} else if (type == _app->uris().atom_URID) {
const char* str = (value.is_valid()
- ? world->uri_map().unmap_uri(value.get<int32_t>())
+ ? world.uri_map().unmap_uri(value.get<int32_t>())
: "");
LilvNode* pred = lilv_new_uri(lworld, key.c_str());
@@ -402,7 +401,7 @@ PropertiesWindow::change_property(const URI& key, const Atom& value)
}
Record& record = r->second;
- const char* type = _app->world()->uri_map().unmap_uri(value.type());
+ const char* type = _app->world().uri_map().unmap_uri(value.type());
Gtk::Widget* val_widget = create_value_widget(key, type, value);
if (val_widget) {
@@ -505,7 +504,7 @@ PropertiesWindow::key_changed()
return;
}
- LilvWorld* lworld = _app->world()->lilv_world();
+ LilvWorld* lworld = _app->world().lilv_world();
const Gtk::ListStore::Row key_row = *(_key_combo->get_active());
const Glib::ustring key_uri = key_row[_combo_columns.uri_col];
LilvNode* prop = lilv_new_uri(lworld, key_uri.c_str());
diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp
index 4ff26914..1ce3618d 100644
--- a/src/gui/RDFS.cpp
+++ b/src/gui/RDFS.cpp
@@ -28,12 +28,12 @@ namespace gui {
namespace rdfs {
std::string
-label(World* world, const LilvNode* node)
+label(World& world, const LilvNode* node)
{
LilvNode* rdfs_label = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDFS "label");
+ world.lilv_world(), LILV_NS_RDFS "label");
LilvNodes* labels = lilv_world_find_nodes(
- world->lilv_world(), node, rdfs_label, nullptr);
+ world.lilv_world(), node, rdfs_label, nullptr);
const LilvNode* first = lilv_nodes_get_first(labels);
std::string label = first ? lilv_node_as_string(first) : "";
@@ -44,12 +44,12 @@ label(World* world, const LilvNode* node)
}
std::string
-comment(World* world, const LilvNode* node)
+comment(World& world, const LilvNode* node)
{
LilvNode* rdfs_comment = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDFS "comment");
+ world.lilv_world(), LILV_NS_RDFS "comment");
LilvNodes* comments = lilv_world_find_nodes(
- world->lilv_world(), node, rdfs_comment, nullptr);
+ world.lilv_world(), node, rdfs_comment, nullptr);
const LilvNode* first = lilv_nodes_get_first(comments);
std::string comment = first ? lilv_node_as_string(first) : "";
@@ -60,19 +60,19 @@ comment(World* world, const LilvNode* node)
}
static void
-closure(World* world, const LilvNode* pred, URISet& types, bool super)
+closure(World& world, const LilvNode* pred, URISet& types, bool super)
{
unsigned added = 0;
do {
added = 0;
URISet klasses;
for (const auto& t : types) {
- LilvNode* type = lilv_new_uri(world->lilv_world(), t.c_str());
+ LilvNode* type = lilv_new_uri(world.lilv_world(), t.c_str());
LilvNodes* matches = (super)
? lilv_world_find_nodes(
- world->lilv_world(), type, pred, nullptr)
+ world.lilv_world(), type, pred, nullptr)
: lilv_world_find_nodes(
- world->lilv_world(), nullptr, pred, type);
+ world.lilv_world(), nullptr, pred, type);
LILV_FOREACH(nodes, m, matches) {
const LilvNode* klass_node = lilv_nodes_get(matches, m);
if (lilv_node_is_uri(klass_node)) {
@@ -91,10 +91,10 @@ closure(World* world, const LilvNode* pred, URISet& types, bool super)
}
void
-classes(World* world, URISet& types, bool super)
+classes(World& world, URISet& types, bool super)
{
LilvNode* rdfs_subClassOf = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDFS "subClassOf");
+ world.lilv_world(), LILV_NS_RDFS "subClassOf");
closure(world, rdfs_subClassOf, types, super);
@@ -102,10 +102,10 @@ classes(World* world, URISet& types, bool super)
}
void
-datatypes(World* world, URISet& types, bool super)
+datatypes(World& world, URISet& types, bool super)
{
LilvNode* owl_onDatatype = lilv_new_uri(
- world->lilv_world(), LILV_NS_OWL "onDatatype");
+ world.lilv_world(), LILV_NS_OWL "onDatatype");
closure(world, owl_onDatatype, types, super);
@@ -113,7 +113,7 @@ datatypes(World* world, URISet& types, bool super)
}
URISet
-types(World* world, SPtr<const client::ObjectModel> model)
+types(World& world, SPtr<const client::ObjectModel> model)
{
typedef Properties::const_iterator PropIter;
typedef std::pair<PropIter, PropIter> PropRange;
@@ -121,18 +121,18 @@ types(World* world, SPtr<const client::ObjectModel> model)
// Start with every rdf:type
URISet types;
types.insert(URI(LILV_NS_RDFS "Resource"));
- PropRange range = model->properties().equal_range(world->uris().rdf_type);
+ PropRange range = model->properties().equal_range(world.uris().rdf_type);
for (auto t = range.first; t != range.second; ++t) {
- if (t->second.type() == world->forge().URI ||
- t->second.type() == world->forge().URID) {
- const URI type(world->forge().str(t->second, false));
+ if (t->second.type() == world.forge().URI ||
+ t->second.type() == world.forge().URID) {
+ const URI type(world.forge().str(t->second, false));
types.insert(type);
- if (world->uris().ingen_Graph == type) {
+ if (world.uris().ingen_Graph == type) {
// Add lv2:Plugin as a type for graphs so plugin properties show up
- types.insert(world->uris().lv2_Plugin);
+ types.insert(world.uris().lv2_Plugin);
}
} else {
- world->log().error(fmt("<%1%> has non-URI type\n") % model->uri());
+ world.log().error(fmt("<%1%> has non-URI type\n") % model->uri());
}
}
@@ -143,25 +143,25 @@ types(World* world, SPtr<const client::ObjectModel> model)
}
URISet
-properties(World* world, SPtr<const client::ObjectModel> model)
+properties(World& world, SPtr<const client::ObjectModel> model)
{
URISet properties;
URISet types = rdfs::types(world, model);
- LilvNode* rdf_type = lilv_new_uri(world->lilv_world(),
+ LilvNode* rdf_type = lilv_new_uri(world.lilv_world(),
LILV_NS_RDF "type");
- LilvNode* rdf_Property = lilv_new_uri(world->lilv_world(),
+ LilvNode* rdf_Property = lilv_new_uri(world.lilv_world(),
LILV_NS_RDF "Property");
- LilvNode* rdfs_domain = lilv_new_uri(world->lilv_world(),
+ LilvNode* rdfs_domain = lilv_new_uri(world.lilv_world(),
LILV_NS_RDFS "domain");
LilvNodes* props = lilv_world_find_nodes(
- world->lilv_world(), nullptr, rdf_type, rdf_Property);
+ world.lilv_world(), nullptr, rdf_type, rdf_Property);
LILV_FOREACH(nodes, p, props) {
const LilvNode* prop = lilv_nodes_get(props, p);
if (lilv_node_is_uri(prop)) {
LilvNodes* domains = lilv_world_find_nodes(
- world->lilv_world(), prop, rdfs_domain, nullptr);
+ world.lilv_world(), prop, rdfs_domain, nullptr);
unsigned n_matching_domains = 0;
LILV_FOREACH(nodes, d, domains) {
const LilvNode* domain_node = lilv_nodes_get(domains, d);
@@ -194,16 +194,16 @@ properties(World* world, SPtr<const client::ObjectModel> model)
}
Objects
-instances(World* world, const URISet& types)
+instances(World& world, const URISet& types)
{
LilvNode* rdf_type = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDF "type");
+ world.lilv_world(), LILV_NS_RDF "type");
Objects result;
for (const auto& t : types) {
- LilvNode* type = lilv_new_uri(world->lilv_world(), t.c_str());
+ LilvNode* type = lilv_new_uri(world.lilv_world(), t.c_str());
LilvNodes* objects = lilv_world_find_nodes(
- world->lilv_world(), nullptr, rdf_type, type);
+ world.lilv_world(), nullptr, rdf_type, type);
LILV_FOREACH(nodes, o, objects) {
const LilvNode* object = lilv_nodes_get(objects, o);
if (!lilv_node_is_uri(object)) {
@@ -220,13 +220,13 @@ instances(World* world, const URISet& types)
}
URISet
-range(World* world, const LilvNode* prop, bool recursive)
+range(World& world, const LilvNode* prop, bool recursive)
{
LilvNode* rdfs_range = lilv_new_uri(
- world->lilv_world(), LILV_NS_RDFS "range");
+ world.lilv_world(), LILV_NS_RDFS "range");
LilvNodes* nodes = lilv_world_find_nodes(
- world->lilv_world(), prop, rdfs_range, nullptr);
+ world.lilv_world(), prop, rdfs_range, nullptr);
URISet ranges;
LILV_FOREACH(nodes, n, nodes) {
@@ -243,12 +243,12 @@ range(World* world, const LilvNode* prop, bool recursive)
}
bool
-is_a(World* world, const LilvNode* inst, const LilvNode* klass)
+is_a(World& world, const LilvNode* inst, const LilvNode* klass)
{
- LilvNode* rdf_type = lilv_new_uri(world->lilv_world(), LILV_NS_RDF "type");
+ LilvNode* rdf_type = lilv_new_uri(world.lilv_world(), LILV_NS_RDF "type");
const bool is_instance = lilv_world_ask(
- world->lilv_world(), inst, rdf_type, klass);
+ world.lilv_world(), inst, rdf_type, klass);
lilv_node_free(rdf_type);
return is_instance;
diff --git a/src/gui/RDFS.hpp b/src/gui/RDFS.hpp
index 8de9076d..ee1133f5 100644
--- a/src/gui/RDFS.hpp
+++ b/src/gui/RDFS.hpp
@@ -41,37 +41,37 @@ typedef std::set<URI> URISet;
typedef std::map<std::string, URI> Objects;
/** Return the label of `node`. */
-std::string label(World* world, const LilvNode* node);
+std::string label(World& world, const LilvNode* node);
/** Return the comment of `node`. */
-std::string comment(World* world, const LilvNode* node);
+std::string comment(World& world, const LilvNode* node);
/** Set `types` to its super/sub class closure.
* @param super If true, find all superclasses, otherwise all subclasses
*/
-void classes(World* world, URISet& types, bool super);
+void classes(World& world, URISet& types, bool super);
/** Set `types` to its super/sub datatype closure.
* @param super If true, find all supertypes, otherwise all subtypes.
*/
-void datatypes(World* world, URISet& types, bool super);
+void datatypes(World& world, URISet& types, bool super);
/** Get all instances of any class in `types`. */
-Objects instances(World* world, const URISet& types);
+Objects instances(World& world, const URISet& types);
/** Get all the types which `model` is an instance of. */
-URISet types(World* world, SPtr<const client::ObjectModel> model);
+URISet types(World& world, SPtr<const client::ObjectModel> model);
/** Get all the properties with domains appropriate for `model`. */
-URISet properties(World* world, SPtr<const client::ObjectModel> model);
+URISet properties(World& world, SPtr<const client::ObjectModel> model);
/** Return the range (value types) of `prop`.
* @param recursive If true, include all subclasses.
*/
-URISet range(World* world, const LilvNode* prop, bool recursive);
+URISet range(World& world, const LilvNode* prop, bool recursive);
/** Return true iff `inst` is-a `klass`. */
-bool is_a(World* world, const LilvNode* inst, const LilvNode* klass);
+bool is_a(World& world, const LilvNode* inst, const LilvNode* klass);
} // namespace rdfs
} // namespace gui
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index a7115de6..c9d30c31 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -54,7 +54,7 @@ ThreadedLoader::~ThreadedLoader()
SPtr<Parser>
ThreadedLoader::parser()
{
- return _app.world()->parser();
+ return _app.world().parser();
}
void
@@ -103,14 +103,14 @@ ThreadedLoader::load_graph_event(const FilePath& file_path,
optional<Raul::Symbol> engine_symbol,
optional<Properties> engine_data)
{
- std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex());
-
- _app.world()->parser()->parse_file(*_app.world(),
- *_app.world()->interface(),
- file_path,
- engine_parent,
- engine_symbol,
- engine_data);
+ std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
+
+ _app.world().parser()->parse_file(_app.world(),
+ *_app.world().interface(),
+ file_path,
+ engine_parent,
+ engine_symbol,
+ engine_data);
}
void
@@ -132,7 +132,7 @@ ThreadedLoader::save_graph_event(SPtr<const client::GraphModel> model,
{
assert(uri.scheme() == "file");
if (_app.serialiser()) {
- std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex());
+ std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
if (uri.string().find(".ingen") != std::string::npos) {
_app.serialiser()->write_bundle(model, uri);
diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp
index 97099b46..0004839f 100644
--- a/src/gui/URIEntry.cpp
+++ b/src/gui/URIEntry.cpp
@@ -42,8 +42,8 @@ URIEntry::URIEntry(App* app, std::set<URI> types, const std::string& value)
Gtk::Menu*
URIEntry::build_value_menu()
{
- World* world = _app->world();
- LilvWorld* lworld = world->lilv_world();
+ World& world = _app->world();
+ LilvWorld* lworld = world.lilv_world();
Gtk::Menu* menu = new Gtk::Menu();
LilvNode* owl_onDatatype = lilv_new_uri(lworld, LILV_NS_OWL "onDatatype");
@@ -62,8 +62,8 @@ URIEntry::build_value_menu()
label = lilv_node_as_string(inst);
}
- if (lilv_world_ask(world->lilv_world(), inst, rdf_type, rdfs_Class) ||
- lilv_world_ask(world->lilv_world(), inst, rdf_type, rdfs_Datatype)) {
+ if (lilv_world_ask(world.lilv_world(), inst, rdf_type, rdfs_Class) ||
+ lilv_world_ask(world.lilv_world(), inst, rdf_type, rdfs_Datatype)) {
// This value is a class or datatype...
if (!lilv_world_ask(lworld, inst, rdfs_subClassOf, nullptr) &&
!lilv_world_ask(lworld, inst, owl_onDatatype, nullptr)) {
@@ -93,8 +93,8 @@ URIEntry::build_value_menu()
Gtk::Menu*
URIEntry::build_subclass_menu(const LilvNode* klass)
{
- World* world = _app->world();
- LilvWorld* lworld = world->lilv_world();
+ World& world = _app->world();
+ LilvWorld* lworld = world.lilv_world();
LilvNode* owl_onDatatype = lilv_new_uri(lworld, LILV_NS_OWL "onDatatype");
LilvNode* rdfs_subClassOf = lilv_new_uri(lworld, LILV_NS_RDFS "subClassOf");
diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp
index 441993f7..4504d3fe 100644
--- a/src/gui/ingen_gui.cpp
+++ b/src/gui/ingen_gui.cpp
@@ -27,26 +27,26 @@ namespace gui {
struct GUIModule : public Module {
using SigClientInterface = client::SigClientInterface;
- void load(World* world) override {
- URI uri(world->conf().option("connect").ptr<char>());
- if (!world->interface()) {
- world->set_interface(
- world->new_interface(URI(uri), make_client(world)));
+ void load(World& world) override {
+ URI uri(world.conf().option("connect").ptr<char>());
+ if (!world.interface()) {
+ world.set_interface(
+ world.new_interface(URI(uri), make_client(world)));
} else if (!dynamic_ptr_cast<SigClientInterface>(
- world->interface()->respondee())) {
- world->interface()->set_respondee(make_client(world));
+ world.interface()->respondee())) {
+ world.interface()->set_respondee(make_client(world));
}
app = gui::App::create(world);
}
- void run(World* world) override {
+ void run(World& world) override {
app->run();
}
- SPtr<Interface> make_client(World* const world) {
+ SPtr<Interface> make_client(World& world) {
SPtr<SigClientInterface> sci(new SigClientInterface());
- return world->engine() ? sci : SPtr<Interface>(new QueuedInterface(sci));
+ return world.engine() ? sci : SPtr<Interface>(new QueuedInterface(sci));
}
SPtr<gui::App> app;
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp
index 251c75e1..f89e0436 100644
--- a/src/gui/ingen_gui_lv2.cpp
+++ b/src/gui/ingen_gui_lv2.cpp
@@ -131,7 +131,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
ui->world->set_interface(ui->engine);
// Create App and client
- ui->app = ingen::gui::App::create(ui->world);
+ ui->app = ingen::gui::App::create(*ui->world);
ui->client = SPtr<ingen::client::SigClientInterface>(
new ingen::client::SigClientInterface());
ui->app->set_is_plugin(true);
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index 0e51ff90..62dd83ba 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -128,7 +128,7 @@ main(int argc, char** argv)
}
#ifdef HAVE_SOCKET
- client::SocketClient::register_factories(world.get());
+ client::SocketClient::register_factories(*world);
#endif
// Load GUI if requested
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index de983df6..105d60cf 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -37,7 +37,7 @@ namespace server {
using namespace internals;
-BlockFactory::BlockFactory(ingen::World* world)
+BlockFactory::BlockFactory(ingen::World& world)
: _world(world)
, _has_loaded(false)
{
@@ -109,7 +109,7 @@ BlockFactory::plugin(const URI& uri)
void
BlockFactory::load_internal_plugins()
{
- ingen::URIs& uris = _world->uris();
+ ingen::URIs& uris = _world.uris();
InternalPlugin* block_delay_plug = BlockDelayNode::internal_plugin(uris);
_plugins.emplace(block_delay_plug->uri(), block_delay_plug);
@@ -133,8 +133,8 @@ BlockFactory::load_plugin(const URI& uri)
return;
}
- LilvNode* node = lilv_new_uri(_world->lilv_world(), uri.c_str());
- const LilvPlugins* plugs = lilv_world_get_all_plugins(_world->lilv_world());
+ LilvNode* node = lilv_new_uri(_world.lilv_world(), uri.c_str());
+ const LilvPlugins* plugs = lilv_world_get_all_plugins(_world.lilv_world());
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node);
if (plug) {
LV2Plugin* const ingen_plugin = new LV2Plugin(_world, plug);
@@ -154,11 +154,11 @@ BlockFactory::load_lv2_plugins()
for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) {
const URI& uri(PortType((PortType::ID)t).uri());
types.push_back(
- SPtr<LilvNode>(lilv_new_uri(_world->lilv_world(), uri.c_str()),
+ SPtr<LilvNode>(lilv_new_uri(_world.lilv_world(), uri.c_str()),
lilv_node_free));
}
- const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world());
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(_world.lilv_world());
LILV_FOREACH(plugins, i, plugins) {
const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i);
const URI uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug)));
@@ -168,9 +168,9 @@ BlockFactory::load_lv2_plugins()
bool supported = true;
LILV_FOREACH(nodes, f, features) {
const char* feature = lilv_node_as_uri(lilv_nodes_get(features, f));
- if (!_world->lv2_features().is_supported(feature)) {
+ if (!_world.lv2_features().is_supported(feature)) {
supported = false;
- _world->log().warn(
+ _world.log().warn(
fmt("Ignoring <%1%>; required feature <%2%>\n")
% uri % feature);
break;
@@ -183,7 +183,7 @@ BlockFactory::load_lv2_plugins()
// Ignore plugins that are missing ports
if (!lilv_plugin_get_port_by_index(lv2_plug, 0)) {
- _world->log().warn(
+ _world.log().warn(
fmt("Ignoring <%1%>; missing or corrupt ports\n") % uri);
continue;
}
@@ -201,8 +201,8 @@ BlockFactory::load_lv2_plugins()
if (!supported &&
!lilv_port_has_property(lv2_plug,
port,
- _world->uris().lv2_connectionOptional)) {
- _world->log().warn(
+ _world.uris().lv2_connectionOptional)) {
+ _world.log().warn(
fmt("Ignoring <%1%>; unsupported port <%2%>\n")
% uri % lilv_node_as_string(
lilv_port_get_symbol(lv2_plug, port)));
@@ -222,7 +222,7 @@ BlockFactory::load_lv2_plugins()
}
}
- _world->log().info(fmt("Loaded %1% plugins\n") % _plugins.size());
+ _world.log().info(fmt("Loaded %1% plugins\n") % _plugins.size());
}
} // namespace server
diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp
index 47309f69..80f99563 100644
--- a/src/server/BlockFactory.hpp
+++ b/src/server/BlockFactory.hpp
@@ -36,7 +36,7 @@ class PluginImpl;
class BlockFactory : public Raul::Noncopyable
{
public:
- explicit BlockFactory(ingen::World* world);
+ explicit BlockFactory(ingen::World& world);
~BlockFactory();
/** Reload plugin list.
@@ -57,7 +57,7 @@ private:
void load_internal_plugins();
Plugins _plugins;
- ingen::World* _world;
+ ingen::World& _world;
bool _has_loaded;
};
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index c9eeed49..d9847e3a 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -49,7 +49,7 @@ BufferFactory::~BufferFactory()
Forge&
BufferFactory::forge()
{
- return _engine.world()->forge();
+ return _engine.world().forge();
}
Raul::Maid&
@@ -146,7 +146,7 @@ BufferFactory::claim_buffer(LV2_URID type,
{
Buffer* try_head = try_get_buffer(type);
if (!try_head) {
- _engine.world()->log().rt_error("Failed to obtain buffer");
+ _engine.world().log().rt_error("Failed to obtain buffer");
return BufferRef();
}
diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp
index 67752340..073b234e 100644
--- a/src/server/CompiledGraph.cpp
+++ b/src/server/CompiledGraph.cpp
@@ -144,7 +144,7 @@ CompiledGraph::compile_graph(GraphImpl* graph)
_master = Task::simplify(std::move(_master));
- if (graph->engine().world()->conf().option("trace").get<int32_t>()) {
+ if (graph->engine().world().conf().option("trace").get<int32_t>()) {
ColorContext ctx(stderr, ColorContext::Color::YELLOW);
dump(graph->path());
}
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 94a12a7e..4a38715a 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -38,12 +38,12 @@ ControlBindings::ControlBindings(Engine& engine)
, _learn_binding(nullptr)
, _bindings(new Bindings())
, _feedback(new Buffer(*_engine.buffer_factory(),
- engine.world()->uris().atom_Sequence,
+ engine.world().uris().atom_Sequence,
0,
4096)) // FIXME: capacity?
{
lv2_atom_forge_init(
- &_forge, &engine.world()->uri_map().urid_map_feature()->urid_map);
+ &_forge, &engine.world().uri_map().urid_map_feature()->urid_map);
}
ControlBindings::~ControlBindings()
@@ -56,7 +56,7 @@ ControlBindings::Key
ControlBindings::port_binding(PortImpl* port) const
{
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
const Atom& binding = port->get_property(uris.midi_binding);
return binding_key(binding);
}
@@ -64,7 +64,7 @@ ControlBindings::port_binding(PortImpl* port) const
ControlBindings::Key
ControlBindings::binding_key(const Atom& binding) const
{
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
Key key;
LV2_Atom* num = nullptr;
if (binding.type() == uris.atom_Object) {
@@ -151,8 +151,7 @@ ControlBindings::port_value_changed(RunContext& ctx,
Key key,
const Atom& value_atom)
{
- ingen::World* world = ctx.engine().world();
- const ingen::URIs& uris = world->uris();
+ const ingen::URIs& uris = ctx.engine().world().uris();
if (!!key) {
int16_t value = port_value_to_control(
ctx, port, key.type, value_atom);
@@ -336,7 +335,7 @@ ControlBindings::set_port_value(RunContext& context,
// TODO: Set port value property so it is saved
port->set_control_value(context, context.start(), val);
- URIs& uris = context.engine().world()->uris();
+ URIs& uris = context.engine().world().uris();
context.notify(uris.ingen_value, context.start(), port,
sizeof(float), _forge.Float, &val);
}
@@ -344,7 +343,7 @@ ControlBindings::set_port_value(RunContext& context,
bool
ControlBindings::finish_learn(RunContext& context, Key key)
{
- const ingen::URIs& uris = context.engine().world()->uris();
+ const ingen::URIs& uris = context.engine().world().uris();
Binding* binding = _learn_binding.exchange(nullptr);
if (!binding || (key.type == Type::MIDI_NOTE && !binding->port->is_toggled())) {
return false;
@@ -390,8 +389,7 @@ void
ControlBindings::pre_process(RunContext& ctx, Buffer* buffer)
{
uint16_t value = 0;
- ingen::World* world = ctx.engine().world();
- const ingen::URIs& uris = world->uris();
+ const ingen::URIs& uris = ctx.engine().world().uris();
_feedback->clear();
if ((!_learn_binding && _bindings->empty()) || !buffer->get<LV2_Atom>()) {
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index b880abf7..5b132623 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -64,64 +64,64 @@ namespace server {
INGEN_THREAD_LOCAL unsigned ThreadManager::flags(0);
bool ThreadManager::single_threaded(true);
-Engine::Engine(ingen::World* world)
+Engine::Engine(ingen::World& world)
: _world(world)
- , _options(new LV2Options(world->uris()))
- , _buffer_factory(new BufferFactory(*this, world->uris()))
+ , _options(new LV2Options(world.uris()))
+ , _buffer_factory(new BufferFactory(*this, world.uris()))
, _maid(new Raul::Maid)
- , _worker(new Worker(world->log(), event_queue_size()))
- , _sync_worker(new Worker(world->log(), event_queue_size(), true))
+ , _worker(new Worker(world.log(), event_queue_size()))
+ , _sync_worker(new Worker(world.log(), event_queue_size(), true))
, _broadcaster(new Broadcaster())
, _control_bindings(new ControlBindings(*this))
, _block_factory(new BlockFactory(world))
- , _undo_stack(new UndoStack(_world->uris(), _world->uri_map()))
- , _redo_stack(new UndoStack(_world->uris(), _world->uri_map()))
+ , _undo_stack(new UndoStack(world.uris(), world.uri_map()))
+ , _redo_stack(new UndoStack(world.uris(), world.uri_map()))
, _post_processor(new PostProcessor(*this))
, _pre_processor(new PreProcessor(*this))
, _event_writer(new EventWriter(*this))
, _interface(_event_writer)
, _atom_interface(
- new AtomReader(world->uri_map(), world->uris(), world->log(), *_interface))
+ new AtomReader(world.uri_map(), world.uris(), world.log(), *_interface))
, _root_graph(nullptr)
, _cycle_start_time(0)
, _rand_engine(0)
, _uniform_dist(0.0f, 1.0f)
, _quit_flag(false)
, _reset_load_flag(false)
- , _atomic_bundles(world->conf().option("atomic-bundles").get<int32_t>())
+ , _atomic_bundles(world.conf().option("atomic-bundles").get<int32_t>())
, _activated(false)
{
- if (!world->store()) {
- world->set_store(SPtr<ingen::Store>(new Store()));
+ if (!world.store()) {
+ world.set_store(SPtr<ingen::Store>(new Store()));
}
- for (int i = 0; i < world->conf().option("threads").get<int32_t>(); ++i) {
+ for (int i = 0; i < world.conf().option("threads").get<int32_t>(); ++i) {
Raul::RingBuffer* ring = new Raul::RingBuffer(24 * event_queue_size());
_notifications.push_back(ring);
_run_contexts.push_back(new RunContext(*this, ring, i, i > 0));
}
- _world->lv2_features().add_feature(_worker->schedule_feature());
- _world->lv2_features().add_feature(_options);
- _world->lv2_features().add_feature(
+ _world.lv2_features().add_feature(_worker->schedule_feature());
+ _world.lv2_features().add_feature(_options);
+ _world.lv2_features().add_feature(
SPtr<LV2Features::Feature>(
new LV2Features::EmptyFeature(LV2_BUF_SIZE__powerOf2BlockLength)));
- _world->lv2_features().add_feature(
+ _world.lv2_features().add_feature(
SPtr<LV2Features::Feature>(
new LV2Features::EmptyFeature(LV2_BUF_SIZE__fixedBlockLength)));
- _world->lv2_features().add_feature(
+ _world.lv2_features().add_feature(
SPtr<LV2Features::Feature>(
new LV2Features::EmptyFeature(LV2_BUF_SIZE__boundedBlockLength)));
- _world->lv2_features().add_feature(
+ _world.lv2_features().add_feature(
SPtr<LV2Features::Feature>(
new LV2Features::EmptyFeature(LV2_STATE__loadDefaultState)));
- if (world->conf().option("dump").get<int32_t>()) {
+ if (world.conf().option("dump").get<int32_t>()) {
_interface = std::make_shared<Tee>(
Tee::Sinks{
_event_writer,
- std::make_shared<StreamWriter>(world->uri_map(),
- world->uris(),
+ std::make_shared<StreamWriter>(world.uri_map(),
+ world.uris(),
URI("ingen:/engine"),
stderr,
ColorContext::Color::MAGENTA)});
@@ -167,7 +167,7 @@ Engine::~Engine()
store->clear();
}
- _world->set_store(SPtr<ingen::Store>());
+ _world.set_store(SPtr<ingen::Store>());
}
void
@@ -274,7 +274,7 @@ Engine::steal_task(unsigned start_thread)
SPtr<Store>
Engine::store() const
{
- return _world->store();
+ return _world.store();
}
SampleRate
@@ -298,7 +298,7 @@ Engine::sequence_size() const
size_t
Engine::event_queue_size() const
{
- return world()->conf().option("queue-size").get<int32_t>();
+ return _world.conf().option("queue-size").get<int32_t>();
}
void
@@ -310,7 +310,7 @@ Engine::quit()
Properties
Engine::load_properties() const
{
- const ingen::URIs& uris = world()->uris();
+ const ingen::URIs& uris = _world.uris();
return { { uris.ingen_meanRunLoad,
uris.forge.make(floorf(_run_load.mean) / 100.0f) },
@@ -346,7 +346,7 @@ Engine::set_driver(SPtr<Driver> driver)
_buffer_factory->set_block_length(driver->block_length());
_options->set(sample_rate(),
block_length(),
- buffer_factory()->default_size(_world->uris().atom_Sequence));
+ buffer_factory()->default_size(_world.uris().atom_Sequence));
}
SampleCount
@@ -392,14 +392,14 @@ Engine::activate()
ThreadManager::single_threaded = true;
- const ingen::URIs& uris = world()->uris();
+ const ingen::URIs& uris = _world.uris();
if (!_root_graph) {
// No root graph has been loaded, create an empty one
const Properties properties = {
{uris.rdf_type, uris.ingen_Graph},
{uris.ingen_polyphony,
- Property(_world->forge().make(1),
+ Property(_world.forge().make(1),
Resource::Graph::INTERNAL)}};
enqueue_event(
@@ -505,7 +505,7 @@ Engine::process_all_events()
Log&
Engine::log() const
{
- return _world->log();
+ return _world.log();
}
void
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index 02da0719..a86397ea 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -74,7 +74,7 @@ class Worker;
class INGEN_API Engine : public EngineBase
{
public:
- explicit Engine(ingen::World* world);
+ explicit Engine(ingen::World& world);
virtual ~Engine();
Engine(const Engine&) = delete;
@@ -129,7 +129,7 @@ public:
/** Process all events (no RT limits). */
unsigned process_all_events();
- ingen::World* world() const { return _world; }
+ ingen::World& world() const { return _world; }
Log& log() const;
const SPtr<Interface>& interface() const { return _interface; }
@@ -176,7 +176,7 @@ public:
Properties load_properties() const;
private:
- ingen::World* _world;
+ ingen::World& _world;
SPtr<LV2Options> _options;
UPtr<BufferFactory> _buffer_factory;
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index ae9b8f6e..d2d49119 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -41,8 +41,8 @@ GraphImpl::GraphImpl(Engine& engine,
GraphImpl* parent,
SampleRate srate,
uint32_t internal_poly)
- : BlockImpl(new GraphPlugin(engine.world()->uris(),
- engine.world()->uris().ingen_Graph,
+ : BlockImpl(new GraphPlugin(engine.world().uris(),
+ engine.world().uris().ingen_Graph,
Raul::Symbol("graph"),
"Ingen Graph"),
symbol, poly, parent, srate)
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index a331811e..35406ec4 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -65,9 +65,9 @@ JackDriver::JackDriver(Engine& engine)
, _old_frame(0)
, _old_rolling(false)
{
- _midi_event_type = _engine.world()->uris().midi_MidiEvent;
+ _midi_event_type = _engine.world().uris().midi_MidiEvent;
lv2_atom_forge_init(
- &_forge, &engine.world()->uri_map().urid_map_feature()->urid_map);
+ &_forge, &engine.world().uri_map().urid_map_feature()->urid_map);
}
JackDriver::~JackDriver()
@@ -84,7 +84,7 @@ JackDriver::attach(const std::string& server_name,
assert(!_client);
if (!jack_client) {
#ifdef INGEN_JACK_SESSION
- const std::string uuid = _engine.world()->jack_uuid();
+ const std::string uuid = _engine.world().jack_uuid();
if (!uuid.empty()) {
_client = jack_client_open(client_name.c_str(),
JackSessionID, nullptr,
@@ -147,7 +147,7 @@ JackDriver::attach(const std::string& server_name,
bool
JackDriver::activate()
{
- World* world = _engine.world();
+ World& world = _engine.world();
if (_is_activated) {
_engine.log().warn("Jack driver already activated\n");
@@ -155,8 +155,8 @@ JackDriver::activate()
}
if (!_client) {
- attach(world->conf().option("jack-server").ptr<char>(),
- world->conf().option("jack-name").ptr<char>(), nullptr);
+ attach(world.conf().option("jack-server").ptr<char>(),
+ world.conf().option("jack-name").ptr<char>(), nullptr);
}
if (!_client) {
@@ -172,7 +172,7 @@ JackDriver::activate()
return false;
} else {
_engine.log().info(fmt("Activated Jack client `%1%'\n") %
- world->conf().option("jack-name").ptr<char>());
+ world.conf().option("jack-name").ptr<char>());
}
return true;
}
@@ -306,15 +306,15 @@ JackDriver::port_property_internal(const jack_port_t* jport,
const Atom& value)
{
#ifdef HAVE_JACK_METADATA
- if (uri == _engine.world()->uris().lv2_name) {
+ if (uri == _engine.world().uris().lv2_name) {
jack_set_property(_client, jack_port_uuid(jport),
JACK_METADATA_PRETTY_NAME, value.ptr<char>(), "text/plain");
- } else if (uri == _engine.world()->uris().lv2_index) {
+ } else if (uri == _engine.world().uris().lv2_index) {
jack_set_property(_client, jack_port_uuid(jport),
JACKEY_ORDER, std::to_string(value.get<int32_t>()).c_str(),
"http://www.w3.org/2001/XMLSchema#integer");
- } else if (uri == _engine.world()->uris().rdf_type) {
- if (value == _engine.world()->uris().lv2_CVPort) {
+ } else if (uri == _engine.world().uris().rdf_type) {
+ if (value == _engine.world().uris().lv2_CVPort) {
jack_set_property(_client, jack_port_uuid(jport),
JACKEY_SIGNAL_TYPE, "CV", "text/plain");
}
@@ -331,7 +331,7 @@ JackDriver::create_port(DuplexPort* graph_port)
eport = new EnginePort(graph_port);
graph_port->set_is_driver_port(*_engine.buffer_factory());
} else if (graph_port->is_a(PortType::ATOM) &&
- graph_port->buffer_type() == _engine.world()->uris().atom_Sequence) {
+ graph_port->buffer_type() == _engine.world().uris().atom_Sequence) {
// Sequence port, make Jack port but use internal LV2 format buffer
eport = new EnginePort(graph_port);
}
@@ -346,7 +346,7 @@ JackDriver::create_port(DuplexPort* graph_port)
void
JackDriver::pre_process_port(RunContext& context, EnginePort* port)
{
- const URIs& uris = context.engine().world()->uris();
+ const URIs& uris = context.engine().world().uris();
const SampleCount nframes = context.nframes();
jack_port_t* jack_port = (jack_port_t*)port->handle();
DuplexPort* graph_port = port->graph_port();
@@ -381,7 +381,7 @@ JackDriver::pre_process_port(RunContext& context, EnginePort* port)
void
JackDriver::post_process_port(RunContext& context, EnginePort* port)
{
- const URIs& uris = context.engine().world()->uris();
+ const URIs& uris = context.engine().world().uris();
const SampleCount nframes = context.nframes();
jack_port_t* jack_port = (jack_port_t*)port->handle();
DuplexPort* graph_port = port->graph_port();
@@ -420,7 +420,7 @@ void
JackDriver::append_time_events(RunContext& context,
Buffer& buffer)
{
- const URIs& uris = context.engine().world()->uris();
+ const URIs& uris = context.engine().world().uris();
const jack_position_t* pos = &_position;
const bool rolling = (_transport_state == JackTransportRolling);
@@ -552,9 +552,9 @@ JackDriver::_session_cb(jack_session_event_t* event)
% jack_get_client_name(_client)
% event->client_uuid).str();
- SPtr<Serialiser> serialiser = _engine.world()->serialiser();
+ SPtr<Serialiser> serialiser = _engine.world().serialiser();
if (serialiser) {
- std::lock_guard<std::mutex> lock(_engine.world()->rdf_mutex());
+ std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
SPtr<Node> root(_engine.root_graph(), NullDeleter<Node>);
serialiser->write_bundle(root,
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index c2b8e973..bf6cbd60 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -218,13 +218,13 @@ bool
LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
{
const ingen::URIs& uris = bufs.uris();
- ingen::World* world = bufs.engine().world();
+ ingen::World& world = bufs.engine().world();
const LilvPlugin* plug = _lv2_plugin->lilv_plugin();
ingen::Forge& forge = bufs.forge();
const uint32_t num_ports = lilv_plugin_get_num_ports(plug);
LilvNode* lv2_connectionOptional = lilv_new_uri(
- bufs.engine().world()->lilv_world(), LV2_CORE__connectionOptional);
+ world.lilv_world(), LV2_CORE__connectionOptional);
_ports = bufs.maid().make_managed<BlockImpl::Ports>(num_ports, nullptr);
@@ -291,7 +291,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
LILV_FOREACH(nodes, i, types) {
const LilvNode* type = lilv_nodes_get(types, i);
if (lilv_node_is_uri(type)) {
- buffer_type = bufs.engine().world()->uri_map().map_uri(
+ buffer_type = world.uri_map().map_uri(
lilv_node_as_uri(type));
}
}
@@ -322,8 +322,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
port_buffer_size = std::max(port_buffer_size, str_val_len);
} else if (lilv_node_is_uri(d)) {
const char* uri_val = lilv_node_as_uri(d);
- val = forge.make_urid(
- bufs.engine().world()->uri_map().map_uri(uri_val));
+ val = forge.make_urid(world.uri_map().map_uri(uri_val));
}
}
lilv_nodes_free(defaults);
@@ -420,7 +419,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
return ret;
}
- _features = world->lv2_features().lv2_features(world, this);
+ _features = world.lv2_features().lv2_features(world, this);
// Actually create plugin instances and port buffers.
const SampleRate rate = bufs.engine().sample_rate();
@@ -461,12 +460,12 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
bool
LV2Block::save_state(const FilePath& dir) const
{
- World* world = _lv2_plugin->world();
- LilvWorld* lworld = world->lilv_world();
+ World& world = _lv2_plugin->world();
+ LilvWorld* lworld = world.lilv_world();
LilvState* state = lilv_state_new_from_instance(
_lv2_plugin->lilv_plugin(), const_cast<LV2Block*>(this)->instance(0),
- &world->uri_map().urid_map_feature()->urid_map,
+ &world.uri_map().urid_map_feature()->urid_map,
nullptr, dir.c_str(), dir.c_str(), dir.c_str(), nullptr, nullptr,
LV2_STATE_IS_POD|LV2_STATE_IS_PORTABLE, nullptr);
@@ -478,8 +477,8 @@ LV2Block::save_state(const FilePath& dir) const
}
lilv_state_save(lworld,
- &world->uri_map().urid_map_feature()->urid_map,
- &world->uri_map().urid_unmap_feature()->urid_unmap,
+ &world.uri_map().urid_map_feature()->urid_map,
+ &world.uri_map().urid_unmap_feature()->urid_unmap,
state,
nullptr,
dir.c_str(),
@@ -500,7 +499,7 @@ LV2Block::duplicate(Engine& engine,
// Get current state
LilvState* state = lilv_state_new_from_instance(
_lv2_plugin->lilv_plugin(), instance(0),
- &engine.world()->uri_map().urid_map_feature()->urid_map,
+ &engine.world().uri_map().urid_map_feature()->urid_map,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, LV2_STATE_IS_NATIVE, nullptr);
// Duplicate and instantiate block
@@ -606,15 +605,15 @@ LV2Block::post_process(RunContext& context)
LilvState*
LV2Block::load_preset(const URI& uri)
{
- World* world = _lv2_plugin->world();
- LilvWorld* lworld = world->lilv_world();
+ World& world = _lv2_plugin->world();
+ LilvWorld* lworld = world.lilv_world();
LilvNode* preset = lilv_new_uri(lworld, uri.c_str());
// Load preset into world if necessary
lilv_world_load_resource(lworld, preset);
// Load preset from world
- LV2_URID_Map* map = &world->uri_map().urid_map_feature()->urid_map;
+ LV2_URID_Map* map = &world.uri_map().urid_map_feature()->urid_map;
LilvState* state = lilv_state_new_from_world(lworld, map, preset);
lilv_node_free(preset);
@@ -622,15 +621,15 @@ LV2Block::load_preset(const URI& uri)
}
LilvState*
-LV2Block::load_state(World* world, const FilePath& path)
+LV2Block::load_state(World& world, const FilePath& path)
{
- LilvWorld* lworld = world->lilv_world();
+ LilvWorld* lworld = world.lilv_world();
const URI uri = URI(path);
LilvNode* subject = lilv_new_uri(lworld, uri.c_str());
LilvState* state = lilv_state_new_from_file(
lworld,
- &world->uri_map().urid_map_feature()->urid_map,
+ &world.uri_map().urid_map_feature()->urid_map,
subject,
path.c_str());
@@ -641,7 +640,7 @@ LV2Block::load_state(World* world, const FilePath& path)
void
LV2Block::apply_state(const UPtr<Worker>& worker, const LilvState* state)
{
- World* world = parent_graph()->engine().world();
+ World& world = parent_graph()->engine().world();
SPtr<LV2_Feature> sched;
if (worker) {
sched = worker->schedule_feature()->feature(world, this);
@@ -679,10 +678,10 @@ boost::optional<Resource>
LV2Block::save_preset(const URI& uri,
const Properties& props)
{
- World* world = parent_graph()->engine().world();
- LilvWorld* lworld = _lv2_plugin->world()->lilv_world();
- LV2_URID_Map* lmap = &world->uri_map().urid_map_feature()->urid_map;
- LV2_URID_Unmap* lunmap = &world->uri_map().urid_unmap_feature()->urid_unmap;
+ World& world = parent_graph()->engine().world();
+ LilvWorld* lworld = world.lilv_world();
+ LV2_URID_Map* lmap = &world.uri_map().urid_map_feature()->urid_map;
+ LV2_URID_Unmap* lunmap = &world.uri_map().urid_unmap_feature()->urid_unmap;
const FilePath path = FilePath(uri.path());
const FilePath dirname = path.parent_path();
@@ -710,9 +709,9 @@ LV2Block::save_preset(const URI& uri,
Resource preset(_uris, uri);
preset.set_property(_uris.rdf_type, _uris.pset_Preset);
- preset.set_property(_uris.rdfs_label, world->forge().alloc(label));
+ preset.set_property(_uris.rdfs_label, world.forge().alloc(label));
preset.set_property(_uris.lv2_appliesTo,
- world->forge().make_urid(_lv2_plugin->uri()));
+ world.forge().make_urid(_lv2_plugin->uri()));
const std::string bundle_uri = URI(dirname).string() + '/';
LilvNode* lbundle = lilv_new_uri(lworld, bundle_uri.c_str());
diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp
index 8a362fec..912d84b1 100644
--- a/src/server/LV2Block.hpp
+++ b/src/server/LV2Block.hpp
@@ -80,7 +80,7 @@ public:
BufferRef buf,
SampleCount offset) override;
- static LilvState* load_state(World* world, const FilePath& path);
+ static LilvState* load_state(World& world, const FilePath& path);
protected:
struct Instance : public Raul::Noncopyable {
diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp
index 7a8b3c20..fbe46eee 100644
--- a/src/server/LV2Options.hpp
+++ b/src/server/LV2Options.hpp
@@ -38,7 +38,7 @@ public:
const char* uri() const override { return LV2_OPTIONS__options; }
- SPtr<LV2_Feature> feature(World* w, Node* n) override {
+ SPtr<LV2_Feature> feature(World& w, Node* n) override {
const LV2_Options_Option options[] = {
{ LV2_OPTIONS_INSTANCE, 0, _uris.bufsz_minBlockLength,
sizeof(int32_t), _uris.atom_Int, &_block_length },
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 4b97e9f1..7012c8fd 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -29,9 +29,9 @@
namespace ingen {
namespace server {
-LV2Plugin::LV2Plugin(World* world, const LilvPlugin* lplugin)
- : PluginImpl(world->uris(),
- world->uris().lv2_Plugin.urid,
+LV2Plugin::LV2Plugin(World& world, const LilvPlugin* lplugin)
+ : PluginImpl(world.uris(),
+ world.uris().lv2_Plugin.urid,
URI(lilv_node_as_uri(lilv_plugin_get_uri(lplugin))))
, _world(world)
, _lilv_plugin(lplugin)
@@ -44,20 +44,20 @@ LV2Plugin::LV2Plugin(World* world, const LilvPlugin* lplugin)
void
LV2Plugin::update_properties()
{
- LilvNode* minor = lilv_world_get(_world->lilv_world(),
+ LilvNode* minor = lilv_world_get(_world.lilv_world(),
lilv_plugin_get_uri(_lilv_plugin),
_uris.lv2_minorVersion,
nullptr);
- LilvNode* micro = lilv_world_get(_world->lilv_world(),
+ LilvNode* micro = lilv_world_get(_world.lilv_world(),
lilv_plugin_get_uri(_lilv_plugin),
_uris.lv2_microVersion,
nullptr);
if (lilv_node_is_int(minor) && lilv_node_is_int(micro)) {
set_property(_uris.lv2_minorVersion,
- _world->forge().make(lilv_node_as_int(minor)));
+ _world.forge().make(lilv_node_as_int(minor)));
set_property(_uris.lv2_microVersion,
- _world->forge().make(lilv_node_as_int(micro)));
+ _world.forge().make(lilv_node_as_int(micro)));
}
lilv_node_free(minor);
@@ -108,8 +108,8 @@ LV2Plugin::instantiate(BufferFactory& bufs,
void
LV2Plugin::load_presets()
{
- const URIs& uris = _world->uris();
- LilvWorld* lworld = _world->lilv_world();
+ const URIs& uris = _world.uris();
+ LilvWorld* lworld = _world.lilv_world();
LilvNodes* presets = lilv_plugin_get_related(_lilv_plugin, uris.pset_Preset);
if (presets) {
@@ -127,7 +127,7 @@ LV2Plugin::load_presets()
lilv_nodes_free(labels);
} else {
- _world->log().error(
+ _world.log().error(
fmt("Preset <%1%> has no rdfs:label\n")
% lilv_node_as_string(lilv_nodes_get(presets, i)));
}
diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp
index 9d342f54..da4ce23c 100644
--- a/src/server/LV2Plugin.hpp
+++ b/src/server/LV2Plugin.hpp
@@ -38,7 +38,7 @@ class BlockImpl;
class LV2Plugin : public PluginImpl
{
public:
- LV2Plugin(World* world, const LilvPlugin* lplugin);
+ LV2Plugin(World& world, const LilvPlugin* lplugin);
BlockImpl* instantiate(BufferFactory& bufs,
const Raul::Symbol& symbol,
@@ -49,7 +49,7 @@ public:
const Raul::Symbol symbol() const override;
- World* world() const { return _world; }
+ World& world() const { return _world; }
const LilvPlugin* lilv_plugin() const { return _lilv_plugin; }
void update_properties() override;
@@ -62,7 +62,7 @@ public:
}
private:
- World* _world;
+ World& _world;
const LilvPlugin* _lilv_plugin;
};
diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp
index 4d7dd1f8..24ac7cd4 100644
--- a/src/server/LV2ResizeFeature.hpp
+++ b/src/server/LV2ResizeFeature.hpp
@@ -44,7 +44,7 @@ struct ResizeFeature : public ingen::LV2Features::Feature {
const char* uri() const { return LV2_RESIZE_PORT_URI; }
- SPtr<LV2_Feature> feature(World* w, Node* n) {
+ SPtr<LV2_Feature> feature(World& w, Node* n) {
BlockImpl* block = dynamic_cast<BlockImpl*>(n);
if (!block)
return SPtr<LV2_Feature>();
diff --git a/src/server/PortAudioDriver.cpp b/src/server/PortAudioDriver.cpp
index f67a62bb..2bc230a4 100644
--- a/src/server/PortAudioDriver.cpp
+++ b/src/server/PortAudioDriver.cpp
@@ -54,7 +54,7 @@ PortAudioDriver::PortAudioDriver(Engine& engine)
, _sem(0)
, _stream(nullptr)
, _seq_size(4096)
- , _block_length(engine.world()->conf().option("buffer-size").get<int32_t>())
+ , _block_length(engine.world().conf().option("buffer-size").get<int32_t>())
, _sample_rate(48000)
, _n_inputs(0)
, _n_outputs(0)
@@ -218,7 +218,7 @@ PortAudioDriver::create_port(DuplexPort* graph_port)
eport = new EnginePort(graph_port);
graph_port->set_is_driver_port(*_engine.buffer_factory());
} else if (graph_port->is_a(PortType::ATOM) &&
- graph_port->buffer_type() == _engine.world()->uris().atom_Sequence) {
+ graph_port->buffer_type() == _engine.world().uris().atom_Sequence) {
// Sequence port, make Jack port but use internal LV2 format buffer
eport = new EnginePort(graph_port);
}
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index f03939d3..00676a8a 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -129,14 +129,14 @@ void
PortImpl::set_type(PortType port_type, LV2_URID buffer_type)
{
const ingen::URIs& uris = _bufs.uris();
- ingen::World* world = _bufs.engine().world();
+ ingen::World& world = _bufs.engine().world();
// Update type properties so clients are aware of current type
remove_property(uris.rdf_type, uris.lv2_AudioPort);
remove_property(uris.rdf_type, uris.lv2_CVPort);
remove_property(uris.rdf_type, uris.lv2_ControlPort);
remove_property(uris.rdf_type, uris.atom_AtomPort);
- add_property(uris.rdf_type, world->forge().make_urid(port_type.uri()));
+ add_property(uris.rdf_type, world.forge().make_urid(port_type.uri()));
// Update audio thread types
_type = port_type;
@@ -450,8 +450,8 @@ PortImpl::monitor(RunContext& context, bool send_now)
return;
}
- Forge& forge = context.engine().world()->forge();
- URIs& uris = context.engine().world()->uris();
+ Forge& forge = context.engine().world().forge();
+ URIs& uris = context.engine().world().uris();
LV2_URID key = 0;
float val = 0.0f;
switch (_type.id()) {
diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp
index dbe7ddbe..55f5de8e 100644
--- a/src/server/PreProcessor.cpp
+++ b/src/server/PreProcessor.cpp
@@ -141,7 +141,7 @@ PreProcessor::process(RunContext& context, PostProcessor& dest, size_t limit)
if (n_processed > 0) {
#ifndef NDEBUG
Engine& engine = context.engine();
- if (engine.world()->conf().option("trace").get<int32_t>()) {
+ if (engine.world().conf().option("trace").get<int32_t>()) {
const uint64_t start = engine.cycle_start_time(context);
const uint64_t end = engine.current_time();
fprintf(stderr, "Processed %zu events in %u us\n",
@@ -172,9 +172,9 @@ PreProcessor::run()
UndoStack& undo_stack = *_engine.undo_stack();
UndoStack& redo_stack = *_engine.redo_stack();
AtomWriter undo_writer(
- _engine.world()->uri_map(), _engine.world()->uris(), undo_stack);
+ _engine.world().uri_map(), _engine.world().uris(), undo_stack);
AtomWriter redo_writer(
- _engine.world()->uri_map(), _engine.world()->uris(), redo_stack);
+ _engine.world().uri_map(), _engine.world().uris(), redo_stack);
ThreadManager::set_flag(THREAD_PRE_PROCESS);
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index ee272d46..64ea24f9 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -114,11 +114,11 @@ RunContext::emit_notifications(FrameTime end)
return;
}
if (_event_sink->read(sizeof(note), &note) == sizeof(note)) {
- Atom value = _engine.world()->forge().alloc(
+ Atom value = _engine.world().forge().alloc(
note.size, note.type, nullptr);
if (_event_sink->read(note.size, value.get_body()) == note.size) {
i += note.size;
- const char* key = _engine.world()->uri_map().unmap_uri(note.key);
+ const char* key = _engine.world().uri_map().unmap_uri(note.key);
if (key) {
_engine.broadcaster()->set_property(
note.port->uri(), URI(key), value);
diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp
index 9a0ce346..bd25d351 100644
--- a/src/server/SocketListener.cpp
+++ b/src/server/SocketListener.cpp
@@ -82,16 +82,16 @@ SocketListener::~SocketListener() {
static void
ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
{
- ingen::World* world = engine->world();
+ ingen::World& world = engine->world();
- const std::string link_path(world->conf().option("socket").ptr<char>());
+ const std::string link_path(world.conf().option("socket").ptr<char>());
const std::string unix_path(link_path + "." + std::to_string(getpid()));
// Bind UNIX socket and create PID-less symbolic link
const URI unix_uri(unix_scheme + unix_path);
bool make_link = true;
if (!unix_sock->bind(unix_uri) || !unix_sock->listen()) {
- world->log().error("Failed to create UNIX socket\n");
+ world.log().error("Failed to create UNIX socket\n");
unix_sock->close();
make_link = false;
} else {
@@ -101,37 +101,37 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
const pid_t pid = std::stoi(suffix);
if (!kill(pid, 0)) {
make_link = false;
- world->log().warn(fmt("Another Ingen instance is running at %1% => %2%\n")
- % link_path % old_path);
+ world.log().warn(fmt("Another Ingen instance is running at %1% => %2%\n")
+ % link_path % old_path);
} else {
- world->log().warn(fmt("Replacing old link %1% => %2%\n")
- % link_path % old_path);
+ world.log().warn(fmt("Replacing old link %1% => %2%\n")
+ % link_path % old_path);
unlink(link_path.c_str());
}
}
if (make_link) {
if (!symlink(unix_path.c_str(), link_path.c_str())) {
- world->log().info(fmt("Listening on %1%\n") %
- (unix_scheme + link_path));
+ world.log().info(fmt("Listening on %1%\n") %
+ (unix_scheme + link_path));
} else {
- world->log().error(fmt("Failed to link %1% => %2% (%3%)\n")
- % link_path % unix_path % strerror(errno));
+ world.log().error(fmt("Failed to link %1% => %2% (%3%)\n")
+ % link_path % unix_path % strerror(errno));
}
} else {
- world->log().info(fmt("Listening on %1%\n") % unix_uri);
+ world.log().info(fmt("Listening on %1%\n") % unix_uri);
}
}
// Bind TCP socket
- const int port = world->conf().option("engine-port").get<int32_t>();
+ const int port = world.conf().option("engine-port").get<int32_t>();
std::ostringstream ss;
ss << "tcp://*:" << port;
if (!net_sock->bind(URI(ss.str())) || !net_sock->listen()) {
- world->log().error("Failed to create TCP socket\n");
+ world.log().error("Failed to create TCP socket\n");
net_sock->close();
} else {
- world->log().info(fmt("Listening on TCP port %1%\n") % port);
+ world.log().info(fmt("Listening on TCP port %1%\n") % port);
}
if (unix_sock->fd() == -1 && net_sock->fd() == -1) {
@@ -157,10 +157,10 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
// Wait for input to arrive at a socket
const int ret = poll(pfds, nfds, -1);
if (ret == -1) {
- world->log().error(fmt("Poll error: %1%\n") % strerror(errno));
+ world.log().error(fmt("Poll error: %1%\n") % strerror(errno));
break;
} else if (ret == 0) {
- world->log().warn("Poll returned with no data\n");
+ world.log().warn("Poll returned with no data\n");
continue;
} else if ((pfds[0].revents & POLLHUP) || pfds[1].revents & POLLHUP) {
break;
@@ -169,14 +169,14 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock)
if (pfds[0].revents & POLLIN) {
SPtr<Raul::Socket> conn = unix_sock->accept();
if (conn) {
- new SocketServer(*world, *engine, conn);
+ new SocketServer(world, *engine, conn);
}
}
if (pfds[1].revents & POLLIN) {
SPtr<Raul::Socket> conn = net_sock->accept();
if (conn) {
- new SocketServer(*world, *engine, conn);
+ new SocketServer(world, *engine, conn);
}
}
}
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 59ef306f..368455e2 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -86,7 +86,7 @@ Worker::request(LV2Block* block,
}
SPtr<LV2_Feature>
-Worker::Schedule::feature(World* world, Node* n)
+Worker::Schedule::feature(World& world, Node* n)
{
LV2Block* block = dynamic_cast<LV2Block*>(n);
if (!block) {
diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp
index a2bf4a7d..1dd5f34f 100644
--- a/src/server/Worker.hpp
+++ b/src/server/Worker.hpp
@@ -43,7 +43,7 @@ public:
const char* uri() const override { return LV2_WORKER__schedule; }
- SPtr<LV2_Feature> feature(World* world, Node* n) override;
+ SPtr<LV2_Feature> feature(World& world, Node* n) override;
const bool synchronous;
};
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index 960b6004..8c23568b 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -143,18 +143,18 @@ Copy::engine_to_filesystem(PreProcessContext& ctx)
return Event::pre_process_done(Status::BAD_OBJECT_TYPE, _msg.old_uri);
}
- if (!_engine.world()->serialiser()) {
+ if (!_engine.world().serialiser()) {
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
- std::lock_guard<std::mutex> lock(_engine.world()->rdf_mutex());
+ std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
if (ends_with(_msg.new_uri, ".ingen") || ends_with(_msg.new_uri, ".ingen/")) {
- _engine.world()->serialiser()->write_bundle(graph, URI(_msg.new_uri));
+ _engine.world().serialiser()->write_bundle(graph, URI(_msg.new_uri));
} else {
- _engine.world()->serialiser()->start_to_file(graph->path(), _msg.new_uri);
- _engine.world()->serialiser()->serialise(graph);
- _engine.world()->serialiser()->finish();
+ _engine.world().serialiser()->start_to_file(graph->path(), _msg.new_uri);
+ _engine.world().serialiser()->serialise(graph);
+ _engine.world().serialiser()->finish();
}
return Event::pre_process_done(Status::SUCCESS);
@@ -163,11 +163,11 @@ Copy::engine_to_filesystem(PreProcessContext& ctx)
bool
Copy::filesystem_to_engine(PreProcessContext& ctx)
{
- if (!_engine.world()->parser()) {
+ if (!_engine.world().parser()) {
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
- std::lock_guard<std::mutex> lock(_engine.world()->rdf_mutex());
+ std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
// Old URI is a filesystem path and new URI is a path within the engine
const std::string src_path(_msg.old_uri.path());
@@ -179,8 +179,8 @@ Copy::filesystem_to_engine(PreProcessContext& ctx)
dst_symbol = Raul::Symbol(dst_path.symbol());
}
- _engine.world()->parser()->parse_file(
- *_engine.world(), *_engine.world()->interface(), src_path,
+ _engine.world().parser()->parse_file(
+ _engine.world(), *_engine.world().interface(), src_path,
dst_parent, dst_symbol);
return Event::pre_process_done(Status::SUCCESS);
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index fabdbd85..c193a8b5 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -53,7 +53,7 @@ CreateBlock::pre_process(PreProcessContext& ctx)
{
typedef Properties::const_iterator iterator;
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
const SPtr<Store> store = _engine.store();
// Check sanity of target path
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index 27781cbc..bd7079d9 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -54,7 +54,7 @@ CreateGraph::~CreateGraph()
void
CreateGraph::build_child_events()
{
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
// Properties common to both ports
Properties control_properties;
@@ -111,7 +111,7 @@ CreateGraph::pre_process(PreProcessContext& ctx)
}
}
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
typedef Properties::const_iterator iterator;
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index a79c85ef..c27a8ac6 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -51,7 +51,7 @@ CreatePort::CreatePort(Engine& engine,
, _engine_port(nullptr)
, _properties(properties)
{
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
typedef Properties::const_iterator Iterator;
typedef std::pair<Iterator, Iterator> Range;
@@ -77,7 +77,7 @@ CreatePort::CreatePort(Engine& engine,
const Range buffer_types = properties.equal_range(uris.atom_bufferType);
for (Iterator i = buffer_types.first; i != buffer_types.second; ++i) {
if (uris.forge.is_uri(i->second)) {
- _buf_type = _engine.world()->uri_map().map_uri(
+ _buf_type = _engine.world().uri_map().map_uri(
uris.forge.str(i->second, false));
}
}
@@ -107,7 +107,7 @@ CreatePort::pre_process(PreProcessContext& ctx)
return Event::pre_process_done(Status::CREATION_FAILED, _path);
}
- const URIs& uris = _engine.world()->uris();
+ const URIs& uris = _engine.world().uris();
BufferFactory& bufs = *_engine.buffer_factory();
const uint32_t buf_size = bufs.default_size(_buf_type);
const int32_t old_n_ports = _graph->num_ports_non_rt();
@@ -130,7 +130,7 @@ CreatePort::pre_process(PreProcessContext& ctx)
// No index given, append
index = old_n_ports;
index_i = _properties.emplace(uris.lv2_index,
- _engine.world()->forge().make(index));
+ _engine.world().forge().make(index));
}
const PropIter poly_i = _properties.find(uris.ingen_polyphonic);
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index ff9f32b4..4e1aa69b 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -60,7 +60,7 @@ Delete::~Delete()
bool
Delete::pre_process(PreProcessContext& ctx)
{
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
if (_path.is_root() || _path == "/control" || _path == "/notify") {
return Event::pre_process_done(Status::NOT_DELETABLE, _path);
}
@@ -187,7 +187,7 @@ Delete::post_process()
void
Delete::undo(Interface& target)
{
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
ingen::Forge& forge = _engine.buffer_factory()->forge();
auto i = _removed_objects.find(_path);
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 7404aea6..da957fd3 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -117,7 +117,7 @@ Delta::init()
}
// Set atomic execution if polyphony is to be changed
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
if (_properties.count(uris.ingen_polyphonic) ||
_properties.count(uris.ingen_polyphony)) {
_block = true;
@@ -171,7 +171,7 @@ get_file_node(LilvWorld* lworld, const URIs& uris, const Atom& value)
bool
Delta::pre_process(PreProcessContext& ctx)
{
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
const bool is_graph_object = uri_is_path(_subject);
const bool is_client = (_subject == "ingen:/clients/this");
@@ -189,11 +189,11 @@ Delta::pre_process(PreProcessContext& ctx)
const auto p = _properties.find(uris.lv2_prototype);
if (p == _properties.end()) {
return Event::pre_process_done(Status::BAD_REQUEST, _subject);
- } else if (!_engine.world()->forge().is_uri(p->second)) {
+ } else if (!_engine.world().forge().is_uri(p->second)) {
return Event::pre_process_done(Status::BAD_REQUEST, _subject);
}
- const URI prot(_engine.world()->forge().str(p->second, false));
+ const URI prot(_engine.world().forge().str(p->second, false));
if (!uri_is_path(prot)) {
return Event::pre_process_done(Status::BAD_URI, _subject);
}
@@ -271,7 +271,7 @@ Delta::pre_process(PreProcessContext& ctx)
_removed.emplace(key, value);
_object->remove_property(key, value);
} else if (is_engine && key == uris.ingen_loadedBundle) {
- LilvWorld* lworld = _engine.world()->lilv_world();
+ LilvWorld* lworld = _engine.world().lilv_world();
LilvNode* bundle = get_file_node(lworld, uris, value);
if (bundle) {
for (const auto& p : _engine.block_factory()->plugins()) {
@@ -440,7 +440,7 @@ Delta::pre_process(PreProcessContext& ctx)
_engine.broadcaster()->set_broadcast(
_request_client, value.get<int32_t>());
} else if (is_engine && key == uris.ingen_loadedBundle) {
- LilvWorld* lworld = _engine.world()->lilv_world();
+ LilvWorld* lworld = _engine.world().lilv_world();
LilvNode* bundle = get_file_node(lworld, uris, value);
if (bundle) {
lilv_world_load_bundle(lworld, bundle);
@@ -481,7 +481,7 @@ Delta::execute(RunContext& context)
return;
}
- const ingen::URIs& uris = _engine.world()->uris();
+ const ingen::URIs& uris = _engine.world().uris();
if (_create_event) {
_create_event->set_time(_time);
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index ad412beb..6074ea27 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -88,7 +88,7 @@ Get::post_process()
_engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins);
} else if (_msg.subject == "ingen:/engine") {
// TODO: Keep a proper RDF model of the engine
- URIs& uris = _engine.world()->uris();
+ URIs& uris = _engine.world().uris();
Properties props = {
{ uris.param_sampleRate,
uris.forge.make(int32_t(_engine.sample_rate())) },
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index fa36d739..4c879682 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -52,7 +52,7 @@ SetPortValue::SetPortValue(Engine& engine,
bool
SetPortValue::pre_process(PreProcessContext& ctx)
{
- ingen::URIs& uris = _engine.world()->uris();
+ ingen::URIs& uris = _engine.world().uris();
if (_port->is_output()) {
return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path());
}
@@ -60,7 +60,7 @@ SetPortValue::pre_process(PreProcessContext& ctx)
if (!_activity) {
// Set value metadata (does not affect buffers)
_port->set_value(_value);
- _port->set_property(_engine.world()->uris().ingen_value, _value);
+ _port->set_property(_engine.world().uris().ingen_value, _value);
}
_binding = _engine.control_bindings()->port_binding(_port);
@@ -90,7 +90,7 @@ SetPortValue::apply(RunContext& context)
return;
}
- ingen::URIs& uris = _engine.world()->uris();
+ ingen::URIs& uris = _engine.world().uris();
Buffer* buf = _port->buffer(0).get();
if (_buffer) {
@@ -129,7 +129,7 @@ SetPortValue::post_process()
if (respond() == Status::SUCCESS && !_activity) {
_engine.broadcaster()->set_property(
_port->uri(),
- _engine.world()->uris().ingen_value,
+ _engine.world().uris().ingen_value,
_value);
}
}
diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp
index 71d1c8c5..5125efd9 100644
--- a/src/server/ingen_engine.cpp
+++ b/src/server/ingen_engine.cpp
@@ -23,12 +23,12 @@
using namespace ingen;
struct IngenEngineModule : public ingen::Module {
- void load(ingen::World* world) override {
- server::set_denormal_flags(world->log());
+ void load(ingen::World& world) override {
+ server::set_denormal_flags(world.log());
SPtr<server::Engine> engine(new server::Engine(world));
- world->set_engine(engine);
- if (!world->interface()) {
- world->set_interface(engine->interface());
+ world.set_engine(engine);
+ if (!world.interface()) {
+ world.set_interface(engine->interface());
}
}
};
diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp
index 51888972..c1846e43 100644
--- a/src/server/ingen_jack.cpp
+++ b/src/server/ingen_jack.cpp
@@ -29,20 +29,20 @@
using namespace ingen;
struct IngenJackModule : public ingen::Module {
- void load(ingen::World* world) override {
- if (((server::Engine*)world->engine().get())->driver()) {
- world->log().warn("Engine already has a driver\n");
+ void load(ingen::World& world) override {
+ if (((server::Engine*)world.engine().get())->driver()) {
+ world.log().warn("Engine already has a driver\n");
return;
}
server::JackDriver* driver = new server::JackDriver(
- *(server::Engine*)world->engine().get());
- const Atom& s = world->conf().option("jack-server");
+ *(server::Engine*)world.engine().get());
+ const Atom& s = world.conf().option("jack-server");
const std::string server_name = s.is_valid() ? s.ptr<char>() : "";
driver->attach(server_name,
- world->conf().option("jack-name").ptr<char>(),
+ world.conf().option("jack-name").ptr<char>(),
nullptr);
- ((server::Engine*)world->engine().get())->set_driver(
+ ((server::Engine*)world.engine().get())->set_driver(
SPtr<server::Driver>(driver));
}
};
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index c0749847..8e5b2189 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -97,12 +97,12 @@ public:
SampleCount sample_rate)
: _engine(engine)
, _main_sem(0)
- , _reader(engine.world()->uri_map(),
- engine.world()->uris(),
- engine.world()->log(),
- *engine.world()->interface().get())
- , _writer(engine.world()->uri_map(),
- engine.world()->uris(),
+ , _reader(engine.world().uri_map(),
+ engine.world().uris(),
+ engine.world().log(),
+ *engine.world().interface().get())
+ , _writer(engine.world().uri_map(),
+ engine.world().uris(),
*this)
, _from_ui(ui_ring_size(block_length))
, _to_ui(ui_ring_size(block_length))
@@ -120,7 +120,7 @@ public:
bool dynamic_ports() const override { return !_instantiated; }
void pre_process_port(RunContext& context, EnginePort* port) {
- const URIs& uris = _engine.world()->uris();
+ const URIs& uris = _engine.world().uris();
const SampleCount nframes = context.nframes();
DuplexPort* graph_port = port->graph_port();
Buffer* graph_buf = graph_port->buffer(0).get();
@@ -241,7 +241,7 @@ public:
}
void append_time_events(RunContext& context, Buffer& buffer) override {
- const URIs& uris = _engine.world()->uris();
+ const URIs& uris = _engine.world().uris();
LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_ports[0]->buffer();
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
if (ev->body.type == uris.atom_Object) {
@@ -322,7 +322,7 @@ public:
}
// Initialise output port buffer to an empty Sequence
- seq->atom.type = _engine.world()->uris().atom_Sequence;
+ seq->atom.type = _engine.world().uris().atom_Sequence;
seq->atom.size = sizeof(LV2_Atom_Sequence_Body);
const uint32_t read_space = _to_ui.read_space();
@@ -421,19 +421,18 @@ ingen_lv2_main(SPtr<Engine> engine, const SPtr<LV2Driver>& driver)
struct IngenPlugin {
IngenPlugin()
- : world(nullptr)
- , main(nullptr)
+ : main(nullptr)
, map(nullptr)
, argc(0)
, argv(nullptr)
{}
- ingen::World* world;
- SPtr<Engine> engine;
- std::thread* main;
- LV2_URID_Map* map;
- int argc;
- char** argv;
+ UPtr<ingen::World> world;
+ SPtr<Engine> engine;
+ std::thread* main;
+ LV2_URID_Map* map;
+ int argc;
+ char** argv;
};
static Lib::Graphs
@@ -512,7 +511,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
IngenPlugin* plugin = new IngenPlugin();
plugin->map = map;
- plugin->world = new ingen::World(map, unmap, log);
+ plugin->world = UPtr<ingen::World>(new ingen::World(map, unmap, log));
plugin->world->load_configuration(plugin->argc, plugin->argv);
LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength);
@@ -545,7 +544,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
"queue-size",
plugin->world->forge().make(std::max(block_length, seq_size) * 4));
- SPtr<server::Engine> engine(new server::Engine(plugin->world));
+ SPtr<server::Engine> engine(new server::Engine(*plugin->world));
plugin->engine = engine;
plugin->world->set_engine(engine);
@@ -653,9 +652,8 @@ ingen_cleanup(LV2_Handle instance)
delete me->main;
}
- World* world = me->world;
+ auto world = std::move(me->world);
delete me;
- delete world;
}
static void
diff --git a/src/server/ingen_portaudio.cpp b/src/server/ingen_portaudio.cpp
index 6d270443..5b930b1a 100644
--- a/src/server/ingen_portaudio.cpp
+++ b/src/server/ingen_portaudio.cpp
@@ -29,16 +29,16 @@
using namespace ingen;
struct IngenPortAudioModule : public ingen::Module {
- void load(ingen::World* world) override {
- if (((server::Engine*)world->engine().get())->driver()) {
- world->log().warn("Engine already has a driver\n");
+ void load(ingen::World& world) override {
+ if (((server::Engine*)world.engine().get())->driver()) {
+ world.log().warn("Engine already has a driver\n");
return;
}
server::PortAudioDriver* driver = new server::PortAudioDriver(
- *(server::Engine*)world->engine().get());
+ *(server::Engine*)world.engine().get());
driver->attach();
- ((server::Engine*)world->engine().get())->set_driver(
+ ((server::Engine*)world.engine().get())->set_driver(
SPtr<server::Driver>(driver));
}
};