summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-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
34 files changed, 215 insertions, 220 deletions
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));
}
};