summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/.clang-tidy2
-rw-r--r--src/server/ArcImpl.cpp42
-rw-r--r--src/server/ArcImpl.hpp10
-rw-r--r--src/server/BlockFactory.cpp44
-rw-r--r--src/server/BlockFactory.hpp4
-rw-r--r--src/server/BlockImpl.cpp22
-rw-r--r--src/server/BlockImpl.hpp27
-rw-r--r--src/server/Broadcaster.cpp10
-rw-r--r--src/server/Broadcaster.hpp10
-rw-r--r--src/server/Buffer.cpp35
-rw-r--r--src/server/Buffer.hpp9
-rw-r--r--src/server/BufferFactory.cpp12
-rw-r--r--src/server/BufferFactory.hpp10
-rw-r--r--src/server/ClientUpdate.cpp13
-rw-r--r--src/server/ClientUpdate.hpp8
-rw-r--r--src/server/CompiledGraph.cpp48
-rw-r--r--src/server/CompiledGraph.hpp18
-rw-r--r--src/server/ControlBindings.cpp46
-rw-r--r--src/server/ControlBindings.hpp17
-rw-r--r--src/server/DirectDriver.hpp9
-rw-r--r--src/server/Driver.hpp6
-rw-r--r--src/server/DuplexPort.cpp22
-rw-r--r--src/server/DuplexPort.hpp10
-rw-r--r--src/server/Engine.cpp75
-rw-r--r--src/server/Engine.hpp12
-rw-r--r--src/server/EnginePort.hpp4
-rw-r--r--src/server/Event.hpp12
-rw-r--r--src/server/EventWriter.cpp21
-rw-r--r--src/server/EventWriter.hpp6
-rw-r--r--src/server/FrameTimer.hpp6
-rw-r--r--src/server/GraphImpl.cpp29
-rw-r--r--src/server/GraphImpl.hpp26
-rw-r--r--src/server/GraphPlugin.hpp8
-rw-r--r--src/server/InputPort.cpp20
-rw-r--r--src/server/InputPort.hpp18
-rw-r--r--src/server/InternalBlock.cpp5
-rw-r--r--src/server/InternalBlock.hpp2
-rw-r--r--src/server/InternalPlugin.cpp5
-rw-r--r--src/server/InternalPlugin.hpp11
-rw-r--r--src/server/JackDriver.cpp57
-rw-r--r--src/server/JackDriver.hpp71
-rw-r--r--src/server/LV2Block.cpp82
-rw-r--r--src/server/LV2Block.hpp34
-rw-r--r--src/server/LV2Options.hpp8
-rw-r--r--src/server/LV2Plugin.cpp19
-rw-r--r--src/server/LV2Plugin.hpp10
-rw-r--r--src/server/LV2ResizeFeature.hpp4
-rw-r--r--src/server/Load.hpp4
-rw-r--r--src/server/NodeImpl.cpp7
-rw-r--r--src/server/NodeImpl.hpp10
-rw-r--r--src/server/OutputPort.hpp2
-rw-r--r--src/server/PluginImpl.hpp10
-rw-r--r--src/server/PortAudioDriver.cpp11
-rw-r--r--src/server/PortAudioDriver.hpp41
-rw-r--r--src/server/PortImpl.cpp50
-rw-r--r--src/server/PortImpl.hpp14
-rw-r--r--src/server/PortType.hpp113
-rw-r--r--src/server/PostProcessor.cpp2
-rw-r--r--src/server/PreProcessContext.hpp11
-rw-r--r--src/server/PreProcessor.cpp20
-rw-r--r--src/server/PreProcessor.hpp2
-rw-r--r--src/server/RunContext.cpp24
-rw-r--r--src/server/RunContext.hpp4
-rw-r--r--src/server/SocketListener.cpp13
-rw-r--r--src/server/SocketListener.hpp4
-rw-r--r--src/server/SocketServer.hpp22
-rw-r--r--src/server/State.hpp2
-rw-r--r--src/server/Task.cpp2
-rw-r--r--src/server/Task.hpp7
-rw-r--r--src/server/ThreadManager.hpp4
-rw-r--r--src/server/UndoStack.cpp27
-rw-r--r--src/server/UndoStack.hpp18
-rw-r--r--src/server/Worker.cpp29
-rw-r--r--src/server/Worker.hpp14
-rw-r--r--src/server/events.hpp28
-rw-r--r--src/server/events/Connect.cpp24
-rw-r--r--src/server/events/Connect.hpp10
-rw-r--r--src/server/events/Copy.cpp40
-rw-r--r--src/server/events/Copy.hpp6
-rw-r--r--src/server/events/CreateBlock.cpp46
-rw-r--r--src/server/events/CreateBlock.hpp7
-rw-r--r--src/server/events/CreateGraph.cpp38
-rw-r--r--src/server/events/CreateGraph.hpp9
-rw-r--r--src/server/events/CreatePort.cpp40
-rw-r--r--src/server/events/CreatePort.hpp12
-rw-r--r--src/server/events/Delete.cpp45
-rw-r--r--src/server/events/Delete.hpp16
-rw-r--r--src/server/events/Delta.cpp56
-rw-r--r--src/server/events/Delta.hpp15
-rw-r--r--src/server/events/Disconnect.cpp30
-rw-r--r--src/server/events/Disconnect.hpp7
-rw-r--r--src/server/events/DisconnectAll.cpp62
-rw-r--r--src/server/events/DisconnectAll.hpp7
-rw-r--r--src/server/events/Get.cpp32
-rw-r--r--src/server/events/Get.hpp4
-rw-r--r--src/server/events/Mark.cpp12
-rw-r--r--src/server/events/Mark.hpp11
-rw-r--r--src/server/events/Move.cpp15
-rw-r--r--src/server/events/Move.hpp4
-rw-r--r--src/server/events/SetPortValue.cpp19
-rw-r--r--src/server/events/SetPortValue.hpp3
-rw-r--r--src/server/events/Undo.cpp10
-rw-r--r--src/server/events/Undo.hpp2
-rw-r--r--src/server/ingen_engine.cpp6
-rw-r--r--src/server/ingen_jack.cpp10
-rw-r--r--src/server/ingen_lv2.cpp184
-rw-r--r--src/server/ingen_portaudio.cpp8
-rw-r--r--src/server/internals/BlockDelay.cpp23
-rw-r--r--src/server/internals/BlockDelay.hpp1
-rw-r--r--src/server/internals/Controller.cpp26
-rw-r--r--src/server/internals/Note.cpp23
-rw-r--r--src/server/internals/Note.hpp4
-rw-r--r--src/server/internals/Time.cpp23
-rw-r--r--src/server/internals/Time.hpp1
-rw-r--r--src/server/internals/Trigger.cpp23
-rw-r--r--src/server/meson.build38
-rw-r--r--src/server/mix.cpp4
-rw-r--r--src/server/util.hpp4
118 files changed, 1173 insertions, 1261 deletions
diff --git a/src/server/.clang-tidy b/src/server/.clang-tidy
index b5c584cf..a580cc7e 100644
--- a/src/server/.clang-tidy
+++ b/src/server/.clang-tidy
@@ -2,7 +2,6 @@ Checks: >
-*-avoid-c-arrays,
-*-narrowing-conversions,
-*-non-private-member-variables-in-classes,
- -*-uppercase-literal-suffix,
-*-vararg,
-bugprone-branch-clone,
-bugprone-parent-virtual-call,
@@ -11,7 +10,6 @@ Checks: >
-cert-dcl37-c,
-cert-dcl51-cpp,
-cppcoreguidelines-pro-bounds-constant-array-index,
- -cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-static-cast-downcast,
-google-readability-todo,
-google-runtime-int,
diff --git a/src/server/ArcImpl.cpp b/src/server/ArcImpl.cpp
index 0b503534..2c5b4ee1 100644
--- a/src/server/ArcImpl.cpp
+++ b/src/server/ArcImpl.cpp
@@ -22,8 +22,8 @@
#include "PortImpl.hpp"
#include "PortType.hpp"
-#include "ingen/URIs.hpp"
-#include "raul/Path.hpp"
+#include <ingen/URIs.hpp>
+#include <raul/Path.hpp>
#include <algorithm>
#include <cassert>
@@ -84,32 +84,30 @@ ArcImpl::can_connect(const PortImpl* src, const InputPort* dst)
{
const ingen::URIs& uris = src->bufs().uris();
return (
- // (Audio | Control | CV) => (Audio | Control | CV)
- ( (src->is_a(PortType::ID::CONTROL) ||
- src->is_a(PortType::ID::AUDIO) ||
- src->is_a(PortType::ID::CV))
- && (dst->is_a(PortType::ID::CONTROL)
- || dst->is_a(PortType::ID::AUDIO)
- || dst->is_a(PortType::ID::CV)))
+ // (Audio | Control | CV) => (Audio | Control | CV)
+ ((src->is_a(PortType::CONTROL) || src->is_a(PortType::AUDIO) ||
+ src->is_a(PortType::CV)) &&
+ (dst->is_a(PortType::CONTROL) || dst->is_a(PortType::AUDIO) ||
+ dst->is_a(PortType::CV)))
- // Equal types
- || (src->type() == dst->type() &&
- src->buffer_type() == dst->buffer_type())
+ // Equal types
+ ||
+ (src->type() == dst->type() && src->buffer_type() == dst->buffer_type())
- // Control => atom:Float Value
- || (src->is_a(PortType::ID::CONTROL) && dst->supports(uris.atom_Float))
+ // Control => atom:Float Value
+ || (src->is_a(PortType::CONTROL) && dst->supports(uris.atom_Float))
- // Audio => atom:Sound Value
- || (src->is_a(PortType::ID::AUDIO) && dst->supports(uris.atom_Sound))
+ // Audio => atom:Sound Value
+ || (src->is_a(PortType::AUDIO) && dst->supports(uris.atom_Sound))
- // atom:Float Value => Control
- || (src->supports(uris.atom_Float) && dst->is_a(PortType::ID::CONTROL))
+ // atom:Float Value => Control
+ || (src->supports(uris.atom_Float) && dst->is_a(PortType::CONTROL))
- // atom:Float Value => CV
- || (src->supports(uris.atom_Float) && dst->is_a(PortType::ID::CV))
+ // atom:Float Value => CV
+ || (src->supports(uris.atom_Float) && dst->is_a(PortType::CV))
- // atom:Sound Value => Audio
- || (src->supports(uris.atom_Sound) && dst->is_a(PortType::ID::AUDIO)));
+ // atom:Sound Value => Audio
+ || (src->supports(uris.atom_Sound) && dst->is_a(PortType::AUDIO)));
}
} // namespace ingen::server
diff --git a/src/server/ArcImpl.hpp b/src/server/ArcImpl.hpp
index 27d7eacb..5be51187 100644
--- a/src/server/ArcImpl.hpp
+++ b/src/server/ArcImpl.hpp
@@ -17,21 +17,15 @@
#ifndef INGEN_ENGINE_ARC_IMPL_HPP
#define INGEN_ENGINE_ARC_IMPL_HPP
-// IWYU pragma: no_include "raul/Path.hpp"
-
#include "BufferRef.hpp"
-#include "ingen/Arc.hpp"
-#include "raul/Noncopyable.hpp"
+#include <ingen/Arc.hpp>
+#include <raul/Noncopyable.hpp>
#include <boost/intrusive/slist_hook.hpp>
#include <cstdint>
-namespace raul {
-class Path; // IWYU pragma: keep
-} // namespace raul
-
namespace ingen::server {
class InputPort;
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 5c9279d3..a70de0b6 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2024 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -22,21 +22,23 @@
#include "PortType.hpp"
#include "ThreadManager.hpp"
-#include "ingen/LV2Features.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "internals/BlockDelay.hpp"
-#include "internals/Controller.hpp"
-#include "internals/Note.hpp"
-#include "internals/Time.hpp"
-#include "internals/Trigger.hpp"
-#include "lilv/lilv.h"
+#include <ingen/LV2Features.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <internals/BlockDelay.hpp>
+#include <internals/Controller.hpp>
+#include <internals/Note.hpp>
+#include <internals/Time.hpp>
+#include <internals/Trigger.hpp>
+#include <lilv/lilv.h>
#include <algorithm>
#include <cstdint>
#include <iterator>
#include <memory>
+#include <string>
#include <utility>
#include <vector>
@@ -148,8 +150,10 @@ BlockFactory::load_lv2_plugins()
// Build an array of port type nodes for checking compatibility
using Types = std::vector<std::shared_ptr<LilvNode>>;
Types types;
- for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) {
- const URI& uri(PortType(static_cast<PortType::ID>(t)).uri());
+ for (auto t = static_cast<unsigned>(PortType::AUDIO);
+ t <= static_cast<unsigned>(PortType::ATOM);
+ ++t) {
+ const URI uri = port_type_uri(static_cast<PortType>(t));
types.push_back(std::shared_ptr<LilvNode>(
lilv_new_uri(_world.lilv_world(), uri.c_str()), lilv_node_free));
}
@@ -186,13 +190,13 @@ BlockFactory::load_lv2_plugins()
const uint32_t n_ports = lilv_plugin_get_num_ports(lv2_plug);
for (uint32_t p = 0; p < n_ports; ++p) {
const LilvPort* port = lilv_plugin_get_port_by_index(lv2_plug, p);
- supported = false;
- for (const auto& t : types) {
- if (lilv_port_is_a(lv2_plug, port, t.get())) {
- supported = true;
- break;
- }
- }
+ supported =
+ std::any_of(types.begin(),
+ types.end(),
+ [&lv2_plug, &port](const auto& t) {
+ return lilv_port_is_a(lv2_plug, port, t.get());
+ });
+
if (!supported &&
!lilv_port_has_property(lv2_plug,
port,
diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp
index 17c11bb4..68699d8a 100644
--- a/src/server/BlockFactory.hpp
+++ b/src/server/BlockFactory.hpp
@@ -17,8 +17,8 @@
#ifndef INGEN_ENGINE_BLOCKFACTORY_HPP
#define INGEN_ENGINE_BLOCKFACTORY_HPP
-#include "ingen/URI.hpp"
-#include "raul/Noncopyable.hpp"
+#include <ingen/URI.hpp>
+#include <raul/Noncopyable.hpp>
#include <map>
#include <memory>
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp
index 3fa7a1c3..b4f407c3 100644
--- a/src/server/BlockImpl.cpp
+++ b/src/server/BlockImpl.cpp
@@ -20,13 +20,15 @@
#include "GraphImpl.hpp"
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
+#include "PortType.hpp"
#include "RunContext.hpp"
#include "ThreadManager.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Symbol.hpp"
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Symbol.hpp>
+#include <algorithm>
#include <cassert>
#include <cstdint>
#include <initializer_list>
@@ -200,10 +202,10 @@ BlockImpl::bypass(RunContext& ctx)
}
// Dumb bypass
- for (PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) {
+ for (const PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) {
for (uint32_t i = 0;; ++i) {
- PortImpl* in = nth_port_by_type(i, true, t);
- PortImpl* out = nth_port_by_type(i, false, t);
+ const PortImpl* in = nth_port_by_type(i, true, t);
+ const PortImpl* out = nth_port_by_type(i, false, t);
if (!out) {
break; // Finished writing all outputs
}
@@ -240,13 +242,11 @@ BlockImpl::process(RunContext& ctx)
// Find earliest offset of a value change
SampleCount chunk_end = ctx.nframes();
for (uint32_t i = 0; _ports && i < _ports->size(); ++i) {
- PortImpl* const port = _ports->at(i);
+ const PortImpl* const port = _ports->at(i);
if (port->type() == PortType::CONTROL && port->is_input()) {
const SampleCount o = port->next_value_offset(
offset, ctx.nframes());
- if (o < chunk_end) {
- chunk_end = o;
- }
+ chunk_end = std::min(o, chunk_end);
}
}
@@ -264,7 +264,7 @@ BlockImpl::process(RunContext& ctx)
// Emit control port outputs as events
for (uint32_t i = 0; _ports && i < _ports->size(); ++i) {
- PortImpl* const port = _ports->at(i);
+ const PortImpl* const port = _ports->at(i);
if (port->type() == PortType::CONTROL && port->is_output()) {
// TODO: Only emit events when value has actually changed?
for (uint32_t v = 0; v < _polyphony; ++v) {
diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp
index 3f742bfa..69564ff4 100644
--- a/src/server/BlockImpl.hpp
+++ b/src/server/BlockImpl.hpp
@@ -19,18 +19,16 @@
#include "BufferRef.hpp"
#include "NodeImpl.hpp"
-#include "PortType.hpp"
#include "State.hpp"
#include "types.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/URI.hpp"
-#include "lilv/lilv.h"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/URI.hpp>
+#include <lilv/lilv.h>
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
#include <boost/intrusive/slist_hook.hpp>
@@ -43,7 +41,11 @@ namespace raul {
class Symbol;
} // namespace raul
-namespace ingen::server {
+namespace ingen {
+
+enum class PortType;
+
+namespace server {
class BufferFactory;
class Engine;
@@ -123,7 +125,7 @@ public:
/** Learn the next incoming MIDI event (for internals) */
virtual void learn() {}
- /** Do whatever needs doing in the process thread before process() is called */
+ /** Do any necessary preparation in the process thread before process(). */
virtual void pre_process(RunContext& ctx);
/** Run block for an entire process cycle (calls run()). */
@@ -215,6 +217,7 @@ protected:
bool _enabled{true};
};
-} // namespace ingen::server
+} // namespace server
+} // namespace ingen
#endif // INGEN_ENGINE_BLOCKIMPL_HPP
diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp
index 1d5cc843..76b21fc6 100644
--- a/src/server/Broadcaster.cpp
+++ b/src/server/Broadcaster.cpp
@@ -19,7 +19,7 @@
#include "BlockFactory.hpp"
#include "PluginImpl.hpp"
-#include "ingen/Interface.hpp"
+#include <ingen/Interface.hpp>
#include <cstddef>
#include <memory>
@@ -29,7 +29,7 @@ namespace ingen::server {
Broadcaster::~Broadcaster()
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
_clients.clear();
_broadcastees.clear();
}
@@ -39,7 +39,7 @@ Broadcaster::~Broadcaster()
void
Broadcaster::register_client(const std::shared_ptr<Interface>& client)
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
_clients.insert(client);
}
@@ -50,7 +50,7 @@ Broadcaster::register_client(const std::shared_ptr<Interface>& client)
bool
Broadcaster::unregister_client(const std::shared_ptr<Interface>& client)
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
const size_t erased = _clients.erase(client);
_broadcastees.erase(client);
return (erased > 0);
@@ -71,7 +71,7 @@ Broadcaster::set_broadcast(const std::shared_ptr<Interface>& client,
void
Broadcaster::send_plugins(const BlockFactory::Plugins& plugins)
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
for (const auto& c : _clients) {
send_plugins_to(c.get(), plugins);
}
diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp
index e4034155..4cdf65ca 100644
--- a/src/server/Broadcaster.hpp
+++ b/src/server/Broadcaster.hpp
@@ -19,10 +19,10 @@
#include "BlockFactory.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Message.hpp"
-#include "ingen/URI.hpp"
-#include "raul/Noncopyable.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/URI.hpp>
+#include <raul/Noncopyable.hpp>
#include <atomic>
#include <memory>
@@ -97,7 +97,7 @@ public:
send_plugins_to(Interface*, const BlockFactory::Plugins& plugins);
void message(const Message& msg) override {
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
for (const auto& c : _clients) {
if (c != _ignore_client) {
c->message(msg);
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp
index 394d3323..0c4c0951 100644
--- a/src/server/Buffer.cpp
+++ b/src/server/Buffer.cpp
@@ -18,15 +18,16 @@
#include "BufferFactory.hpp"
#include "Engine.hpp"
+#include "PortType.hpp"
#include "RunContext.hpp"
#include "ingen_config.h"
-#include "ingen/Atom.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/urid/urid.h"
+#include <ingen/Atom.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/urid/urid.h>
#include <algorithm>
#include <cstdint>
@@ -171,7 +172,12 @@ void
Buffer::resize(uint32_t capacity)
{
if (!_external) {
- _buf = realloc(_buf, capacity);
+ void* const new_buf = realloc(_buf, capacity);
+ if (!new_buf) {
+ throw std::bad_alloc{};
+ }
+
+ _buf = new_buf;
_capacity = capacity;
clear();
} else {
@@ -182,18 +188,18 @@ Buffer::resize(uint32_t capacity)
void*
Buffer::port_data(PortType port_type, SampleCount offset)
{
- switch (port_type.id()) {
- case PortType::ID::CONTROL:
+ switch (port_type) {
+ case PortType::CONTROL:
return &_value_buffer->get<LV2_Atom_Float>()->body;
- case PortType::ID::CV:
- case PortType::ID::AUDIO:
+ case PortType::CV:
+ case PortType::AUDIO:
if (_type == _factory.uris().atom_Float) {
return &get<LV2_Atom_Float>()->body;
} else if (_type == _factory.uris().atom_Sound) {
return static_cast<Sample*>(_buf) + offset;
}
break;
- case PortType::ID::ATOM:
+ case PortType::ATOM:
if (_type != _factory.uris().atom_Sound) {
return _buf;
}
@@ -207,8 +213,7 @@ Buffer::port_data(PortType port_type, SampleCount offset)
const void*
Buffer::port_data(PortType port_type, SampleCount offset) const
{
- return const_cast<void*>(
- const_cast<Buffer*>(this)->port_data(port_type, offset));
+ return const_cast<Buffer*>(this)->port_data(port_type, offset);
}
#ifdef __SSE__
@@ -435,7 +440,7 @@ void* Buffer::aligned_alloc(size_t size)
{
#if USE_POSIX_MEMALIGN
void* buf = nullptr;
- if (!posix_memalign(static_cast<void**>(&buf), 16, size)) {
+ if (!posix_memalign(&buf, 16, size)) {
memset(buf, 0, size);
return buf;
}
diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp
index 8a64e621..2c32076b 100644
--- a/src/server/Buffer.hpp
+++ b/src/server/Buffer.hpp
@@ -19,13 +19,12 @@
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
-#include "PortType.hpp"
#include "server.h"
#include "types.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/urid/urid.h"
+#include <ingen/URIs.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/urid/urid.h>
#include <atomic>
#include <cassert>
@@ -34,6 +33,8 @@
namespace ingen {
+enum class PortType;
+
class Atom;
namespace server {
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index 1afbf93f..b8f6ee35 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -19,11 +19,11 @@
#include "Buffer.hpp"
#include "Engine.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/urid/urid.h"
+#include <ingen/Log.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/urid/urid.h>
#include <algorithm>
#include <memory>
@@ -109,7 +109,7 @@ BufferFactory::default_size(LV2_URID type) const
}
if (type == _uris.atom_Sequence) {
- if (_seq_size == 0) {
+ if (_seq_size == 0U) {
return _engine.sequence_size();
}
diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp
index 657ce7d2..dbadaede 100644
--- a/src/server/BufferFactory.hpp
+++ b/src/server/BufferFactory.hpp
@@ -17,13 +17,13 @@
#ifndef INGEN_ENGINE_BUFFERFACTORY_HPP
#define INGEN_ENGINE_BUFFERFACTORY_HPP
-#include "ingen/URIs.hpp"
-#include "lv2/urid/urid.h"
-#include "server.h"
-
#include "BufferRef.hpp"
+#include "server.h"
#include "types.hpp"
+#include <ingen/URIs.hpp>
+#include <lv2/urid/urid.h>
+
#include <atomic>
#include <cstdint>
#include <mutex>
@@ -111,7 +111,7 @@ private:
std::mutex _mutex;
Engine& _engine;
URIs& _uris;
- uint32_t _seq_size{0};
+ uint32_t _seq_size{0U};
BufferRef _silent_buffer;
};
diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp
index c96a0d01..008e9843 100644
--- a/src/server/ClientUpdate.cpp
+++ b/src/server/ClientUpdate.cpp
@@ -23,11 +23,14 @@
#include "PortImpl.hpp"
#include "PortType.hpp"
-#include "ingen/Arc.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/URIs.hpp"
+#include <ingen/Arc.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <raul/Path.hpp>
#include <boost/intrusive/slist.hpp>
diff --git a/src/server/ClientUpdate.hpp b/src/server/ClientUpdate.hpp
index 9fadae90..1d16e6d6 100644
--- a/src/server/ClientUpdate.hpp
+++ b/src/server/ClientUpdate.hpp
@@ -17,10 +17,10 @@
#ifndef INGEN_ENGINE_CLIENTUPDATE_HPP
#define INGEN_ENGINE_CLIENTUPDATE_HPP
-#include "ingen/Properties.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/URI.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/URI.hpp>
+#include <raul/Path.hpp>
#include <string>
#include <vector>
diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp
index b453932b..89fc8843 100644
--- a/src/server/CompiledGraph.cpp
+++ b/src/server/CompiledGraph.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2015-2017 David Robillard <http://drobilla.net/>
+ Copyright 2015-2024 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -21,13 +21,12 @@
#include "GraphImpl.hpp"
#include "ThreadManager.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/ColorContext.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/World.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/ColorContext.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/World.hpp>
+#include <raul/Path.hpp>
#include <boost/intrusive/slist.hpp>
@@ -36,6 +35,7 @@
#include <cstdint>
#include <cstdio>
#include <exception>
+#include <functional>
#include <limits>
#include <memory>
#include <utility>
@@ -61,13 +61,11 @@ public:
static bool
has_provider_with_many_dependants(const BlockImpl* n)
{
- for (const auto* p : n->providers()) {
- if (p->dependants().size() > 1) {
- return true;
- }
- }
-
- return false;
+ return std::any_of(n->providers().begin(),
+ n->providers().end(),
+ [](const auto* p) {
+ return p->dependants().size() > 1;
+ });
}
CompiledGraph::CompiledGraph(GraphImpl* graph)
@@ -76,11 +74,11 @@ CompiledGraph::CompiledGraph(GraphImpl* graph)
compile_graph(graph);
}
-raul::managed_ptr<CompiledGraph>
-CompiledGraph::compile(raul::Maid& maid, GraphImpl& graph)
+std::unique_ptr<CompiledGraph>
+CompiledGraph::compile(GraphImpl& graph)
{
try {
- return maid.make_managed<CompiledGraph>(&graph);
+ return std::unique_ptr<CompiledGraph>(new CompiledGraph(&graph));
} catch (const FeedbackException& e) {
Log& log = graph.engine().log();
if (e.node && e.root) {
@@ -96,13 +94,11 @@ CompiledGraph::compile(raul::Maid& maid, GraphImpl& graph)
static size_t
num_unvisited_dependants(const BlockImpl* block)
{
- size_t count = 0;
- for (const BlockImpl* b : block->dependants()) {
- if (b->get_mark() == BlockImpl::Mark::UNVISITED) {
- ++count;
- }
- }
- return count;
+ return std::count_if(block->dependants().begin(),
+ block->dependants().end(),
+ [](const auto* b) {
+ return b->get_mark() == BlockImpl::Mark::UNVISITED;
+ });
}
static size_t
@@ -161,7 +157,7 @@ CompiledGraph::compile_graph(GraphImpl* graph)
_master = Task::simplify(std::move(_master));
if (graph->engine().world().conf().option("trace").get<int32_t>()) {
- ColorContext ctx(stderr, ColorContext::Color::YELLOW);
+ const ColorContext ctx{stderr, ColorContext::Color::YELLOW};
dump(graph->path());
}
}
diff --git a/src/server/CompiledGraph.hpp b/src/server/CompiledGraph.hpp
index a5ba66c3..1949563d 100644
--- a/src/server/CompiledGraph.hpp
+++ b/src/server/CompiledGraph.hpp
@@ -19,8 +19,7 @@
#include "Task.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Noncopyable.hpp"
+#include <raul/Noncopyable.hpp>
#include <cstddef>
#include <memory>
@@ -39,18 +38,15 @@ class RunContext;
* execute the nodes in order and have nodes always executed before any of
* their dependencies.
*/
-class CompiledGraph : public raul::Maid::Disposable
- , public raul::Noncopyable
+class CompiledGraph : public raul::Noncopyable
{
public:
- static raul::managed_ptr<CompiledGraph> compile(raul::Maid& maid, GraphImpl& graph);
+ static std::unique_ptr<CompiledGraph> compile(GraphImpl& graph);
void run(RunContext& ctx);
private:
- friend class raul::Maid; ///< Allow make_managed to construct
-
- CompiledGraph(GraphImpl* graph);
+ explicit CompiledGraph(GraphImpl* graph);
using BlockSet = std::set<BlockImpl*>;
@@ -72,10 +68,10 @@ private:
std::unique_ptr<Task> _master;
};
-inline raul::managed_ptr<CompiledGraph>
-compile(raul::Maid& maid, GraphImpl& graph)
+inline std::unique_ptr<CompiledGraph>
+compile(GraphImpl& graph)
{
- return CompiledGraph::compile(maid, graph);
+ return CompiledGraph::compile(graph);
}
} // namespace ingen::server
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 265333d4..489d5384 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -23,21 +23,22 @@
#include "RunContext.hpp"
#include "ThreadManager.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URIMap.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/forge.h"
-#include "lv2/atom/util.h"
-#include "lv2/midi/midi.h"
-#include "lv2/urid/urid.h"
-#include "raul/Path.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/URIMap.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/forge.h>
+#include <lv2/atom/util.h>
+#include <lv2/midi/midi.h>
+#include <lv2/urid/urid.h>
+#include <raul/Path.hpp>
#include <boost/intrusive/bstree.hpp>
+#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
@@ -198,8 +199,9 @@ ControlBindings::port_value_changed(RunContext& ctx,
{
const ingen::URIs& uris = ctx.engine().world().uris();
if (!!key) {
- int16_t value = port_value_to_control(
- ctx, port, key.type, value_atom);
+ const int16_t value =
+ port_value_to_control(ctx, port, key.type, value_atom);
+
uint16_t size = 0;
uint8_t buf[4];
switch (key.type) {
@@ -248,7 +250,7 @@ ControlBindings::start_learn(PortImpl* port)
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
Binding* b = _learn_binding.load();
if (!b) {
- _learn_binding = new Binding(Type::NULL_CONTROL, port);
+ _learn_binding = new Binding();
} else {
b->port = port;
}
@@ -295,7 +297,7 @@ ControlBindings::control_to_port_value(RunContext& ctx,
float max = 1.0f;
get_range(ctx, port, &min, &max);
- return normal * (max - min) + min;
+ return (normal * (max - min)) + min;
}
int16_t
@@ -315,16 +317,10 @@ ControlBindings::port_value_to_control(RunContext& ctx,
const float value = value_atom.get<float>();
float normal = (value - min) / (max - min);
- if (normal < 0.0f) {
- normal = 0.0f;
- }
-
- if (normal > 1.0f) {
- normal = 1.0f;
- }
+ normal = std::max(0.0f, std::min(1.0f, normal));
if (port->is_logarithmic()) {
- normal = logf(normal * (static_cast<float>(M_E) - 1.0f) + 1.0f);
+ normal = logf((normal * (static_cast<float>(M_E) - 1.0f)) + 1.0f);
}
switch (type) {
@@ -390,7 +386,7 @@ ControlBindings::set_port_value(RunContext& ctx,
// TODO: Set port value property so it is saved
port->set_control_value(ctx, ctx.start(), val);
- URIs& uris = ctx.engine().world().uris();
+ const URIs& uris = ctx.engine().world().uris();
ctx.notify(uris.ingen_value, ctx.start(), port,
sizeof(float), _forge.Float, &val);
}
diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp
index 9a7f66a2..0e6dbf63 100644
--- a/src/server/ControlBindings.hpp
+++ b/src/server/ControlBindings.hpp
@@ -19,9 +19,10 @@
#include "BufferRef.hpp"
-#include "lv2/atom/forge.h"
-#include "raul/Maid.hpp"
+#include <lv2/atom/forge.h>
+#include <raul/Maid.hpp>
+#include <boost/intrusive/options.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/intrusive/set_hook.hpp>
@@ -34,10 +35,6 @@ namespace raul {
class Path;
} // namespace raul
-namespace boost::intrusive {
-template <class Compare> struct compare;
-} // namespace boost::intrusive
-
namespace ingen {
class Atom;
@@ -63,9 +60,8 @@ public:
};
struct Key {
- Key(Type t = Type::NULL_CONTROL, int16_t n = 0) noexcept
- : type(t), num(n)
- {}
+ Key(Type t, int16_t n) noexcept : type{t}, num{n} {}
+ Key() noexcept : Key{Type::NULL_CONTROL, 0U} {}
bool operator<(const Key& other) const {
return ((type < other.type) ||
@@ -85,7 +81,8 @@ public:
/** One binding of a controller to a port. */
struct Binding : public boost::intrusive::set_base_hook<>,
public raul::Maid::Disposable {
- Binding(Key k=Key(), PortImpl* p=nullptr) : key(k), port(p) {}
+ Binding(Key k, PortImpl* p) noexcept : key{k}, port{p} {}
+ Binding() noexcept : Binding{Key{}, nullptr} {}
bool operator<(const Binding& rhs) const { return key < rhs.key; }
diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp
index 2361034c..bc52fc3a 100644
--- a/src/server/DirectDriver.hpp
+++ b/src/server/DirectDriver.hpp
@@ -24,11 +24,12 @@
#include "RunContext.hpp"
#include "types.hpp"
-#include "raul/Path.hpp"
+#include <raul/Path.hpp>
#include <boost/intrusive/slist.hpp>
#include <cstddef>
+#include <cstdint>
#include <string>
namespace boost::intrusive {
@@ -53,7 +54,7 @@ public:
DirectDriver(Engine& engine,
double sample_rate,
SampleCount block_length,
- size_t seq_size)
+ uint32_t seq_size)
: _engine(engine)
, _sample_rate(sample_rate)
, _block_length(block_length)
@@ -100,7 +101,7 @@ public:
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
@@ -120,7 +121,7 @@ private:
Ports _ports;
SampleCount _sample_rate;
SampleCount _block_length;
- size_t _seq_size;
+ uint32_t _seq_size;
};
} // namespace server
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index 83436389..112fb8ba 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -19,8 +19,8 @@
#include "types.hpp"
-#include "ingen/URI.hpp"
-#include "raul/Noncopyable.hpp"
+#include <ingen/URI.hpp>
+#include <raul/Noncopyable.hpp>
#include <cstddef>
@@ -98,7 +98,7 @@ public:
virtual SampleCount block_length() const = 0;
/** Return the event buffer size in bytes */
- virtual size_t seq_size() const = 0;
+ virtual uint32_t seq_size() const = 0;
/** Return the sample rate in Hz */
virtual SampleRate sample_rate() const = 0;
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index 941beb10..1e07afd2 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -23,15 +23,17 @@
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "NodeImpl.hpp"
-
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
+#include "PortType.hpp"
+
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
#include <algorithm>
#include <map>
@@ -95,7 +97,7 @@ DuplexPort::duplicate(Engine& engine,
GraphImpl* parent)
{
BufferFactory& bufs = *engine.buffer_factory();
- const Atom polyphonic = get_property(bufs.uris().ingen_polyphonic);
+ const Atom& polyphonic = get_property(bufs.uris().ingen_polyphonic);
auto* dup = new DuplexPort(
bufs, parent, symbol, _index,
diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp
index 3cc0efba..fb3eb74e 100644
--- a/src/server/DuplexPort.hpp
+++ b/src/server/DuplexPort.hpp
@@ -19,13 +19,11 @@
#include "InputPort.hpp"
#include "PortImpl.hpp"
-#include "PortType.hpp"
#include "server.h"
#include "types.hpp"
-#include "ingen/URI.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Maid.hpp"
+#include <lv2/urid/urid.h>
+#include <raul/Maid.hpp>
#include <boost/intrusive/slist_hook.hpp>
@@ -38,15 +36,15 @@ class Symbol;
namespace ingen {
+enum class PortType;
+
class Atom;
-class Properties;
namespace server {
class BufferFactory;
class Engine;
class GraphImpl;
-class RunContext;
/** A duplex Port (both an input and output port on a Graph)
*
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 9603fcef..4d753bbc 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2017 David Robillard <http://drobilla.net/>
+ Copyright 2007-2024 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -19,7 +19,6 @@
#include "BlockFactory.hpp"
#include "Broadcaster.hpp"
#include "BufferFactory.hpp"
-#include "BufferRef.hpp"
#include "ControlBindings.hpp"
#include "DirectDriver.hpp"
#include "Driver.hpp"
@@ -43,26 +42,28 @@
#include "SocketListener.hpp"
#endif
-#include "ingen/Atom.hpp"
-#include "ingen/AtomReader.hpp"
-#include "ingen/ColorContext.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/LV2Features.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/StreamWriter.hpp"
-#include "ingen/Tee.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/buf-size/buf-size.h"
-#include "lv2/state/state.h"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/RingBuffer.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/AtomReader.hpp>
+#include <ingen/Clock.hpp>
+#include <ingen/ColorContext.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/LV2Features.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/StreamWriter.hpp>
+#include <ingen/Tee.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/buf-size/buf-size.h>
+#include <lv2/state/state.h>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
+#include <raul/RingBuffer.hpp>
#include <algorithm>
#include <cmath>
@@ -71,6 +72,7 @@
#include <limits>
#include <map>
#include <memory>
+#include <string>
#include <thread>
#include <utility>
@@ -105,11 +107,14 @@ Engine::Engine(ingen::World& world)
}
for (int i = 0; i < world.conf().option("threads").get<int32_t>(); ++i) {
+ const bool is_threaded = (i > 0);
_notifications.emplace_back(
- std::make_unique<raul::RingBuffer>(uint32_t(24 * event_queue_size())));
+ std::make_unique<raul::RingBuffer>(24U * event_queue_size()));
_run_contexts.emplace_back(
- std::make_unique<RunContext>(
- *this, _notifications.back().get(), unsigned(i), i > 0));
+ std::make_unique<RunContext>(*this,
+ _notifications.back().get(),
+ static_cast<unsigned>(i),
+ is_threaded));
}
_world.lv2_features().add_feature(_worker->schedule_feature());
@@ -237,12 +242,11 @@ Engine::emit_notifications(FrameTime end)
bool
Engine::pending_notifications()
{
- for (const auto& ctx : _run_contexts) {
- if (ctx->pending_notifications()) {
- return true;
- }
- }
- return false;
+ return std::any_of(_run_contexts.begin(),
+ _run_contexts.end(),
+ [](const auto& ctx) {
+ return ctx->pending_notifications();
+ });
}
bool
@@ -296,16 +300,17 @@ Engine::block_length() const
return _driver->block_length();
}
-size_t
+uint32_t
Engine::sequence_size() const
{
return _driver->seq_size();
}
-size_t
+uint32_t
Engine::event_queue_size() const
{
- return _world.conf().option("queue-size").get<int32_t>();
+ return static_cast<uint32_t>(
+ std::max(0, _world.conf().option("queue-size").get<int32_t>()));
}
void
@@ -379,7 +384,7 @@ Engine::reset_load()
}
void
-Engine::init(double sample_rate, uint32_t block_length, size_t seq_size)
+Engine::init(double sample_rate, uint32_t block_length, uint32_t seq_size)
{
set_driver(std::make_shared<DirectDriver>(
*this, sample_rate, block_length, seq_size));
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index d224d5b5..8fa1d169 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -22,9 +22,9 @@
#include "server.h"
#include "types.hpp"
-#include "ingen/Clock.hpp"
-#include "ingen/EngineBase.hpp"
-#include "ingen/Properties.hpp"
+#include <ingen/Clock.hpp>
+#include <ingen/EngineBase.hpp>
+#include <ingen/Properties.hpp>
#include <chrono>
#include <condition_variable>
@@ -85,7 +85,7 @@ public:
Engine& operator=(const Engine&) = delete;
// EngineBase methods
- void init(double sample_rate, uint32_t block_length, size_t seq_size) override;
+ void init(double sample_rate, uint32_t block_length, uint32_t seq_size) override;
bool supports_dynamic_ports() const override;
bool activate() override;
void deactivate() override;
@@ -170,8 +170,8 @@ public:
SampleRate sample_rate() const;
SampleCount block_length() const;
- size_t sequence_size() const;
- size_t event_queue_size() const;
+ uint32_t sequence_size() const;
+ uint32_t event_queue_size() const;
size_t n_threads() const { return _run_contexts.size(); }
bool atomic_bundles() const { return _atomic_bundles; }
diff --git a/src/server/EnginePort.hpp b/src/server/EnginePort.hpp
index 7a25bda5..d7e73f63 100644
--- a/src/server/EnginePort.hpp
+++ b/src/server/EnginePort.hpp
@@ -19,8 +19,8 @@
#include "DuplexPort.hpp"
-#include "raul/Deletable.hpp"
-#include "raul/Noncopyable.hpp"
+#include <raul/Deletable.hpp>
+#include <raul/Noncopyable.hpp>
#include <boost/intrusive/slist_hook.hpp>
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index de1f2384..3c9c5c26 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -19,12 +19,12 @@
#include "types.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Deletable.hpp"
-#include "raul/Noncopyable.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Deletable.hpp>
+#include <raul/Noncopyable.hpp>
#include <atomic>
#include <cstdint>
diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp
index 2feef347..fff9226a 100644
--- a/src/server/EventWriter.cpp
+++ b/src/server/EventWriter.cpp
@@ -18,16 +18,17 @@
#include "Engine.hpp"
-#include "events/Connect.hpp"
-#include "events/Copy.hpp"
-#include "events/Delete.hpp"
-#include "events/Delta.hpp"
-#include "events/Disconnect.hpp"
-#include "events/DisconnectAll.hpp"
-#include "events/Get.hpp"
-#include "events/Mark.hpp"
-#include "events/Move.hpp"
-#include "events/Undo.hpp"
+#include <events/Connect.hpp>
+#include <events/Copy.hpp>
+#include <events/Delete.hpp>
+#include <events/Delta.hpp>
+#include <events/Disconnect.hpp>
+#include <events/DisconnectAll.hpp>
+#include <events/Get.hpp>
+#include <events/Mark.hpp>
+#include <events/Move.hpp>
+#include <events/Undo.hpp>
+#include <ingen/Message.hpp>
#include <variant>
diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp
index ea35ceea..55ee1158 100644
--- a/src/server/EventWriter.hpp
+++ b/src/server/EventWriter.hpp
@@ -20,9 +20,9 @@
#include "Event.hpp"
#include "types.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Message.hpp"
-#include "ingen/URI.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/URI.hpp>
#include <memory>
diff --git a/src/server/FrameTimer.hpp b/src/server/FrameTimer.hpp
index 1f653f67..0078f99c 100644
--- a/src/server/FrameTimer.hpp
+++ b/src/server/FrameTimer.hpp
@@ -94,12 +94,12 @@ private:
const double b;
const double c;
- uint64_t nper = 0u;
+ uint64_t nper = 0U;
double e2 = 0.0;
double t0 = 0.0;
double t1 = 0.0;
- uint64_t n0 = 0u;
- uint64_t n1 = 0u;
+ uint64_t n0 = 0U;
+ uint64_t n1 = 0U;
bool initialized = false;
};
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index fedc5df8..9e44a4d4 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -28,20 +28,21 @@
#include "PortImpl.hpp"
#include "ThreadManager.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Forge.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Symbol.hpp>
#include <cassert>
#include <cstddef>
#include <map>
#include <memory>
-#include <type_traits>
+#include <string>
#include <unordered_map>
namespace ingen::server {
@@ -309,13 +310,15 @@ GraphImpl::has_arc(const PortImpl* tail, const PortImpl* dst_port) const
return (i != _graph_arcs.end());
}
-void
-GraphImpl::set_compiled_graph(raul::managed_ptr<CompiledGraph>&& cg)
+std::unique_ptr<CompiledGraph>
+GraphImpl::swap_compiled_graph(std::unique_ptr<CompiledGraph> cg)
{
if (_compiled_graph && _compiled_graph != cg) {
_engine.reset_load();
}
- _compiled_graph = std::move(cg);
+
+ _compiled_graph.swap(cg);
+ return cg;
}
uint32_t
@@ -329,7 +332,7 @@ bool
GraphImpl::has_port_with_index(uint32_t index) const
{
BufferFactory& bufs = *_engine.buffer_factory();
- const auto index_atom = bufs.forge().make(int32_t(index));
+ const auto index_atom = bufs.forge().make(static_cast<int32_t>(index));
for (const auto& p : _inputs) {
if (p.has_property(bufs.uris().lv2_index, index_atom)) {
diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp
index 1976fd4d..6c852106 100644
--- a/src/server/GraphImpl.hpp
+++ b/src/server/GraphImpl.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2023 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -23,10 +23,10 @@
#include "server.h"
#include "types.hpp"
-#include "ingen/Node.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Maid.hpp"
+#include <lv2/urid/urid.h>
+#include <raul/Maid.hpp>
+#include <boost/intrusive/options.hpp>
#include <boost/intrusive/slist.hpp>
#include <cassert>
@@ -38,10 +38,6 @@ namespace raul {
class Symbol;
} // namespace raul
-namespace boost::intrusive {
-template <bool Enabled> struct constant_time_size;
-} // namespace boost::intrusive
-
namespace ingen::server {
class ArcImpl;
@@ -101,9 +97,14 @@ public:
* Audio thread.
*
* \param ctx Process context
+ *
* \param bufs New set of buffers
- * \param poly Must be < the most recent value passed to prepare_internal_poly.
- * \param maid Any objects no longer needed will be pushed to this
+ *
+ * \param poly Must be < the most recent value passed to
+ * prepare_internal_poly.
+ *
+ * \param maid Any objects no longer needed will be
+ * pushed to this
*/
bool apply_internal_poly(RunContext& ctx,
BufferFactory& bufs,
@@ -180,7 +181,8 @@ public:
bool has_arc(const PortImpl* tail, const PortImpl* dst_port) const;
/** Set a new compiled graph to run, and return the old one. */
- void set_compiled_graph(raul::managed_ptr<CompiledGraph>&& cg);
+ [[nodiscard]] std::unique_ptr<CompiledGraph>
+ swap_compiled_graph(std::unique_ptr<CompiledGraph> cg);
const raul::managed_ptr<Ports>& external_ports() { return _ports; }
@@ -199,7 +201,7 @@ public:
Engine& engine() { return _engine; }
private:
- using CompiledGraphPtr = raul::managed_ptr<CompiledGraph>;
+ using CompiledGraphPtr = std::unique_ptr<CompiledGraph>;
Engine& _engine;
uint32_t _poly_pre; ///< Pre-process thread only
diff --git a/src/server/GraphPlugin.hpp b/src/server/GraphPlugin.hpp
index ac89c7a9..302141e7 100644
--- a/src/server/GraphPlugin.hpp
+++ b/src/server/GraphPlugin.hpp
@@ -19,10 +19,10 @@
#include "PluginImpl.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "lilv/lilv.h"
-#include "raul/Symbol.hpp"
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lilv/lilv.h>
+#include <raul/Symbol.hpp>
#include <string>
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index 4a464ea8..01622209 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -23,16 +23,18 @@
#include "BufferRef.hpp"
#include "GraphImpl.hpp"
#include "NodeImpl.hpp"
+#include "PortType.hpp"
#include "RunContext.hpp"
#include "mix.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <memory>
@@ -176,7 +178,7 @@ InputPort::pre_run(RunContext& ctx)
{
if ((_user_buffer || !_arcs.empty()) && !direct_connect()) {
const uint32_t src_poly = max_tail_poly(ctx);
- const uint32_t max_n_srcs = _arcs.size() * src_poly + 1;
+ const uint32_t max_n_srcs = (_arcs.size() * src_poly) + 1;
for (uint32_t v = 0; v < _poly; ++v) {
if (!buffer(v)->get<void>()) {
@@ -230,9 +232,7 @@ InputPort::next_value_offset(SampleCount offset, SampleCount end) const
for (const auto& arc : _arcs) {
const SampleCount o = arc.tail()->next_value_offset(offset, end);
- if (o < earliest) {
- earliest = o;
- }
+ earliest = std::min(o, earliest);
}
return earliest;
diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp
index 834a6d8a..f3c6e553 100644
--- a/src/server/InputPort.hpp
+++ b/src/server/InputPort.hpp
@@ -17,14 +17,14 @@
#ifndef INGEN_ENGINE_INPUTPORT_HPP
#define INGEN_ENGINE_INPUTPORT_HPP
-#include "ArcImpl.hpp" // IWYU pragma: keep
+#include "ArcImpl.hpp"
#include "PortImpl.hpp"
-#include "PortType.hpp"
#include "types.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Maid.hpp"
+#include <lv2/urid/urid.h>
+#include <raul/Maid.hpp>
+#include <boost/intrusive/options.hpp>
#include <boost/intrusive/slist.hpp>
#include <cstdint>
@@ -34,14 +34,10 @@ namespace raul {
class Symbol;
} // namespace raul
-namespace boost::intrusive {
-
-template <bool Enabled> struct constant_time_size;
-
-} // namespace boost::intrusive
-
namespace ingen {
+enum class PortType;
+
class Atom;
namespace server {
@@ -100,7 +96,7 @@ public:
/** Like `get_buffers`, but for the pre-process thread.
*
- * This uses the "current" number of arcs fromthe perspective of the
+ * This uses the "current" number of arcs from the perspective of the
* pre-process thread to allocate buffers for application of a
* connection/disconnection/etc in the next process cycle.
*/
diff --git a/src/server/InternalBlock.cpp b/src/server/InternalBlock.cpp
index 68e1f3e8..2eb0d411 100644
--- a/src/server/InternalBlock.cpp
+++ b/src/server/InternalBlock.cpp
@@ -23,8 +23,8 @@
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
-#include "ingen/URIs.hpp"
-#include "raul/Array.hpp"
+#include <ingen/URIs.hpp>
+#include <raul/Array.hpp>
#include <boost/smart_ptr/intrusive_ptr.hpp>
@@ -43,7 +43,6 @@ class Atom;
namespace server {
class GraphImpl;
-class RunContext;
InternalBlock::InternalBlock(PluginImpl* plugin,
const raul::Symbol& symbol,
diff --git a/src/server/InternalBlock.hpp b/src/server/InternalBlock.hpp
index 9db7325a..9eca9716 100644
--- a/src/server/InternalBlock.hpp
+++ b/src/server/InternalBlock.hpp
@@ -26,10 +26,8 @@ class Symbol;
namespace ingen::server {
-class Engine;
class GraphImpl;
class PluginImpl;
-class RunContext;
/** An internal Block implemented inside Ingen.
*
diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp
index e6535ab2..7670c931 100644
--- a/src/server/InternalPlugin.cpp
+++ b/src/server/InternalPlugin.cpp
@@ -24,7 +24,10 @@
#include "internals/Trigger.hpp"
#include "types.hpp"
-#include "ingen/URIs.hpp"
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lilv/lilv.h>
+#include <raul/Symbol.hpp>
#include <utility>
diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp
index 9dfabc5f..4d715491 100644
--- a/src/server/InternalPlugin.hpp
+++ b/src/server/InternalPlugin.hpp
@@ -19,9 +19,9 @@
#include "PluginImpl.hpp"
-#include "ingen/URI.hpp"
-#include "lilv/lilv.h"
-#include "raul/Symbol.hpp"
+#include <ingen/URI.hpp>
+#include <lilv/lilv.h>
+#include <raul/Symbol.hpp>
#define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#"
@@ -31,11 +31,6 @@ class URIs;
namespace server {
-class BlockImpl;
-class BufferFactory;
-class Engine;
-class GraphImpl;
-
/** Implementation of an Internal plugin.
*/
class InternalPlugin : public PluginImpl
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index eafa0fa7..e508c850 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -21,6 +21,7 @@
#include "BufferRef.hpp"
#include "DuplexPort.hpp"
#include "Engine.hpp"
+#include "FrameTimer.hpp"
#include "GraphImpl.hpp"
#include "PortType.hpp"
#include "RunContext.hpp"
@@ -28,19 +29,21 @@
#include "ingen_config.h"
#include "util.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIMap.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/forge.h"
-#include "lv2/atom/util.h"
-#include "raul/Path.hpp"
-
+#include <ingen/Atom.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIMap.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/forge.h>
+#include <lv2/atom/util.h>
+#include <raul/Path.hpp>
+#include <raul/Semaphore.hpp>
+
+#include <jack/jack.h>
#include <jack/midiport.h>
#include <jack/transport.h>
@@ -51,6 +54,7 @@
#include <cassert>
#include <chrono>
+#include <cstdint>
#include <map>
#include <string>
#include <utility>
@@ -108,7 +112,8 @@ JackDriver::attach(const std::string& server_name,
_sample_rate = jack_get_sample_rate(_client);
_block_length = jack_get_buffer_size(_client);
- _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE);
+ _seq_size = static_cast<uint32_t>(
+ jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE));
_fallback_buffer = AudioBufPtr(
static_cast<float*>(
@@ -123,6 +128,8 @@ JackDriver::attach(const std::string& server_name,
register_port(p);
}
+ _timer = std::make_unique<FrameTimer>(_block_length, _sample_rate);
+
return true;
}
@@ -256,14 +263,14 @@ void
JackDriver::rename_port(const raul::Path& old_path,
const raul::Path& new_path)
{
- EnginePort* eport = get_port(old_path);
+ const EnginePort* eport = get_port(old_path);
if (eport) {
#if USE_JACK_PORT_RENAME
jack_port_rename(_client,
static_cast<jack_port_t*>(eport->handle()),
new_path.substr(1).c_str());
#else
- jack_port_set_name((jack_port_t*)eport->handle(),
+ jack_port_set_name(static_cast<jack_port_t*>(eport->handle()),
new_path.substr(1).c_str());
#endif
}
@@ -456,6 +463,12 @@ JackDriver::append_time_events(RunContext& ctx, Buffer& buffer)
static_cast<const uint8_t*>(LV2_ATOM_BODY_CONST(lpos)));
}
+SampleCount
+JackDriver::frame_time() const
+{
+ return _timer->frame_time(_engine.current_time()) + _engine.block_length();
+}
+
/**** Jack Callbacks ****/
/** Jack process callback, drives entire audio thread.
@@ -478,6 +491,7 @@ JackDriver::_process_cb(jack_nframes_t nframes)
_transport_state = jack_transport_query(_client, &_position);
+ _timer->update(_engine.current_time(), start_of_current_cycle - _engine.block_length());
_engine.locate(start_of_current_cycle, nframes);
// Read input
@@ -519,14 +533,19 @@ JackDriver::_shutdown_cb()
int
JackDriver::_block_length_cb(jack_nframes_t nframes)
{
+ const URIs& uris = _engine.world().uris();
+
if (_engine.root_graph()) {
_block_length = nframes;
- _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE);
+ _seq_size = static_cast<uint32_t>(
+ jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE));
_engine.root_graph()->set_buffer_size(
- _engine.run_context(), *_engine.buffer_factory(), PortType::AUDIO,
+ _engine.run_context(), *_engine.buffer_factory(),
+ uris.atom_Sound,
_engine.buffer_factory()->audio_buffer_size(nframes));
_engine.root_graph()->set_buffer_size(
- _engine.run_context(), *_engine.buffer_factory(), PortType::ATOM,
+ _engine.run_context(), *_engine.buffer_factory(),
+ uris.atom_Sequence,
_seq_size);
}
return 0;
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index 8bb7cff3..4c8e779e 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -18,43 +18,35 @@
#define INGEN_ENGINE_JACKAUDIODRIVER_HPP
#include "Driver.hpp"
-#include "EnginePort.hpp" // IWYU pragma: keep
+#include "EnginePort.hpp"
#include "types.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/memory.hpp" // IWYU pragma: keep
-#include "lv2/atom/forge.h"
-#include "raul/Semaphore.hpp"
+#include <ingen/URI.hpp>
+#include <ingen/memory.hpp>
+#include <lv2/atom/forge.h>
+#include <raul/Semaphore.hpp>
+#include <boost/intrusive/options.hpp>
#include <boost/intrusive/slist.hpp>
-#include <jack/jack.h>
-#include <jack/thread.h>
+#include <jack/transport.h> // IWYU pragma: keep
#include <jack/types.h>
+#include <jack/thread.h>
+
#include <atomic>
-#include <cstddef>
#include <cstdint>
#include <exception>
#include <memory>
#include <string>
-namespace raul {
-class Path;
-} // namespace raul
-
-namespace boost::intrusive {
-template <bool Enabled> struct cache_last;
-} // namespace boost::intrusive
-
namespace ingen {
class Atom;
namespace server {
-class Buffer;
-class DuplexPort;
class Engine;
+class FrameTimer;
class RunContext;
/** The Jack Driver.
@@ -103,12 +95,10 @@ public:
jack_client_t* jack_client() const { return _client; }
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
- SampleCount frame_time() const override {
- return _client ? jack_frame_time(_client) : 0;
- }
+ SampleCount frame_time() const override;
class PortRegistrationFailedException : public std::exception
{};
@@ -121,7 +111,7 @@ private:
// Static JACK callbacks which call the non-static callbacks (methods)
static void shutdown_cb(void* const jack_driver) {
- return static_cast<JackDriver*>(jack_driver)->_shutdown_cb();
+ static_cast<JackDriver*>(jack_driver)->_shutdown_cb();
}
static int process_cb(jack_nframes_t nframes, void* const jack_driver) {
@@ -152,23 +142,24 @@ protected:
using AudioBufPtr = std::unique_ptr<float, FreeDeleter<float>>;
- Engine& _engine;
- Ports _ports;
- AudioBufPtr _fallback_buffer;
- LV2_Atom_Forge _forge;
- raul::Semaphore _sem{0};
- std::atomic<bool> _flag{false};
- jack_client_t* _client{nullptr};
- jack_nframes_t _block_length{0};
- size_t _seq_size{0};
- jack_nframes_t _sample_rate{0};
- uint32_t _midi_event_type;
- bool _is_activated{false};
- jack_position_t _position{};
- jack_transport_state_t _transport_state{};
- double _old_bpm{120.0};
- jack_nframes_t _old_frame{0};
- bool _old_rolling{false};
+ Engine& _engine;
+ Ports _ports;
+ AudioBufPtr _fallback_buffer;
+ LV2_Atom_Forge _forge;
+ raul::Semaphore _sem{0};
+ std::unique_ptr<FrameTimer> _timer;
+ std::atomic<bool> _flag{false};
+ jack_client_t* _client{nullptr};
+ jack_nframes_t _block_length{0};
+ uint32_t _seq_size{0};
+ jack_nframes_t _sample_rate{0};
+ uint32_t _midi_event_type;
+ bool _is_activated{false};
+ jack_position_t _position{};
+ jack_transport_state_t _transport_state{};
+ double _old_bpm{120.0};
+ jack_nframes_t _old_frame{0};
+ bool _old_rolling{false};
};
} // namespace server
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 6dac1eec..ad7b28ae 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -28,24 +28,27 @@
#include "RunContext.hpp"
#include "Worker.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/FilePath.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIMap.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/core/lv2.h"
-#include "lv2/options/options.h"
-#include "lv2/state/state.h"
-#include "lv2/urid/urid.h"
-#include "lv2/worker/worker.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/FilePath.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/LV2Features.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIMap.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lilv/lilv.h>
+#include <lv2/core/lv2.h>
+#include <lv2/options/options.h>
+#include <lv2/state/state.h>
+#include <lv2/urid/urid.h>
+#include <lv2/worker/worker.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
+#include <raul/Symbol.hpp>
#include <algorithm>
#include <cassert>
@@ -53,6 +56,7 @@
#include <cstdint>
#include <map>
#include <memory>
+#include <optional>
#include <string>
#include <utility>
@@ -109,7 +113,7 @@ LV2Block::make_instance(URIs& uris,
}
for (uint32_t p = 0; p < num_ports(); ++p) {
- PortImpl* const port = _ports->at(p);
+ const PortImpl* const port = _ports->at(p);
Buffer* const buffer = (preparing)
? port->prepared_buffer(voice).get()
: port->buffer(voice).get();
@@ -222,7 +226,7 @@ LV2Block::apply_poly(RunContext& ctx, uint32_t poly)
/** Instantiate self from LV2 plugin descriptor.
*
- * Implemented as a seperate function (rather than in the constructor) to
+ * Implemented as a separate function (rather than in the constructor) to
* allow graceful error-catching of broken plugins.
*
* Returns whether or not plugin was successfully instantiated. If return
@@ -349,7 +353,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
LILV_FOREACH (nodes, i, sizes) {
const LilvNode* d = lilv_nodes_get(sizes, i);
if (lilv_node_is_int(d)) {
- uint32_t size_val = lilv_node_as_int(d);
+ const uint32_t size_val = lilv_node_as_int(d);
port_buffer_size = std::max(port_buffer_size, size_val);
}
}
@@ -481,7 +485,7 @@ LV2Block::save_state(const FilePath& dir) const
World& world = _lv2_plugin->world();
LilvWorld* lworld = world.lilv_world();
- StatePtr state{
+ const StatePtr state{
lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
const_cast<LV2Block*>(this)->instance(0),
&world.uri_map().urid_map(),
@@ -521,7 +525,7 @@ LV2Block::duplicate(Engine& engine,
const SampleRate rate = engine.sample_rate();
// Get current state
- StatePtr state{
+ const StatePtr state{
lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
instance(0),
&engine.world().uri_map().urid_map(),
@@ -589,10 +593,10 @@ LV2_Worker_Status
LV2Block::work(uint32_t size, const void* data)
{
if (_worker_iface) {
- std::lock_guard<std::mutex> lock(_work_mutex);
+ const std::lock_guard<std::mutex> lock{_work_mutex};
- LV2_Handle inst = lilv_instance_get_handle(instance(0));
- LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data);
+ LV2_Handle inst = lilv_instance_get_handle(instance(0));
+ const LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data);
if (st) {
parent_graph()->engine().log().error(
"Error calling %1% work method\n", _path);
@@ -692,8 +696,8 @@ get_port_value(const char* port_symbol,
uint32_t* size,
uint32_t* type)
{
- auto* const block = static_cast<LV2Block*>(user_data);
- auto* const port = block->port_by_symbol(port_symbol);
+ auto* const block = static_cast<LV2Block*>(user_data);
+ const auto* const port = block->port_by_symbol(port_symbol);
if (port && port->is_input() && port->value().is_valid()) {
*size = port->value().size();
@@ -717,17 +721,17 @@ LV2Block::save_preset(const URI& uri,
const FilePath dirname = path.parent_path();
const FilePath basename = path.stem();
- StatePtr state{lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
- instance(0),
- lmap,
- nullptr,
- nullptr,
- nullptr,
- path.c_str(),
- get_port_value,
- this,
- LV2_STATE_IS_NATIVE,
- nullptr)};
+ const StatePtr state{lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
+ instance(0),
+ lmap,
+ nullptr,
+ nullptr,
+ nullptr,
+ path.c_str(),
+ get_port_value,
+ this,
+ LV2_STATE_IS_NATIVE,
+ nullptr)};
if (state) {
const auto l = props.find(_uris.rdfs_label);
diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp
index fd446106..78b5ffac 100644
--- a/src/server/LV2Block.hpp
+++ b/src/server/LV2Block.hpp
@@ -22,15 +22,14 @@
#include "State.hpp"
#include "types.hpp"
-#include "ingen/LV2Features.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/URI.hpp"
-#include "lilv/lilv.h"
-#include "lv2/worker/worker.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Noncopyable.hpp"
-
+#include <ingen/LV2Features.hpp>
+#include <lilv/lilv.h>
+#include <lv2/worker/worker.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Noncopyable.hpp>
+
+#include <boost/intrusive/options.hpp>
#include <boost/intrusive/slist.hpp>
#include <boost/intrusive/slist_hook.hpp>
@@ -40,36 +39,21 @@
#include <filesystem>
#include <memory>
#include <mutex>
-#include <optional>
namespace raul {
class Symbol;
} // namespace raul
-namespace boost::intrusive {
-
-template <bool Enabled>
-struct cache_last;
-
-template <bool Enabled>
-struct constant_time_size;
-
-} // namespace boost::intrusive
-
namespace ingen {
-class Resource;
class URIs;
class World;
namespace server {
class BufferFactory;
-class Engine;
class GraphImpl;
class LV2Plugin;
-class RunContext;
-class Worker;
/** An instance of a LV2 plugin.
*
@@ -133,7 +117,7 @@ protected:
std::shared_ptr<Instance>
make_instance(URIs& uris, SampleRate rate, uint32_t voice, bool preparing);
- inline LilvInstance* instance(uint32_t voice) {
+ LilvInstance* instance(uint32_t voice) {
return static_cast<LilvInstance*>((*_instances)[voice]->instance);
}
diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp
index 02824be6..b1b57429 100644
--- a/src/server/LV2Options.hpp
+++ b/src/server/LV2Options.hpp
@@ -17,10 +17,10 @@
#ifndef INGEN_ENGINE_LV2OPTIONS_HPP
#define INGEN_ENGINE_LV2OPTIONS_HPP
-#include "ingen/LV2Features.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/core/lv2.h"
-#include "lv2/options/options.h"
+#include <ingen/LV2Features.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/core/lv2.h>
+#include <lv2/options/options.h>
#include <cstdint>
#include <cstdlib>
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 25ae9294..87072ab0 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -19,10 +19,13 @@
#include "Engine.hpp"
#include "LV2Block.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
+#include <ingen/Forge.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lilv/lilv.h>
+#include <raul/Symbol.hpp>
#include <cstdlib>
#include <string>
@@ -69,18 +72,18 @@ LV2Plugin::symbol() const
{
std::string working = uri();
if (working.back() == '/') {
- working = working.substr(0, working.length() - 1);
+ working.resize(working.length() - 1);
}
- while (working.length() > 0) {
- size_t last_slash = working.find_last_of('/');
+ while (!working.empty()) {
+ const size_t last_slash = working.find_last_of('/');
const std::string symbol = working.substr(last_slash+1);
if ( (symbol[0] >= 'a' && symbol[0] <= 'z')
|| (symbol[0] >= 'A' && symbol[0] <= 'Z') ) {
return raul::Symbol::symbolify(symbol);
}
- working = working.substr(0, last_slash);
+ working.resize(last_slash);
}
return raul::Symbol("lv2_symbol");
diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp
index fa007327..c94e88f7 100644
--- a/src/server/LV2Plugin.hpp
+++ b/src/server/LV2Plugin.hpp
@@ -19,9 +19,8 @@
#include "PluginImpl.hpp"
-#include "ingen/URI.hpp"
-#include "lilv/lilv.h"
-#include "raul/Symbol.hpp"
+#include <ingen/URI.hpp>
+#include <lilv/lilv.h>
namespace ingen {
@@ -29,11 +28,6 @@ class World;
namespace server {
-class BlockImpl;
-class BufferFactory;
-class Engine;
-class GraphImpl;
-
/** Implementation of an LV2 plugin (loaded shared library).
*/
class LV2Plugin : public PluginImpl
diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp
index 485695d7..66720e0d 100644
--- a/src/server/LV2ResizeFeature.hpp
+++ b/src/server/LV2ResizeFeature.hpp
@@ -21,8 +21,8 @@
#include "Buffer.hpp"
#include "PortImpl.hpp"
-#include "ingen/LV2Features.hpp"
-#include "lv2/resize-port/resize-port.h"
+#include <ingen/LV2Features.hpp>
+#include <lv2/resize-port/resize-port.h>
#include <memory>
diff --git a/src/server/Load.hpp b/src/server/Load.hpp
index c2f1f3df..a5216f7e 100644
--- a/src/server/Load.hpp
+++ b/src/server/Load.hpp
@@ -38,8 +38,8 @@ struct Load {
mean = load;
changed = true;
} else {
- const float a = mean + (static_cast<float>(load) - mean) /
- static_cast<float>(++n);
+ const float a = mean + ((static_cast<float>(load) - mean) /
+ static_cast<float>(++n));
if (a != mean) {
changed = floorf(a) != floorf(mean);
diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp
index c76c66d4..e820a44e 100644
--- a/src/server/NodeImpl.cpp
+++ b/src/server/NodeImpl.cpp
@@ -20,9 +20,10 @@
#include "GraphImpl.hpp"
#include "ThreadManager.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Properties.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <raul/Path.hpp>
#include <map>
#include <utility>
diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp
index 8acce161..fcf2f57f 100644
--- a/src/server/NodeImpl.hpp
+++ b/src/server/NodeImpl.hpp
@@ -17,17 +17,15 @@
#ifndef INGEN_ENGINE_NODEIMPL_HPP
#define INGEN_ENGINE_NODEIMPL_HPP
-#include "ingen/Node.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Node.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Path.hpp>
+#include <raul/Symbol.hpp>
#include <cstdint>
namespace ingen {
-class Atom;
class URIs;
namespace server {
diff --git a/src/server/OutputPort.hpp b/src/server/OutputPort.hpp
index 61fb44f5..b19cd361 100644
--- a/src/server/OutputPort.hpp
+++ b/src/server/OutputPort.hpp
@@ -20,7 +20,7 @@
#include "PortImpl.hpp"
#include "PortType.hpp"
-#include "lv2/urid/urid.h"
+#include <lv2/urid/urid.h>
#include <cstddef>
#include <cstdint>
diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp
index 3184be11..8e3642c0 100644
--- a/src/server/PluginImpl.hpp
+++ b/src/server/PluginImpl.hpp
@@ -17,11 +17,11 @@
#ifndef INGEN_ENGINE_PLUGINIMPL_HPP
#define INGEN_ENGINE_PLUGINIMPL_HPP
-#include "ingen/Atom.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/URI.hpp"
-#include "lilv/lilv.h"
-#include "raul/Symbol.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/URI.hpp>
+#include <lilv/lilv.h>
+#include <raul/Symbol.hpp>
#include <map>
#include <string>
diff --git a/src/server/PortAudioDriver.cpp b/src/server/PortAudioDriver.cpp
index 11bca592..ef893478 100644
--- a/src/server/PortAudioDriver.cpp
+++ b/src/server/PortAudioDriver.cpp
@@ -21,11 +21,12 @@
#include "FrameTimer.hpp"
#include "PortType.hpp"
#include "RunContext.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "raul/Path.hpp"
+
+#include <ingen/Atom.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <raul/Path.hpp>
#include <portaudio.h>
diff --git a/src/server/PortAudioDriver.hpp b/src/server/PortAudioDriver.hpp
index 9f17a100..6c7bfb9e 100644
--- a/src/server/PortAudioDriver.hpp
+++ b/src/server/PortAudioDriver.hpp
@@ -18,39 +18,21 @@
#define INGEN_ENGINE_PORTAUDIODRIVER_HPP
#include "Driver.hpp"
-#include "EnginePort.hpp" // IWYU pragma: keep
+#include "EnginePort.hpp"
#include "types.hpp"
-#include "ingen/URI.hpp"
-#include "raul/Semaphore.hpp"
+#include <raul/Semaphore.hpp>
+#include <boost/intrusive/options.hpp>
#include <boost/intrusive/slist.hpp>
#include <portaudio.h>
#include <atomic>
-#include <cstddef>
#include <cstdint>
#include <memory>
-namespace raul {
-class Path;
-} // namespace raul
+namespace ingen::server {
-namespace boost::intrusive {
-
-template <bool Enabled>
-struct cache_last;
-
-} // namespace boost::intrusive
-
-namespace ingen {
-
-class Atom;
-
-namespace server {
-
-class Buffer;
-class DuplexPort;
class Engine;
class FrameTimer;
class RunContext;
@@ -83,7 +65,7 @@ public:
int real_time_priority() override { return 80; }
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
private:
@@ -124,19 +106,18 @@ protected:
Ports _ports;
PaStreamParameters _inputParameters;
PaStreamParameters _outputParameters;
- raul::Semaphore _sem{0};
+ raul::Semaphore _sem{0U};
std::unique_ptr<FrameTimer> _timer;
PaStream* _stream{nullptr};
- size_t _seq_size{4096};
+ uint32_t _seq_size{4096U};
uint32_t _block_length;
- uint32_t _sample_rate{48000};
- uint32_t _n_inputs{0};
- uint32_t _n_outputs{0};
+ uint32_t _sample_rate{48000U};
+ uint32_t _n_inputs{0U};
+ uint32_t _n_outputs{0U};
std::atomic<bool> _flag{false};
bool _is_activated{false};
};
-} // namespace server
-} // namespace ingen
+} // namespace ingen::server
#endif // INGEN_ENGINE_PORTAUDIODRIVER_HPP
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 307d9b73..f6eed11f 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -23,15 +23,17 @@
#include "PortType.hpp"
#include "ThreadManager.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
#include <algorithm>
#include <cassert>
@@ -135,13 +137,13 @@ PortImpl::set_type(PortType port_type, LV2_URID buffer_type)
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(port_type)));
// Update audio thread types
_type = port_type;
_buffer_type = buffer_type;
if (!_buffer_type) {
- switch (_type.id()) {
+ switch (_type) {
case PortType::CONTROL:
_buffer_type = uris.atom_Float;
break;
@@ -237,7 +239,7 @@ PortImpl::set_voice_value(const RunContext& ctx,
FrameTime time,
Sample value)
{
- switch (_type.id()) {
+ switch (_type) {
case PortType::CONTROL:
if (buffer(voice)->value()) {
const_cast<LV2_Atom_Float*>(
@@ -289,9 +291,9 @@ PortImpl::set_voice_value(const RunContext& ctx,
void
PortImpl::update_set_state(const RunContext& ctx, uint32_t v)
{
- Voice& voice = _voices->at(v);
- SetState& state = voice.set_state;
- BufferRef buf = voice.buffer;
+ Voice& voice = _voices->at(v);
+ SetState& state = voice.set_state;
+ const BufferRef buf = voice.buffer;
switch (state.state) {
case SetState::State::SET:
break;
@@ -419,7 +421,7 @@ PortImpl::set_is_driver_port(BufferFactory&)
void
PortImpl::clear_buffers(const RunContext& ctx)
{
- switch (_type.id()) {
+ switch (_type) {
case PortType::AUDIO:
default:
for (uint32_t v = 0; v < _poly; ++v) {
@@ -452,17 +454,17 @@ PortImpl::monitor(RunContext& ctx, bool send_now)
_frames_since_monitor += ctx.nframes();
const bool time_to_send = send_now || _frames_since_monitor >= period;
- const bool is_sequence = (_type.id() == PortType::ATOM &&
+ const bool is_sequence = (_type == PortType::ATOM &&
_buffer_type == _bufs.uris().atom_Sequence);
if (!time_to_send && !(is_sequence && _monitored) && (!is_sequence && buffer(0)->value())) {
return;
}
- Forge& forge = ctx.engine().world().forge();
- URIs& uris = ctx.engine().world().uris();
- LV2_URID key = 0;
- float val = 0.0f;
- switch (_type.id()) {
+ const Forge& forge = ctx.engine().world().forge();
+ const URIs& uris = ctx.engine().world().uris();
+ LV2_URID key = 0;
+ float val = 0.0f;
+ switch (_type) {
case PortType::UNKNOWN:
break;
case PortType::AUDIO:
@@ -535,9 +537,7 @@ PortImpl::next_value_offset(SampleCount offset, SampleCount end) const
SampleCount earliest = end;
for (uint32_t v = 0; v < _poly; ++v) {
const SampleCount o = _voices->at(v).buffer->next_value_offset(offset, end);
- if (o < earliest) {
- earliest = o;
- }
+ earliest = std::min(o, earliest);
}
return earliest;
}
diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp
index 07904cff..c202d4a0 100644
--- a/src/server/PortImpl.hpp
+++ b/src/server/PortImpl.hpp
@@ -20,17 +20,15 @@
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
#include "NodeImpl.hpp"
-#include "PortType.hpp"
#include "RunContext.hpp"
#include "server.h"
#include "types.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/urid/urid.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
#include <atomic>
#include <cstdint>
@@ -43,6 +41,8 @@ class Symbol;
namespace ingen {
+enum class PortType;
+
class Properties;
namespace server {
diff --git a/src/server/PortType.hpp b/src/server/PortType.hpp
index 65f87d02..294c056a 100644
--- a/src/server/PortType.hpp
+++ b/src/server/PortType.hpp
@@ -14,81 +14,60 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef INGEN_INTERFACE_PORTTYPE_HPP
-#define INGEN_INTERFACE_PORTTYPE_HPP
+#ifndef INGEN_ENGINE_PORTTYPE_HPP
+#define INGEN_ENGINE_PORTTYPE_HPP
-#include "ingen/URI.hpp"
-
-#include "lv2/atom/atom.h"
-#include "lv2/core/lv2.h"
-
-#include <cassert>
+#include <ingen/URI.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/core/lv2.h>
namespace ingen {
-/** The type of a port.
- *
- * This type refers to the type of the port itself (not necessarily the type
- * of its contents). Ports with different types can contain the same type of
- * data, but may e.g. have different access semantics.
- */
-class PortType
-{
-public:
- enum ID {
- UNKNOWN = 0,
- AUDIO = 1,
- CONTROL = 2,
- CV = 3,
- ATOM = 4
- };
+/// The type of a port
+enum class PortType {
+ UNKNOWN,
+ AUDIO,
+ CONTROL,
+ CV,
+ ATOM,
+};
- explicit PortType(const URI& uri)
- : _id(UNKNOWN)
- {
- if (uri == type_uri(AUDIO)) {
- _id = AUDIO;
- } else if (uri == type_uri(CONTROL)) {
- _id = CONTROL;
- } else if (uri == type_uri(CV)) {
- _id = CV;
- } else if (uri == type_uri(ATOM)) {
- _id = ATOM;
- }
+/// Return the URI for `port_type`
+inline URI
+port_type_uri(const PortType port_type)
+{
+ switch (port_type) {
+ case PortType::UNKNOWN:
+ break;
+ case PortType::AUDIO:
+ return URI{LV2_CORE__AudioPort};
+ case PortType::CONTROL:
+ return URI{LV2_CORE__ControlPort};
+ case PortType::CV:
+ return URI{LV2_CORE__CVPort};
+ case PortType::ATOM:
+ return URI{LV2_ATOM__AtomPort};
}
- PortType(ID id) noexcept : _id(id) {}
-
- const URI& uri() const { return type_uri(_id); }
- ID id() const { return _id; }
+ return URI{"http://www.w3.org/2002/07/owl#Nothing"};
+}
- bool operator==(const ID& id) const { return (_id == id); }
- bool operator!=(const ID& id) const { return (_id != id); }
- bool operator==(const PortType& type) const { return (_id == type._id); }
- bool operator!=(const PortType& type) const { return (_id != type._id); }
- bool operator<(const PortType& type) const { return (_id < type._id); }
-
- bool is_audio() { return _id == AUDIO; }
- bool is_control() { return _id == CONTROL; }
- bool is_cv() { return _id == CV; }
- bool is_atom() { return _id == ATOM; }
-
-private:
- static const URI& type_uri(unsigned id_num) {
- assert(id_num <= ATOM);
- static const URI uris[] = {
- URI("http://www.w3.org/2002/07/owl#Nothing"),
- URI(LV2_CORE__AudioPort),
- URI(LV2_CORE__ControlPort),
- URI(LV2_CORE__CVPort),
- URI(LV2_ATOM__AtomPort)
- };
- return uris[id_num];
- }
-
- ID _id;
-};
+/// Return the type with the given `uri`, or #PortType::UNKNOWN
+inline PortType
+port_type_from_uri(const URI& uri)
+{
+ static const URI lv2_AudioPort = URI{LV2_CORE__AudioPort};
+ static const URI lv2_ControlPort = URI{LV2_CORE__ControlPort};
+ static const URI lv2_CVPort = URI{LV2_CORE__CVPort};
+ static const URI atom_AtomPort = URI{LV2_ATOM__AtomPort};
+
+ return (uri == lv2_AudioPort) ? PortType::AUDIO
+ : (uri == lv2_ControlPort) ? PortType::CONTROL
+ : (uri == lv2_CVPort) ? PortType::CV
+ : (uri == atom_AtomPort) ? PortType::ATOM
+ : PortType::UNKNOWN;
+}
} // namespace ingen
-#endif // INGEN_INTERFACE_PORTTYPE_HPP
+#endif // INGEN_ENGINE_PORTTYPE_HPP
diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp
index a97fc451..4c071ecd 100644
--- a/src/server/PostProcessor.cpp
+++ b/src/server/PostProcessor.cpp
@@ -23,8 +23,6 @@
namespace ingen::server {
-class PreProcessContext;
-
class Sentinel : public Event
{
public:
diff --git a/src/server/PreProcessContext.hpp b/src/server/PreProcessContext.hpp
index 79e8ca68..7c97af3c 100644
--- a/src/server/PreProcessContext.hpp
+++ b/src/server/PreProcessContext.hpp
@@ -20,8 +20,7 @@
#include "CompiledGraph.hpp"
#include "GraphImpl.hpp"
-#include "raul/Maid.hpp"
-
+#include <memory>
#include <unordered_set>
namespace ingen::server {
@@ -64,13 +63,9 @@ public:
* This may return null when an atomic bundle is deferring compilation, in
* which case the graph is flagged as dirty for later compilation.
*/
- raul::Maid::managed_ptr<CompiledGraph>
- maybe_compile(raul::Maid& maid, GraphImpl& graph)
+ [[nodiscard]] std::unique_ptr<CompiledGraph> maybe_compile(GraphImpl& graph)
{
- if (must_compile(graph)) {
- return compile(maid, graph);
- }
- return nullptr;
+ return must_compile(graph) ? compile(graph) : nullptr;
}
/** Return all graphs that require compilation after an atomic bundle. */
diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp
index 5d719761..b3bad0b2 100644
--- a/src/server/PreProcessor.cpp
+++ b/src/server/PreProcessor.cpp
@@ -24,15 +24,17 @@
#include "ThreadManager.hpp"
#include "UndoStack.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/AtomWriter.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/World.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/AtomWriter.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/World.hpp>
+#include <raul/Semaphore.hpp>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <memory>
+#include <string>
namespace ingen::server {
@@ -55,7 +57,7 @@ PreProcessor::event(Event* const ev, Event::Mode mode)
{
// TODO: Probably possible to make this lock-free with CAS
ThreadManager::assert_not_thread(THREAD_IS_REAL_TIME);
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
assert(!ev->is_prepared());
assert(!ev->next());
@@ -63,7 +65,7 @@ PreProcessor::event(Event* const ev, Event::Mode mode)
/* Note that tail is only used here, not in process(). The head must be
checked first here, since if it is null the tail pointer is junk. */
- Event* const head = _head.load();
+ const Event* const head = _head.load();
if (!head) {
_head = ev;
_tail = ev;
@@ -140,7 +142,7 @@ PreProcessor::process(RunContext& ctx, PostProcessor& dest, size_t limit)
if (n_processed > 0) {
#ifndef NDEBUG
- Engine& engine = ctx.engine();
+ const Engine& engine = ctx.engine();
if (engine.world().conf().option("trace").get<int32_t>()) {
const uint64_t start = engine.cycle_start_time(ctx);
const uint64_t end = engine.current_time();
@@ -149,7 +151,7 @@ PreProcessor::process(RunContext& ctx, PostProcessor& dest, size_t limit)
}
#endif
- auto* next = static_cast<Event*>(last->next());
+ auto* next = last->next();
last->next(nullptr);
dest.append(ctx, head, last);
@@ -241,7 +243,7 @@ PreProcessor::run()
wait_for_block_state(BlockState::UNBLOCKED);
}
- back = static_cast<Event*>(ev->next());
+ back = ev->next();
}
}
diff --git a/src/server/PreProcessor.hpp b/src/server/PreProcessor.hpp
index e0b0cc4a..03ba5dd7 100644
--- a/src/server/PreProcessor.hpp
+++ b/src/server/PreProcessor.hpp
@@ -19,7 +19,7 @@
#include "Event.hpp"
-#include "raul/Semaphore.hpp"
+#include <raul/Semaphore.hpp>
#include <atomic>
#include <chrono>
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index 2bac3140..29985ccf 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -22,15 +22,15 @@
#include "PortImpl.hpp"
#include "Task.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIMap.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/RingBuffer.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIMap.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/urid/urid.h>
+#include <raul/RingBuffer.hpp>
#include <cerrno>
#include <cstring>
@@ -160,9 +160,9 @@ void
RunContext::set_priority(int priority)
{
if (_thread) {
- pthread_t pthread = _thread->native_handle();
- const int policy = (priority > 0) ? SCHED_FIFO : SCHED_OTHER;
- sched_param sp{};
+ const pthread_t pthread = _thread->native_handle();
+ const int policy = (priority > 0) ? SCHED_FIFO : SCHED_OTHER;
+ sched_param sp{};
sp.sched_priority = (priority > 0) ? priority : 0;
if (pthread_setschedparam(pthread, policy, &sp)) {
_engine.log().error(
diff --git a/src/server/RunContext.hpp b/src/server/RunContext.hpp
index a91a3e17..44304c5e 100644
--- a/src/server/RunContext.hpp
+++ b/src/server/RunContext.hpp
@@ -19,8 +19,8 @@
#include "types.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/RingBuffer.hpp"
+#include <lv2/urid/urid.h>
+#include <raul/RingBuffer.hpp>
#include <cstdint>
#include <memory>
diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp
index 075d78cc..fb961ee2 100644
--- a/src/server/SocketListener.cpp
+++ b/src/server/SocketListener.cpp
@@ -19,15 +19,16 @@
#include "Engine.hpp"
#include "SocketServer.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/World.hpp"
-#include "raul/Socket.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/World.hpp>
+#include <raul/Socket.hpp>
#include <poll.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#include <cerrno>
diff --git a/src/server/SocketListener.hpp b/src/server/SocketListener.hpp
index 65df5af5..a96105ef 100644
--- a/src/server/SocketListener.hpp
+++ b/src/server/SocketListener.hpp
@@ -14,7 +14,7 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "raul/Socket.hpp"
+#include <raul/Socket.hpp>
#include <memory>
#include <thread>
@@ -27,7 +27,7 @@ class Engine;
class SocketListener
{
public:
- SocketListener(Engine& engine);
+ explicit SocketListener(Engine& engine);
~SocketListener();
private:
diff --git a/src/server/SocketServer.hpp b/src/server/SocketServer.hpp
index 92bab5eb..608d180d 100644
--- a/src/server/SocketServer.hpp
+++ b/src/server/SocketServer.hpp
@@ -21,17 +21,17 @@
#include "Engine.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/ColorContext.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/SocketReader.hpp"
-#include "ingen/SocketWriter.hpp"
-#include "ingen/StreamWriter.hpp"
-#include "ingen/Tee.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/World.hpp"
-#include "raul/Socket.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/ColorContext.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/SocketReader.hpp>
+#include <ingen/SocketWriter.hpp>
+#include <ingen/StreamWriter.hpp>
+#include <ingen/Tee.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/World.hpp>
+#include <raul/Socket.hpp>
#include <cstdint>
#include <cstdio>
diff --git a/src/server/State.hpp b/src/server/State.hpp
index 673b175b..976cf67d 100644
--- a/src/server/State.hpp
+++ b/src/server/State.hpp
@@ -17,7 +17,7 @@
#ifndef INGEN_ENGINE_STATE_HPP
#define INGEN_ENGINE_STATE_HPP
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <memory>
diff --git a/src/server/Task.cpp b/src/server/Task.cpp
index 2b8ff0cd..345a4711 100644
--- a/src/server/Task.cpp
+++ b/src/server/Task.cpp
@@ -19,7 +19,7 @@
#include "BlockImpl.hpp"
#include "RunContext.hpp"
-#include "raul/Path.hpp"
+#include <raul/Path.hpp>
#include <cstddef>
#include <memory>
diff --git a/src/server/Task.hpp b/src/server/Task.hpp
index e64d888c..f2141bd5 100644
--- a/src/server/Task.hpp
+++ b/src/server/Task.hpp
@@ -17,7 +17,6 @@
#ifndef INGEN_ENGINE_TASK_HPP
#define INGEN_ENGINE_TASK_HPP
-#include <algorithm>
#include <atomic>
#include <cassert>
#include <deque>
@@ -40,13 +39,15 @@ public:
PARALLEL ///< Elements may be run in any order in parallel
};
- Task(Mode mode, BlockImpl* block = nullptr)
+ Task(Mode mode, BlockImpl* block)
: _block(block)
, _mode(mode)
{
- assert(!(mode == Mode::SINGLE && !block));
+ assert(mode != Mode::SINGLE || block);
}
+ explicit Task(Mode mode) : Task{mode, nullptr} {}
+
Task(const Task&) = delete;
Task& operator=(const Task&) = delete;
diff --git a/src/server/ThreadManager.hpp b/src/server/ThreadManager.hpp
index 07a01c2b..2e0ad966 100644
--- a/src/server/ThreadManager.hpp
+++ b/src/server/ThreadManager.hpp
@@ -35,13 +35,13 @@ class INGEN_SERVER_API ThreadManager
public:
static void set_flag(ThreadFlag f) {
#ifndef NDEBUG
- flags = (static_cast<unsigned>(flags) | f);
+ flags |= static_cast<unsigned>(f);
#endif
}
static void unset_flag(ThreadFlag f) {
#ifndef NDEBUG
- flags = (static_cast<unsigned>(flags) & (~f));
+ flags &= ~static_cast<unsigned>(f);
#endif
}
diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp
index 395a04cd..c6555123 100644
--- a/src/server/UndoStack.cpp
+++ b/src/server/UndoStack.cpp
@@ -16,18 +16,17 @@
#include "UndoStack.hpp"
-#include "ingen/URIMap.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/ingen.h"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/patch/patch.h"
-#include "serd/serd.h"
-#include "sratom/sratom.h"
+#include <ingen/URIMap.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/ingen.h>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/patch/patch.h>
+#include <serd/serd.h>
+#include <sratom/sratom.h>
#include <ctime>
#include <iterator>
-#include <memory>
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -41,7 +40,7 @@ UndoStack::start_entry()
if (_depth == 0) {
time_t now = {};
time(&now);
- _stack.emplace_back(Entry(now));
+ _stack.emplace_back(now);
}
return ++_depth;
}
@@ -188,8 +187,8 @@ UndoStack::write_entry(Sratom* sratom,
strftime(time_str, sizeof(time_str), "%FT%T", gmtime(&entry.time));
// entry rdf:type ingen:UndoEntry
- SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time"));
- SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str));
+ SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time"));
+ const SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str));
serd_writer_write_statement(writer, SERD_ANON_CONT, nullptr, subject, &p, &o, nullptr, nullptr);
p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "events"));
@@ -245,8 +244,8 @@ UndoStack::save(FILE* stream, const char* name)
reinterpret_cast<SerdEndSink>(serd_writer_end_anon),
writer);
- SerdNode s = serd_node_from_string(SERD_BLANK, USTR(name));
- SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "entries"));
+ const SerdNode s = serd_node_from_string(SERD_BLANK, USTR(name));
+ const SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "entries"));
BlankIDs ids('u');
ListContext ctx(ids, 0, &s, &p);
diff --git a/src/server/UndoStack.hpp b/src/server/UndoStack.hpp
index 8195920a..443497cc 100644
--- a/src/server/UndoStack.hpp
+++ b/src/server/UndoStack.hpp
@@ -17,14 +17,13 @@
#ifndef INGEN_ENGINE_UNDOSTACK_HPP
#define INGEN_ENGINE_UNDOSTACK_HPP
-#include "ingen/AtomSink.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "serd/serd.h"
-#include "server.h"
-#include "sratom/sratom.h"
-
-#include <algorithm>
+#include <ingen/AtomSink.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <serd/serd.h>
+#include <server.h>
+#include <sratom/sratom.h>
+
#include <cstdint>
#include <cstdio>
#include <cstdlib>
@@ -43,7 +42,8 @@ class INGEN_SERVER_API UndoStack : public AtomSink
{
public:
struct Entry {
- Entry(time_t t = 0) noexcept : time(t) {}
+ explicit Entry(time_t t) noexcept : time{t} {}
+ Entry() noexcept : Entry{0} {}
Entry(const Entry& copy)
: time(copy.time)
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 5b4da498..1c04bb36 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -20,19 +20,17 @@
#include "GraphImpl.hpp"
#include "LV2Block.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Node.hpp"
-#include "lv2/core/lv2.h"
-#include "lv2/worker/worker.h"
+#include <ingen/Log.hpp>
+#include <ingen/Node.hpp>
+#include <lv2/core/lv2.h>
+#include <lv2/worker/worker.h>
+#include <raul/RingBuffer.hpp>
+#include <raul/Semaphore.hpp>
#include <cstdlib>
#include <memory>
-namespace ingen {
-
-class World;
-
-namespace server {
+namespace ingen::server {
/// A message in the Worker::_requests ring
struct MessageHeader {
@@ -46,8 +44,8 @@ schedule(LV2_Worker_Schedule_Handle handle,
uint32_t size,
const void* data)
{
- auto* block = static_cast<LV2Block*>(handle);
- Engine& engine = block->parent_graph()->engine();
+ auto* block = static_cast<LV2Block*>(handle);
+ const Engine& engine = block->parent_graph()->engine();
return engine.worker()->request(block, size, data);
}
@@ -57,8 +55,8 @@ schedule_sync(LV2_Worker_Schedule_Handle handle,
uint32_t size,
const void* data)
{
- auto* block = static_cast<LV2Block*>(handle);
- Engine& engine = block->parent_graph()->engine();
+ auto* block = static_cast<LV2Block*>(handle);
+ const Engine& engine = block->parent_graph()->engine();
return engine.sync_worker()->request(block, size, data);
}
@@ -72,7 +70,7 @@ Worker::request(LV2Block* block,
return block->work(size, data);
}
- Engine& engine = block->parent_graph()->engine();
+ const Engine& engine = block->parent_graph()->engine();
if (_requests.write_space() < sizeof(MessageHeader) + size) {
engine.log().error("Work request ring overflow\n");
return LV2_WORKER_ERR_NO_SPACE;
@@ -164,5 +162,4 @@ Worker::run()
}
}
-} // namespace server
-} // namespace ingen
+} // namespace ingen::server
diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp
index 540347df..08b75509 100644
--- a/src/server/Worker.hpp
+++ b/src/server/Worker.hpp
@@ -17,11 +17,11 @@
#ifndef INGEN_ENGINE_WORKER_HPP
#define INGEN_ENGINE_WORKER_HPP
-#include "ingen/LV2Features.hpp"
-#include "lv2/core/lv2.h"
-#include "lv2/worker/worker.h"
-#include "raul/RingBuffer.hpp"
-#include "raul/Semaphore.hpp"
+#include <ingen/LV2Features.hpp>
+#include <lv2/core/lv2.h>
+#include <lv2/worker/worker.h>
+#include <raul/RingBuffer.hpp>
+#include <raul/Semaphore.hpp>
#include <cstdint>
#include <memory>
@@ -30,8 +30,6 @@
namespace ingen {
class Log;
-class Node;
-class World;
namespace server {
@@ -44,7 +42,7 @@ public:
~Worker();
struct Schedule : public LV2Features::Feature {
- Schedule(bool sync) noexcept : synchronous(sync) {}
+ explicit Schedule(bool sync) noexcept : synchronous(sync) {}
const char* uri() const override { return LV2_WORKER__schedule; }
diff --git a/src/server/events.hpp b/src/server/events.hpp
index 5f77b431..7ab20ca7 100644
--- a/src/server/events.hpp
+++ b/src/server/events.hpp
@@ -17,19 +17,19 @@
#ifndef INGEN_ENGINE_EVENTS_HPP
#define INGEN_ENGINE_EVENTS_HPP
-#include "events/Connect.hpp"
-#include "events/Copy.hpp"
-#include "events/CreateBlock.hpp"
-#include "events/CreateGraph.hpp"
-#include "events/CreatePort.hpp"
-#include "events/Delete.hpp"
-#include "events/Delta.hpp"
-#include "events/Disconnect.hpp"
-#include "events/DisconnectAll.hpp"
-#include "events/Get.hpp"
-#include "events/Mark.hpp"
-#include "events/Move.hpp"
-#include "events/SetPortValue.hpp"
-#include "events/Undo.hpp"
+#include <events/Connect.hpp>
+#include <events/Copy.hpp>
+#include <events/CreateBlock.hpp>
+#include <events/CreateGraph.hpp>
+#include <events/CreatePort.hpp>
+#include <events/Delete.hpp>
+#include <events/Delta.hpp>
+#include <events/Disconnect.hpp>
+#include <events/DisconnectAll.hpp>
+#include <events/Get.hpp>
+#include <events/Mark.hpp>
+#include <events/Move.hpp>
+#include <events/SetPortValue.hpp>
+#include <events/Undo.hpp>
#endif // INGEN_ENGINE_EVENTS_HPP
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 44c734a8..6e20be8f 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -16,6 +16,7 @@
#include "Connect.hpp"
+#include "../internals/BlockDelay.hpp"
#include "ArcImpl.hpp"
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
@@ -26,15 +27,16 @@
#include "InputPort.hpp"
#include "PortImpl.hpp"
#include "PreProcessContext.hpp"
-#include "internals/BlockDelay.hpp"
#include "types.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Maid.hpp>
#include <cassert>
#include <memory>
@@ -57,7 +59,7 @@ Connect::~Connect() = default;
bool
Connect::pre_process(PreProcessContext& ctx)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
Node* tail = _engine.store()->get(_msg.tail);
if (!tail) {
@@ -132,7 +134,7 @@ Connect::pre_process(PreProcessContext& ctx)
head_block->providers().insert(tail_block);
if (ctx.must_compile(*_graph)) {
- if (!(_compiled_graph = compile(*_engine.maid(), *_graph))) {
+ if (!(_compiled_graph = compile(*_graph))) {
head_block->providers().erase(tail_block);
tail_block->dependants().erase(head_block);
return Event::pre_process_done(Status::COMPILATION_FAILED);
@@ -165,7 +167,7 @@ Connect::execute(RunContext& ctx)
}
_head->connect_buffers();
if (_compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = _graph->swap_compiled_graph(std::move(_compiled_graph));
}
}
}
@@ -173,7 +175,7 @@ Connect::execute(RunContext& ctx)
void
Connect::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
if (!_tail_remove.empty() || !_tail_add.empty()) {
diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp
index a735b68c..458df0ef 100644
--- a/src/server/events/Connect.hpp
+++ b/src/server/events/Connect.hpp
@@ -21,9 +21,9 @@
#include "PortImpl.hpp"
#include "types.hpp"
-#include "ingen/Message.hpp"
-#include "ingen/Properties.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Message.hpp>
+#include <ingen/Properties.hpp>
+#include <raul/Maid.hpp>
#include <memory>
@@ -38,8 +38,6 @@ class CompiledGraph;
class Engine;
class GraphImpl;
class InputPort;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -66,7 +64,7 @@ private:
const ingen::Connect _msg;
GraphImpl* _graph{nullptr};
InputPort* _head{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
std::shared_ptr<ArcImpl> _arc;
raul::managed_ptr<PortImpl::Voices> _voices;
Properties _tail_remove;
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index f6bcc62a..e75bf1c5 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -14,7 +14,7 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "events/Copy.hpp"
+#include "Copy.hpp"
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
@@ -23,16 +23,18 @@
#include "GraphImpl.hpp"
#include "PreProcessContext.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Parser.hpp"
-#include "ingen/Serialiser.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Parser.hpp>
+#include <ingen/Serialiser.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Path.hpp>
+#include <raul/Symbol.hpp>
#include <map>
#include <memory>
@@ -57,7 +59,7 @@ Copy::~Copy() = default;
bool
Copy::pre_process(PreProcessContext& ctx)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
if (uri_is_path(_msg.old_uri)) {
// Old URI is a path within the engine
@@ -124,8 +126,7 @@ Copy::engine_to_engine(PreProcessContext& ctx)
}
// Create new block
- if (!(_block = dynamic_cast<BlockImpl*>(
- _old_block->duplicate(_engine, raul::Symbol(new_path.symbol()), _parent)))) {
+ if (!(_block = _old_block->duplicate(_engine, raul::Symbol(new_path.symbol()), _parent))) {
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
@@ -136,7 +137,7 @@ Copy::engine_to_engine(PreProcessContext& ctx)
_engine.store()->add(_block);
// Compile graph with new block added for insertion in audio thread
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent);
+ _compiled_graph = ctx.maybe_compile(*_parent);
return Event::pre_process_done(Status::SUCCESS);
}
@@ -163,7 +164,7 @@ Copy::engine_to_filesystem(PreProcessContext&)
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
- std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
+ const 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));
@@ -184,7 +185,7 @@ Copy::filesystem_to_engine(PreProcessContext&)
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
- std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
+ const 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());
@@ -207,14 +208,15 @@ void
Copy::execute(RunContext&)
{
if (_block && _compiled_graph) {
- _parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _parent->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
Copy::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp
index 8460140a..8031bb42 100644
--- a/src/server/events/Copy.hpp
+++ b/src/server/events/Copy.hpp
@@ -20,8 +20,7 @@
#include "Event.hpp"
#include "types.hpp"
-#include "ingen/Message.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Message.hpp>
#include <memory>
@@ -36,7 +35,6 @@ class CompiledGraph;
class Engine;
class GraphImpl;
class PreProcessContext;
-class RunContext;
namespace events {
@@ -67,7 +65,7 @@ private:
std::shared_ptr<BlockImpl> _old_block{nullptr};
GraphImpl* _parent{nullptr};
BlockImpl* _block{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
};
} // namespace events
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index 73834fcb..55c9b782 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -28,31 +28,27 @@
#include "State.hpp"
#include "types.hpp"
-#include "ingen/FilePath.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/FilePath.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Path.hpp>
+#include <raul/Symbol.hpp>
#include <map>
#include <memory>
+#include <string>
#include <utility>
-namespace ingen::server {
-
-class RunContext;
-
-namespace events {
+namespace ingen::server::events {
CreateBlock::CreateBlock(Engine& engine,
const std::shared_ptr<Interface>& client,
@@ -169,7 +165,7 @@ CreateBlock::pre_process(PreProcessContext& ctx)
/* Compile graph with new block added for insertion in audio thread
TODO: Since the block is not connected at this point, a full compilation
could be avoided and the block simply appended. */
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph);
+ _compiled_graph = ctx.maybe_compile(*_graph);
_update.put_block(_block);
@@ -180,14 +176,15 @@ void
CreateBlock::execute(RunContext&)
{
if (_status == Status::SUCCESS && _compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _graph->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
CreateBlock::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_update.send(*_engine.broadcaster());
}
@@ -199,5 +196,4 @@ CreateBlock::undo(Interface& target)
target.del(_block->uri());
}
-} // namespace events
-} // namespace ingen::server
+} // namespace ingen::server::events
diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp
index 2a7a60ab..0ee6e36f 100644
--- a/src/server/events/CreateBlock.hpp
+++ b/src/server/events/CreateBlock.hpp
@@ -21,8 +21,7 @@
#include "Event.hpp"
#include "types.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <raul/Path.hpp>
#include <cstdint>
#include <memory>
@@ -38,8 +37,6 @@ class BlockImpl;
class CompiledGraph;
class Engine;
class GraphImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -70,7 +67,7 @@ private:
ClientUpdate _update;
GraphImpl* _graph{nullptr};
BlockImpl* _block{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
};
} // namespace events
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index bcc935bb..5df28afa 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -14,35 +14,36 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "events/CreateGraph.hpp"
+#include "CreateGraph.hpp"
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
#include "CompiledGraph.hpp"
+#include "CreatePort.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "PreProcessContext.hpp"
-#include "events/CreatePort.hpp"
#include "types.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Path.hpp>
+#include <raul/Symbol.hpp>
#include <boost/intrusive/slist.hpp>
#include <map>
#include <memory>
+#include <string>
#include <utility>
namespace ingen::server::events {
@@ -192,7 +193,7 @@ CreateGraph::pre_process(PreProcessContext& ctx)
if (_parent->enabled()) {
_graph->enable();
}
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent);
+ _compiled_graph = ctx.maybe_compile(*_parent);
}
_graph->activate(*_engine.buffer_factory());
@@ -219,7 +220,8 @@ CreateGraph::execute(RunContext& ctx)
if (_graph) {
if (_parent) {
if (_compiled_graph) {
- _parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _parent->swap_compiled_graph(std::move(_compiled_graph));
}
} else {
_engine.set_root_graph(_graph);
@@ -235,7 +237,7 @@ CreateGraph::execute(RunContext& ctx)
void
CreateGraph::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_update.send(*_engine.broadcaster());
}
diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp
index 7fc005ad..1d7f04a5 100644
--- a/src/server/events/CreateGraph.hpp
+++ b/src/server/events/CreateGraph.hpp
@@ -21,9 +21,8 @@
#include "Event.hpp"
#include "types.hpp"
-#include "ingen/Properties.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Properties.hpp>
+#include <raul/Path.hpp>
#include <cstdint>
#include <list>
@@ -38,8 +37,6 @@ namespace server {
class CompiledGraph;
class Engine;
class GraphImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -74,7 +71,7 @@ private:
ClientUpdate _update;
GraphImpl* _graph{nullptr};
GraphImpl* _parent{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
std::list<std::unique_ptr<Event>> _child_events;
};
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 7a01d0d9..b42542f8 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -23,26 +23,29 @@
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "PortImpl.hpp"
-
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIMap.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
+#include "PortType.hpp"
+
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIMap.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
+#include <raul/Symbol.hpp>
#include <cassert>
#include <map>
#include <memory>
+#include <string>
#include <utility>
namespace ingen::server::events {
@@ -55,7 +58,6 @@ CreatePort::CreatePort(Engine& engine,
const Properties& properties)
: Event(engine, client, id, timestamp)
, _path(std::move(path))
- , _port_type(PortType::UNKNOWN)
, _properties(properties)
{
const ingen::URIs& uris = _engine.world().uris();
@@ -179,7 +181,7 @@ CreatePort::pre_process(PreProcessContext&)
_update = _graph_port->properties();
assert(_graph_port->index() == static_cast<uint32_t>(index_i->second.get<int32_t>()));
- assert(_graph->num_ports_non_rt() == static_cast<uint32_t>(old_n_ports) + 1u);
+ assert(_graph->num_ports_non_rt() == static_cast<uint32_t>(old_n_ports) + 1U);
assert(_ports_array->size() == _graph->num_ports_non_rt());
assert(_graph_port->index() < _ports_array->size());
return Event::pre_process_done(Status::SUCCESS);
@@ -210,7 +212,7 @@ CreatePort::execute(RunContext& ctx)
void
CreatePort::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->put(path_to_uri(_path), _update);
}
diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp
index 6d3e9ca2..151bf82f 100644
--- a/src/server/events/CreatePort.hpp
+++ b/src/server/events/CreatePort.hpp
@@ -22,10 +22,10 @@
#include "PortType.hpp"
#include "types.hpp"
-#include "ingen/Properties.hpp"
-#include "lv2/urid/urid.h"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Properties.hpp>
+#include <lv2/urid/urid.h>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
#include <cstdint>
#include <memory>
@@ -41,8 +41,6 @@ class DuplexPort;
class Engine;
class EnginePort;
class GraphImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -72,7 +70,7 @@ private:
};
raul::Path _path;
- PortType _port_type;
+ PortType _port_type{PortType::UNKNOWN};
LV2_URID _buf_type{0};
GraphImpl* _graph{nullptr};
DuplexPort* _graph_port{nullptr};
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index b64c81c0..9e940ea7 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -30,18 +30,18 @@
#include "PortImpl.hpp"
#include "PreProcessContext.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Array.hpp>
+#include <raul/Path.hpp>
#include <cassert>
#include <cstddef>
@@ -50,11 +50,7 @@
#include <string>
#include <string_view>
-namespace ingen::server {
-
-class RunContext;
-
-namespace events {
+namespace ingen::server::events {
Delete::Delete(Engine& engine,
const std::shared_ptr<Interface>& client,
@@ -104,7 +100,7 @@ Delete::pre_process(PreProcessContext& ctx)
}
// Take a writer lock while we modify the store
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
_engine.store()->remove(iter, _removed_objects);
@@ -113,14 +109,14 @@ Delete::pre_process(PreProcessContext& ctx)
_disconnect_event =
std::make_unique<DisconnectAll>(_engine, parent, _block.get());
_disconnect_event->pre_process(ctx);
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent);
+ _compiled_graph = ctx.maybe_compile(*parent);
} else if (_port) {
parent->remove_port(*_port);
_disconnect_event =
std::make_unique<DisconnectAll>(_engine, parent, _port.get());
_disconnect_event->pre_process(ctx);
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent);
+ _compiled_graph = ctx.maybe_compile(*parent);
if (parent->enabled()) {
_ports_array = parent->build_ports_array(*_engine.maid());
assert(_ports_array->size() == parent->num_ports_non_rt());
@@ -182,14 +178,14 @@ Delete::execute(RunContext& ctx)
}
if (parent && _compiled_graph) {
- parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = parent->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
Delete::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS && (_block || _port)) {
if (_block) {
_block->deactivate();
@@ -225,11 +221,10 @@ Delete::undo(Interface& target)
if (c.first != _msg.uri.path()) {
target.set_property(path_to_uri(c.first),
uris.lv2_index,
- forge.make(int32_t(c.second.first)));
+ forge.make(static_cast<int32_t>(c.second.first)));
}
}
}
}
-} // namespace events
-} // namespace ingen::server
+} // namespace ingen::server::events
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index 840b8415..7e901f4b 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -17,16 +17,15 @@
#ifndef INGEN_EVENTS_DELETE_HPP
#define INGEN_EVENTS_DELETE_HPP
-#include "BlockImpl.hpp"
#include "ControlBindings.hpp"
#include "Event.hpp"
#include "GraphImpl.hpp"
#include "types.hpp"
-#include "ingen/Message.hpp"
-#include "ingen/Store.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Message.hpp>
+#include <ingen/Store.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
#include <cstdint>
#include <map>
@@ -35,18 +34,19 @@
#include <utility>
#include <vector>
+// IWYU pragma: no_include <iterator>
+
namespace ingen {
class Interface;
namespace server {
+class BlockImpl;
class CompiledGraph;
class DuplexPort;
class Engine;
class EnginePort;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -80,7 +80,7 @@ private:
std::shared_ptr<DuplexPort> _port; ///< Non-null iff a port
EnginePort* _engine_port{nullptr};
raul::managed_ptr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph
- raul::managed_ptr<CompiledGraph> _compiled_graph; ///< Graph's new process order
+ std::unique_ptr<CompiledGraph> _compiled_graph; ///< Graph's new process order
std::unique_ptr<DisconnectAll> _disconnect_event;
Store::Objects _removed_objects;
IndexChanges _port_index_changes;
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 0b8cab39..cba21214 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -32,23 +32,24 @@
#include "PortType.hpp"
#include "SetPortValue.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/FilePath.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Message.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
-#include "lilv/lilv.h"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-
-#include <algorithm>
+#include <ingen/Atom.hpp>
+#include <ingen/FilePath.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
+#include <lilv/lilv.h>
+#include <raul/Path.hpp>
+
#include <memory>
#include <mutex>
#include <set>
@@ -57,11 +58,7 @@
#include <utility>
#include <vector>
-namespace ingen::server {
-
-class PreProcessContext;
-
-namespace events {
+namespace ingen::server::events {
Delta::Delta(Engine& engine,
const std::shared_ptr<Interface>& client,
@@ -213,7 +210,7 @@ Delta::pre_process(PreProcessContext& ctx)
return Event::pre_process_done(Status::FAILURE);
}
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
_object = is_graph_object
? static_cast<ingen::Resource*>(_engine.store()->get(uri_to_path(_subject)))
@@ -225,7 +222,7 @@ Delta::pre_process(PreProcessContext& ctx)
}
if (is_graph_object && !_object) {
- raul::Path path(uri_to_path(_subject));
+ const raul::Path path{uri_to_path(_subject)};
bool is_graph = false;
bool is_block = false;
@@ -318,8 +315,8 @@ Delta::pre_process(PreProcessContext& ctx)
const Property& value = p.second;
SpecialType op = SpecialType::NONE;
if (obj) {
- Resource& resource = *obj;
if (value != uris.patch_wildcard) {
+ Resource& resource = *obj;
if (resource.add_property(key, value, value.context())) {
_added.emplace(key, value);
}
@@ -397,7 +394,7 @@ Delta::pre_process(PreProcessContext& ctx)
op = SpecialType::ENABLE;
// FIXME: defer until all other data has been processed
if (value.get<int32_t>() && !_graph->enabled()) {
- if (!(_compiled_graph = compile(*_engine.maid(), *_graph))) {
+ if (!(_compiled_graph = compile(*_graph))) {
_status = Status::COMPILATION_FAILED;
}
}
@@ -516,7 +513,7 @@ Delta::execute(RunContext& ctx)
if (_graph) {
if (value.get<int32_t>()) {
if (_compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = _graph->swap_compiled_graph(std::move(_compiled_graph));
}
_graph->enable();
} else {
@@ -594,7 +591,7 @@ Delta::post_process()
_state.reset();
}
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (_create_event) {
_create_event->post_process();
@@ -673,5 +670,4 @@ Delta::get_execution() const
return _block ? Execution::ATOMIC : Execution::NORMAL;
}
-} // namespace events
-} // namespace ingen::server
+} // namespace ingen::server::events
diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp
index 35357a26..befbdcc7 100644
--- a/src/server/events/Delta.hpp
+++ b/src/server/events/Delta.hpp
@@ -18,24 +18,22 @@
#define INGEN_EVENTS_DELTA_HPP
#include "ClientUpdate.hpp"
+#include "CompiledGraph.hpp"
#include "ControlBindings.hpp"
#include "Event.hpp"
#include "SetPortValue.hpp"
#include "State.hpp"
#include "types.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/Resource.hpp"
-#include "ingen/URI.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Properties.hpp>
+#include <ingen/Resource.hpp>
+#include <ingen/URI.hpp>
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
-// IWYU pragma: no_include <algorithm>
-
namespace ingen {
class Interface;
@@ -45,11 +43,8 @@ struct SetProperty;
namespace server {
-class CompiledGraph;
class Engine;
class GraphImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -117,7 +112,7 @@ private:
ClientUpdate _update;
ingen::Resource* _object{nullptr};
GraphImpl* _graph{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
ControlBindings::Binding* _binding{nullptr};
StatePtr _state;
Resource::Graph _context;
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index ef0cbd0b..7189fdd0 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -14,7 +14,7 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "events/Disconnect.hpp"
+#include "Disconnect.hpp"
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
@@ -30,14 +30,15 @@
#include "PreProcessContext.hpp"
#include "ThreadManager.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
#include <cassert>
#include <cstdint>
@@ -117,7 +118,7 @@ Disconnect::Impl::Impl(Engine& e,
bool
Disconnect::pre_process(PreProcessContext& ctx)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
if (_msg.tail.parent().parent() != _msg.head.parent().parent()
&& _msg.tail.parent() != _msg.head.parent().parent()
@@ -168,10 +169,10 @@ Disconnect::pre_process(PreProcessContext& ctx)
_impl = std::make_unique<Impl>(_engine,
_graph,
- dynamic_cast<PortImpl*>(tail),
+ tail,
dynamic_cast<InputPort*>(head));
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph);
+ _compiled_graph = ctx.maybe_compile(*_graph);
return Event::pre_process_done(Status::SUCCESS);
}
@@ -208,7 +209,8 @@ Disconnect::execute(RunContext& ctx)
if (_status == Status::SUCCESS) {
if (_impl->execute(ctx, true)) {
if (_compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _graph->swap_compiled_graph(std::move(_compiled_graph));
}
} else {
_status = Status::NOT_FOUND;
@@ -219,7 +221,7 @@ Disconnect::execute(RunContext& ctx)
void
Disconnect::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp
index 71ad4204..92dd81d3 100644
--- a/src/server/events/Disconnect.hpp
+++ b/src/server/events/Disconnect.hpp
@@ -21,8 +21,8 @@
#include "PortImpl.hpp"
#include "types.hpp"
-#include "ingen/Message.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Message.hpp>
+#include <raul/Maid.hpp>
#include <memory>
@@ -37,7 +37,6 @@ class CompiledGraph;
class Engine;
class GraphImpl;
class InputPort;
-class PreProcessContext;
class RunContext;
namespace events {
@@ -83,7 +82,7 @@ private:
const ingen::Disconnect _msg;
GraphImpl* _graph{nullptr};
std::unique_ptr<Impl> _impl;
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
};
} // namespace events
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index 957c6a6f..8e7bfbbe 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -14,26 +14,29 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "events/DisconnectAll.hpp"
+#include "DisconnectAll.hpp"
#include "ArcImpl.hpp"
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
#include "CompiledGraph.hpp"
+#include "Disconnect.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "InputPort.hpp"
#include "NodeImpl.hpp"
#include "PortImpl.hpp"
#include "PreProcessContext.hpp"
-#include "events/Disconnect.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <raul/Path.hpp>
+#include <algorithm>
+#include <iterator>
#include <memory>
#include <mutex>
#include <set>
@@ -68,7 +71,7 @@ DisconnectAll::DisconnectAll(Engine& engine,
DisconnectAll::~DisconnectAll()
{
- for (auto& i : _impls) {
+ for (auto* i : _impls) {
delete i;
}
}
@@ -109,28 +112,35 @@ DisconnectAll::pre_process(PreProcessContext& ctx)
}
// Create disconnect events to erase adjacent arcs in parent
- for (const auto& a : adjacent_arcs(_parent)) {
- _impls.push_back(
- new Disconnect::Impl(_engine,
- _parent,
- dynamic_cast<PortImpl*>(a->tail()),
- dynamic_cast<InputPort*>(a->head())));
- }
+ const auto& arcs = adjacent_arcs(_parent);
+ std::transform(arcs.begin(),
+ arcs.end(),
+ std::back_inserter(_impls),
+ [this](const auto& a) {
+ return new Disconnect::Impl(_engine,
+ _parent,
+ a->tail(),
+ dynamic_cast<InputPort*>(a->head()));
+ });
// Create disconnect events to erase adjacent arcs in parent's parent
if (_port && _parent->parent()) {
- auto* const parent_parent = dynamic_cast<GraphImpl*>(_parent->parent());
- for (const auto& a : adjacent_arcs(parent_parent)) {
- _impls.push_back(
- new Disconnect::Impl(_engine,
- parent_parent,
- dynamic_cast<PortImpl*>(a->tail()),
- dynamic_cast<InputPort*>(a->head())));
- }
+ auto* const grandparent = dynamic_cast<GraphImpl*>(_parent->parent());
+ const auto& parent_arcs = adjacent_arcs(grandparent);
+
+ std::transform(parent_arcs.begin(),
+ parent_arcs.end(),
+ std::back_inserter(_impls),
+ [this, grandparent](const auto& a) {
+ return new Disconnect::Impl(_engine,
+ grandparent,
+ a->tail(),
+ dynamic_cast<InputPort*>(a->head()));
+ });
}
if (!_deleting && ctx.must_compile(*_parent)) {
- if (!(_compiled_graph = compile(*_engine.maid(), *_parent))) {
+ if (!(_compiled_graph = compile(*_parent))) {
return Event::pre_process_done(Status::COMPILATION_FAILED);
}
}
@@ -149,14 +159,14 @@ DisconnectAll::execute(RunContext& ctx)
}
if (_compiled_graph) {
- _parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = _parent->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
DisconnectAll::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp
index 70da5dd6..0eeda6f8 100644
--- a/src/server/events/DisconnectAll.hpp
+++ b/src/server/events/DisconnectAll.hpp
@@ -21,8 +21,7 @@
#include "Event.hpp"
#include "types.hpp"
-#include "ingen/Message.hpp"
-#include "raul/Maid.hpp"
+#include <ingen/Message.hpp>
#include <list>
#include <memory>
@@ -41,8 +40,6 @@ class CompiledGraph;
class Engine;
class GraphImpl;
class PortImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -79,7 +76,7 @@ private:
BlockImpl* _block;
PortImpl* _port;
Impls _impls;
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
bool _deleting;
};
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index f4cbb49d..45e7ea94 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -22,20 +22,22 @@
#include "GraphImpl.hpp"
#include "PortImpl.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Properties.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/paths.hpp"
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Properties.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/paths.hpp>
#include <cstdint>
#include <memory>
#include <mutex>
+#include <utility>
namespace ingen::server::events {
@@ -50,7 +52,7 @@ Get::Get(Engine& engine,
bool
Get::pre_process(PreProcessContext&)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
const auto& uri = _msg.subject;
if (uri == "ingen:/plugins") {
@@ -96,7 +98,7 @@ Get::execute(RunContext&)
void
Get::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS && _request_client) {
if (_msg.subject == "ingen:/plugins") {
_engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins);
@@ -105,11 +107,11 @@ Get::post_process()
URIs& uris = _engine.world().uris();
Properties props = {
{ uris.param_sampleRate,
- uris.forge.make(int32_t(_engine.sample_rate())) },
+ uris.forge.make(static_cast<int32_t>(_engine.sample_rate())) },
{ uris.bufsz_maxBlockLength,
- uris.forge.make(int32_t(_engine.block_length())) },
+ uris.forge.make(static_cast<int32_t>(_engine.block_length())) },
{ uris.ingen_numThreads,
- uris.forge.make(int32_t(_engine.n_threads())) } };
+ uris.forge.make(static_cast<int32_t>(_engine.n_threads())) } };
const Properties load_props = _engine.load_properties();
props.insert(load_props.begin(), load_props.end());
diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp
index 1ec49bfa..0f5ed235 100644
--- a/src/server/events/Get.hpp
+++ b/src/server/events/Get.hpp
@@ -17,7 +17,7 @@
#ifndef INGEN_EVENTS_GET_HPP
#define INGEN_EVENTS_GET_HPP
-#include "ingen/Message.hpp"
+#include <ingen/Message.hpp>
#include "BlockFactory.hpp"
#include "ClientUpdate.hpp"
@@ -35,8 +35,6 @@ namespace server {
class Engine;
class PluginImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp
index 97acdbbb..b60b0432 100644
--- a/src/server/events/Mark.cpp
+++ b/src/server/events/Mark.cpp
@@ -14,10 +14,7 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "events/Mark.hpp"
-
-#include "ingen/Message.hpp"
-#include "ingen/Status.hpp"
+#include "Mark.hpp"
#include "CompiledGraph.hpp"
#include "Engine.hpp"
@@ -25,6 +22,9 @@
#include "PreProcessContext.hpp"
#include "UndoStack.hpp"
+#include <ingen/Message.hpp>
+#include <ingen/Status.hpp>
+
#include <cassert>
#include <memory>
#include <unordered_set>
@@ -84,7 +84,7 @@ Mark::pre_process(PreProcessContext& ctx)
ctx.set_in_bundle(false);
if (!ctx.dirty_graphs().empty()) {
for (GraphImpl* g : ctx.dirty_graphs()) {
- auto cg = compile(*_engine.maid(), *g);
+ auto cg = compile(*g);
if (cg) {
_compiled_graphs.emplace(g, std::move(cg));
}
@@ -101,7 +101,7 @@ void
Mark::execute(RunContext&)
{
for (auto& g : _compiled_graphs) {
- g.first->set_compiled_graph(std::move(g.second));
+ g.second = g.first->swap_compiled_graph(std::move(g.second));
}
}
diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp
index ea130eda..e7180764 100644
--- a/src/server/events/Mark.hpp
+++ b/src/server/events/Mark.hpp
@@ -17,13 +17,10 @@
#ifndef INGEN_EVENTS_MARK_HPP
#define INGEN_EVENTS_MARK_HPP
+#include "CompiledGraph.hpp"
#include "Event.hpp"
#include "types.hpp"
-// IWYU pragma: no_include "CompiledGraph.hpp"
-
-#include "raul/Maid.hpp"
-
#include <map>
#include <memory>
@@ -35,11 +32,8 @@ struct BundleEnd;
namespace server {
-class CompiledGraph; // IWYU pragma: keep
class Engine;
class GraphImpl;
-class PreProcessContext;
-class RunContext;
namespace events {
@@ -75,8 +69,7 @@ public:
private:
enum class Type { BUNDLE_BEGIN, BUNDLE_END };
- using CompiledGraphs =
- std::map<GraphImpl*, raul::managed_ptr<CompiledGraph>>;
+ using CompiledGraphs = std::map<GraphImpl*, std::unique_ptr<CompiledGraph>>;
CompiledGraphs _compiled_graphs;
Type _type;
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index ea05d34c..80ae5a11 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -14,16 +14,17 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "events/Move.hpp"
+#include "Move.hpp"
#include "Broadcaster.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/Store.hpp"
-#include "raul/Path.hpp"
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/Store.hpp>
+#include <raul/Path.hpp>
#include <map>
#include <memory>
@@ -46,7 +47,7 @@ Move::Move(Engine& engine,
bool
Move::pre_process(PreProcessContext&)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
if (!_msg.old_path.parent().is_parent_of(_msg.new_path)) {
return Event::pre_process_done(Status::PARENT_DIFFERS, _msg.new_path);
@@ -78,7 +79,7 @@ Move::execute(RunContext&)
void
Move::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp
index 3940e825..cca4d310 100644
--- a/src/server/events/Move.hpp
+++ b/src/server/events/Move.hpp
@@ -20,7 +20,7 @@
#include "Event.hpp"
#include "types.hpp"
-#include "ingen/Message.hpp"
+#include <ingen/Message.hpp>
#include <memory>
@@ -31,8 +31,6 @@ class Interface;
namespace server {
class Engine;
-class PreProcessContext;
-class RunContext;
namespace events {
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 8b599354..ba6859dd 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -24,11 +24,12 @@
#include "PortImpl.hpp"
#include "RunContext.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Status.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "lv2/atom/atom.h"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <lv2/atom/atom.h>
#include <cassert>
#include <memory>
@@ -54,7 +55,7 @@ SetPortValue::SetPortValue(Engine& engine,
bool
SetPortValue::pre_process(PreProcessContext&)
{
- ingen::URIs& uris = _engine.world().uris();
+ const ingen::URIs& uris = _engine.world().uris();
if (_port->is_output()) {
return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path());
}
@@ -92,8 +93,8 @@ SetPortValue::apply(RunContext& ctx)
return;
}
- ingen::URIs& uris = _engine.world().uris();
- Buffer* buf = _port->buffer(0).get();
+ const ingen::URIs& uris = _engine.world().uris();
+ Buffer* buf = _port->buffer(0).get();
if (_buffer) {
if (_port->user_buffer(ctx)) {
@@ -127,7 +128,7 @@ SetPortValue::apply(RunContext& ctx)
void
SetPortValue::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS && !_activity) {
_engine.broadcaster()->set_property(
_port->uri(),
diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp
index 69d742b8..32a8b761 100644
--- a/src/server/events/SetPortValue.hpp
+++ b/src/server/events/SetPortValue.hpp
@@ -22,7 +22,7 @@
#include "Event.hpp"
#include "types.hpp"
-#include "ingen/Atom.hpp"
+#include <ingen/Atom.hpp>
#include <cstdint>
#include <memory>
@@ -35,7 +35,6 @@ namespace server {
class Engine;
class PortImpl;
-class PreProcessContext;
class RunContext;
namespace events {
diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp
index ea8c7d69..db7c1c86 100644
--- a/src/server/events/Undo.cpp
+++ b/src/server/events/Undo.cpp
@@ -19,11 +19,11 @@
#include "Engine.hpp"
#include "EventWriter.hpp"
-#include "ingen/AtomReader.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Message.hpp"
-#include "ingen/Status.hpp"
-#include "lv2/atom/atom.h"
+#include <ingen/AtomReader.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/Status.hpp>
+#include <lv2/atom/atom.h>
#include <deque>
#include <memory>
diff --git a/src/server/events/Undo.hpp b/src/server/events/Undo.hpp
index eb9cb70a..818dc754 100644
--- a/src/server/events/Undo.hpp
+++ b/src/server/events/Undo.hpp
@@ -32,8 +32,6 @@ struct Undo;
namespace server {
class Engine;
-class PreProcessContext;
-class RunContext;
namespace events {
diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp
index fd4a8ced..48955143 100644
--- a/src/server/ingen_engine.cpp
+++ b/src/server/ingen_engine.cpp
@@ -14,13 +14,11 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-// IWYU pragma: no_include "ingen/Atom.hpp"
-
#include "Engine.hpp"
#include "util.hpp"
-#include "ingen/Module.hpp"
-#include "ingen/World.hpp"
+#include <ingen/Module.hpp>
+#include <ingen/World.hpp>
#include <memory>
diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp
index 9aedacad..16369d0c 100644
--- a/src/server/ingen_jack.cpp
+++ b/src/server/ingen_jack.cpp
@@ -17,11 +17,11 @@
#include "Engine.hpp"
#include "JackDriver.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Module.hpp"
-#include "ingen/World.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Module.hpp>
+#include <ingen/World.hpp>
#include <memory>
#include <string>
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 851a83fb..658f759b 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -15,7 +15,6 @@
*/
#include "Buffer.hpp"
-#include "BufferRef.hpp"
#include "Driver.hpp"
#include "DuplexPort.hpp"
#include "Engine.hpp"
@@ -26,46 +25,47 @@
#include "ThreadManager.hpp"
#include "types.hpp"
-#include "ingen/AtomReader.hpp"
-#include "ingen/AtomSink.hpp"
-#include "ingen/AtomWriter.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/EngineBase.hpp"
-#include "ingen/FilePath.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Node.hpp"
-#include "ingen/Parser.hpp"
-#include "ingen/Serialiser.hpp"
-#include "ingen/Store.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/ingen.h"
-#include "ingen/memory.hpp"
-#include "ingen/runtime_paths.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/buf-size/buf-size.h"
-#include "lv2/core/lv2.h"
-#include "lv2/log/log.h"
-#include "lv2/log/logger.h"
-#include "lv2/options/options.h"
-#include "lv2/state/state.h"
-#include "lv2/urid/urid.h"
-#include "raul/Maid.hpp"
-#include "raul/Path.hpp"
-#include "raul/RingBuffer.hpp"
-#include "raul/Semaphore.hpp"
-#include "raul/Symbol.hpp"
-#include "serd/serd.h"
-#include "sord/sordmm.hpp"
+#include <ingen/AtomReader.hpp>
+#include <ingen/AtomSink.hpp>
+#include <ingen/AtomWriter.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/EngineBase.hpp>
+#include <ingen/FilePath.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Node.hpp>
+#include <ingen/Parser.hpp>
+#include <ingen/Serialiser.hpp>
+#include <ingen/Store.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/ingen.h>
+#include <ingen/memory.hpp>
+#include <ingen/runtime_paths.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/buf-size/buf-size.h>
+#include <lv2/core/lv2.h>
+#include <lv2/log/log.h>
+#include <lv2/log/logger.h>
+#include <lv2/options/options.h>
+#include <lv2/state/state.h>
+#include <lv2/urid/urid.h>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
+#include <raul/RingBuffer.hpp>
+#include <raul/Semaphore.hpp>
+#include <raul/Symbol.hpp>
+#include <serd/serd.h>
+#include <sord/sordmm.hpp>
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <cstring>
+#include <iterator>
#include <memory>
#include <mutex>
#include <set>
@@ -74,11 +74,9 @@
#include <utility>
#include <vector>
-namespace ingen {
+// #define CLEAR_GRAPH_ON_RESTORE 1
-class Atom;
-
-namespace server {
+namespace ingen::server {
class GraphImpl;
@@ -100,19 +98,23 @@ public:
Graphs graphs;
};
+namespace {
+
inline size_t
ui_ring_size(SampleCount block_length)
{
- return std::max(static_cast<size_t>(8192u),
- static_cast<size_t>(block_length) * 16u);
+ return std::max(static_cast<size_t>(8192U),
+ static_cast<size_t>(block_length) * 16U);
}
+} // namespace
+
class LV2Driver : public Driver, public ingen::AtomSink
{
public:
LV2Driver(Engine& engine,
SampleCount block_length,
- size_t seq_size,
+ uint32_t seq_size,
SampleCount sample_rate)
: _engine(engine)
, _main_sem(0)
@@ -215,13 +217,12 @@ public:
virtual GraphImpl* root_graph() { return _root_graph; }
EnginePort* get_port(const raul::Path& path) override {
- for (auto& p : _ports) {
- if (p->graph_port()->path() == path) {
- return p;
- }
- }
+ const auto i =
+ std::find_if(_ports.begin(), _ports.end(), [&path](const auto& p) {
+ return p->graph_port()->path() == path;
+ });
- return nullptr;
+ return i == _ports.end() ? nullptr : *i;
}
/** Add a port. Called only during init or restore. */
@@ -317,7 +318,13 @@ public:
break;
}
- buf = realloc(buf, sizeof(LV2_Atom) + atom.size);
+ void* const new_buf = realloc(buf, sizeof(LV2_Atom) + atom.size);
+ if (!new_buf) {
+ _engine.log().rt_error("Failed to allocate for from-UI ring\n");
+ break;
+ }
+
+ buf = new_buf;
memcpy(buf, &atom, sizeof(LV2_Atom));
if (!_from_ui.read(atom.size,
@@ -387,7 +394,7 @@ public:
}
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
SampleCount frame_time() const override { return _frame_time; }
@@ -411,7 +418,7 @@ private:
GraphImpl* _root_graph{nullptr};
uint32_t _notify_capacity{0};
SampleCount _block_length;
- size_t _seq_size;
+ uint32_t _seq_size;
SampleCount _sample_rate;
SampleCount _frame_time{0};
raul::Semaphore _to_ui_overflow_sem{0};
@@ -460,9 +467,10 @@ find_graphs(const URI& manifest_uri)
URI(INGEN__Graph));
Lib::Graphs graphs;
- for (const auto& r : resources) {
- graphs.push_back(std::make_shared<LV2Graph>(r));
- }
+ std::transform(resources.begin(),
+ resources.end(),
+ std::back_inserter(graphs),
+ [](const auto& r) { return std::make_shared<LV2Graph>(r); });
return graphs;
}
@@ -512,16 +520,16 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
nullptr,
true);
- Lib::Graphs graphs = find_graphs(URI(reinterpret_cast<const char*>(manifest_node.buf)));
+ const Lib::Graphs graphs = find_graphs(URI(reinterpret_cast<const char*>(manifest_node.buf)));
serd_node_free(&manifest_node);
- const LV2Graph* graph = nullptr;
- for (const auto& g : graphs) {
- if (g->uri == descriptor->URI) {
- graph = g.get();
- break;
- }
- }
+ const auto g = std::find_if(graphs.begin(),
+ graphs.end(),
+ [&descriptor](const auto& graph) {
+ return graph->uri == descriptor->URI;
+ });
+
+ const LV2Graph* const graph = g == graphs.end() ? nullptr : g->get();
if (!graph) {
lv2_log_error(&logger, "could not find graph <%s>\n", descriptor->URI);
@@ -533,11 +541,11 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
plugin->world = std::make_unique<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);
- LV2_URID bufsz_seq = map->map(map->handle, LV2_BUF_SIZE__sequenceSize);
- LV2_URID atom_Int = map->map(map->handle, LV2_ATOM__Int);
- int32_t block_length = 0;
- int32_t seq_size = 0;
+ const LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength);
+ const LV2_URID bufsz_seq = map->map(map->handle, LV2_BUF_SIZE__sequenceSize);
+ const LV2_URID atom_Int = map->map(map->handle, LV2_ATOM__Int);
+ int32_t block_length = 0;
+ int32_t seq_size = 0;
if (options) {
for (const LV2_Options_Option* o = options; o->key; ++o) {
if (o->key == bufsz_max && o->type == atom_Int) {
@@ -551,7 +559,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
block_length = 4096;
plugin->world->log().warn("No maximum block length given\n");
}
- if (seq_size == 0) {
+ if (seq_size < 1) {
seq_size = 16384;
plugin->world->log().warn("No maximum sequence size given\n");
}
@@ -567,20 +575,21 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
plugin->engine = engine;
plugin->world->set_engine(engine);
- std::shared_ptr<Interface> interface = engine->interface();
+ const std::shared_ptr<Interface> interface = engine->interface();
plugin->world->set_interface(interface);
ThreadManager::set_flag(THREAD_PRE_PROCESS);
ThreadManager::single_threaded = true;
- auto* driver = new LV2Driver(*engine, block_length, seq_size, rate);
+ auto* driver = new LV2Driver(
+ *engine, block_length, static_cast<uint32_t>(seq_size), rate);
engine->set_driver(std::shared_ptr<Driver>(driver));
engine->activate();
ThreadManager::single_threaded = true;
- std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()};
// Locate to time 0 to process initialization events
engine->locate(0, block_length);
@@ -602,7 +611,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
/* Register client after loading graph so the to-ui ring does not overflow.
Since we are not yet rolling, it won't be drained, causing a deadlock. */
- std::shared_ptr<Interface> client(&driver->writer(), NullDeleter<Interface>);
+ const std::shared_ptr<Interface> client{&driver->writer(), NullDeleter<Interface>};
interface->set_respondee(client);
engine->register_client(client);
@@ -613,8 +622,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
static void
ingen_connect_port(LV2_Handle instance, uint32_t port, void* data)
{
- auto* me = static_cast<IngenPlugin*>(instance);
- Engine* engine = static_cast<Engine*>(me->world->engine().get());
+ auto* me = static_cast<IngenPlugin*>(instance);
+ const Engine* engine = static_cast<Engine*>(me->world->engine().get());
const auto driver = std::static_pointer_cast<LV2Driver>(engine->driver());
if (port < driver->ports().size()) {
driver->ports().at(port)->set_buffer(data);
@@ -670,6 +679,7 @@ ingen_cleanup(LV2_Handle instance)
auto world = std::move(me->world);
delete me;
+ world.reset();
}
static void
@@ -703,9 +713,9 @@ ingen_save(LV2_Handle instance,
return LV2_STATE_ERR_NO_FEATURE;
}
- LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
- LV2_URID atom_Path = plugin->map->map(plugin->map->handle,
- LV2_ATOM__Path);
+ const LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
+ const LV2_URID atom_Path = plugin->map->map(plugin->map->handle,
+ LV2_ATOM__Path);
char* real_path = make_path->path(make_path->handle, "main.ttl");
char* state_path = map_path->abstract_path(map_path->handle, real_path);
@@ -713,7 +723,7 @@ ingen_save(LV2_Handle instance,
auto root = plugin->world->store()->find(raul::Path("/"));
{
- std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()};
plugin->world->serialiser()->start_to_file(
root->second->path(), FilePath{real_path});
@@ -749,10 +759,10 @@ ingen_restore(LV2_Handle instance,
return LV2_STATE_ERR_NO_FEATURE;
}
- LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
- size_t size = 0;
- uint32_t type = 0;
- uint32_t valflags = 0;
+ const LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
+ size_t size = 0;
+ uint32_t type = 0;
+ uint32_t valflags = 0;
// Get abstract path to graph file
const char* path = static_cast<const char*>(
@@ -767,7 +777,7 @@ ingen_restore(LV2_Handle instance,
return LV2_STATE_ERR_UNKNOWN;
}
-#if 0
+#ifdef CLEAR_GRAPH_ON_RESTORE
// Remove existing root graph contents
std::shared_ptr<Engine> engine = plugin->engine;
for (const auto& b : engine->root_graph()->blocks()) {
@@ -784,7 +794,7 @@ ingen_restore(LV2_Handle instance,
#endif
// Load new graph
- std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()};
plugin->world->parser()->parse_file(
*plugin->world, *plugin->world->interface(), real_path);
@@ -847,8 +857,8 @@ lib_get_plugin(LV2_Lib_Handle handle, uint32_t index)
}
} // extern "C"
-} // namespace server
-} // namespace ingen
+
+} // namespace ingen::server
extern "C" {
diff --git a/src/server/ingen_portaudio.cpp b/src/server/ingen_portaudio.cpp
index 0199413f..68b1b0bc 100644
--- a/src/server/ingen_portaudio.cpp
+++ b/src/server/ingen_portaudio.cpp
@@ -14,14 +14,12 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-// IWYU pragma: no_include "ingen/FilePath.hpp"
-
#include "Engine.hpp"
#include "PortAudioDriver.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/Module.hpp"
-#include "ingen/World.hpp"
+#include <ingen/Log.hpp>
+#include <ingen/Module.hpp>
+#include <ingen/World.hpp>
#include <memory>
diff --git a/src/server/internals/BlockDelay.cpp b/src/server/internals/BlockDelay.cpp
index 516b7cf4..acc68851 100644
--- a/src/server/internals/BlockDelay.cpp
+++ b/src/server/internals/BlockDelay.cpp
@@ -14,7 +14,7 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "internals/BlockDelay.hpp"
+#include "BlockDelay.hpp"
#include "BlockImpl.hpp"
#include "Buffer.hpp"
@@ -24,20 +24,16 @@
#include "OutputPort.hpp"
#include "PortType.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Forge.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Symbol.hpp>
#include <memory>
-namespace ingen::server {
-
-class RunContext;
-
-namespace internals {
+namespace ingen::server::internals {
InternalPlugin* BlockDelayNode::internal_plugin(URIs& uris) {
return new InternalPlugin(
@@ -90,5 +86,4 @@ BlockDelayNode::run(RunContext& ctx)
_buffer->copy(ctx, _in_port->buffer(0).get());
}
-} // namespace internals
-} // namespace ingen::server
+} // namespace ingen::server::internals
diff --git a/src/server/internals/BlockDelay.hpp b/src/server/internals/BlockDelay.hpp
index 78a03c28..a9667fa0 100644
--- a/src/server/internals/BlockDelay.hpp
+++ b/src/server/internals/BlockDelay.hpp
@@ -36,7 +36,6 @@ class GraphImpl;
class InputPort;
class InternalPlugin;
class OutputPort;
-class RunContext;
namespace internals {
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 898bd55b..9103649e 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -14,7 +14,8 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "BlockImpl.hpp"
+#include "Controller.hpp"
+
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
@@ -24,17 +25,16 @@
#include "PortType.hpp"
#include "RunContext.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "internals/Controller.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/midi/midi.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/midi/midi.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Symbol.hpp>
#include <cassert>
#include <cmath>
@@ -172,7 +172,7 @@ ControllerNode::control(RunContext& ctx, uint8_t control_num, uint8_t val, Frame
}
const Sample min = logf(min_port_val + 1 + log_offset);
const Sample max = logf(max_port_val + 1 + log_offset);
- scaled_value = expf(nval * (max - min) + min) - 1 - log_offset;
+ scaled_value = expf((nval * (max - min)) + min) - 1 - log_offset;
} else {
scaled_value = ((nval) * (max_port_val - min_port_val)) + min_port_val;
}
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index dd202451..960bca85 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -14,28 +14,27 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "internals/Note.hpp"
+#include "Note.hpp"
#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
-#include "BufferRef.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"
#include "OutputPort.hpp"
#include "PortType.hpp"
#include "RunContext.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/midi/midi.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/midi/midi.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Symbol.hpp>
#include <cassert>
#include <cmath>
diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp
index 3aa3217e..2cf6c1e2 100644
--- a/src/server/internals/Note.hpp
+++ b/src/server/internals/Note.hpp
@@ -20,8 +20,8 @@
#include "InternalBlock.hpp"
#include "types.hpp"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
#include <cstdint>
diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp
index ee97ac84..2ea09b0b 100644
--- a/src/server/internals/Time.cpp
+++ b/src/server/internals/Time.cpp
@@ -14,9 +14,8 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "internals/Time.hpp"
+#include "Time.hpp"
-#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
@@ -27,14 +26,14 @@
#include "PortType.hpp"
#include "RunContext.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/atom/atom.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/atom/atom.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Symbol.hpp>
#include <memory>
@@ -72,8 +71,8 @@ TimeNode::TimeNode(InternalPlugin* plugin,
void
TimeNode::run(RunContext& ctx)
{
- BufferRef buf = _notify_port->buffer(0);
- auto* seq = buf->get<LV2_Atom_Sequence>();
+ const BufferRef buf = _notify_port->buffer(0);
+ auto* const seq = buf->get<LV2_Atom_Sequence>();
// Initialise output to the empty sequence
seq->atom.type = _notify_port->bufs().uris().atom_Sequence;
diff --git a/src/server/internals/Time.hpp b/src/server/internals/Time.hpp
index fa3e90e5..228e67a8 100644
--- a/src/server/internals/Time.hpp
+++ b/src/server/internals/Time.hpp
@@ -34,7 +34,6 @@ class BufferFactory;
class GraphImpl;
class InternalPlugin;
class OutputPort;
-class RunContext;
namespace internals {
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index 519b6d9f..f033a345 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -14,9 +14,8 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "internals/Trigger.hpp"
+#include "Trigger.hpp"
-#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
@@ -26,16 +25,16 @@
#include "PortType.hpp"
#include "RunContext.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/URI.hpp"
-#include "ingen/URIs.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
-#include "lv2/midi/midi.h"
-#include "raul/Array.hpp"
-#include "raul/Maid.hpp"
-#include "raul/Symbol.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
+#include <lv2/midi/midi.h>
+#include <raul/Array.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Symbol.hpp>
#include <cassert>
#include <cmath>
diff --git a/src/server/meson.build b/src/server/meson.build
index c2e5b761..c1fccf5e 100644
--- a/src/server/meson.build
+++ b/src/server/meson.build
@@ -6,6 +6,25 @@
##########
server_sources = files(
+ 'events/Connect.cpp',
+ 'events/Copy.cpp',
+ 'events/CreateBlock.cpp',
+ 'events/CreateGraph.cpp',
+ 'events/CreatePort.cpp',
+ 'events/Delete.cpp',
+ 'events/Delta.cpp',
+ 'events/Disconnect.cpp',
+ 'events/DisconnectAll.cpp',
+ 'events/Get.cpp',
+ 'events/Mark.cpp',
+ 'events/Move.cpp',
+ 'events/SetPortValue.cpp',
+ 'events/Undo.cpp',
+ 'internals/BlockDelay.cpp',
+ 'internals/Controller.cpp',
+ 'internals/Note.cpp',
+ 'internals/Time.cpp',
+ 'internals/Trigger.cpp',
'ArcImpl.cpp',
'BlockFactory.cpp',
'BlockImpl.cpp',
@@ -33,26 +52,7 @@ server_sources = files(
'Task.cpp',
'UndoStack.cpp',
'Worker.cpp',
- 'events/Connect.cpp',
- 'events/Copy.cpp',
- 'events/CreateBlock.cpp',
- 'events/CreateGraph.cpp',
- 'events/CreatePort.cpp',
- 'events/Delete.cpp',
- 'events/Delta.cpp',
- 'events/Disconnect.cpp',
- 'events/DisconnectAll.cpp',
- 'events/Get.cpp',
- 'events/Mark.cpp',
- 'events/Move.cpp',
- 'events/SetPortValue.cpp',
- 'events/Undo.cpp',
'ingen_engine.cpp',
- 'internals/BlockDelay.cpp',
- 'internals/Controller.cpp',
- 'internals/Note.cpp',
- 'internals/Time.cpp',
- 'internals/Trigger.cpp',
'mix.cpp',
)
diff --git a/src/server/mix.cpp b/src/server/mix.cpp
index db491e28..32500f97 100644
--- a/src/server/mix.cpp
+++ b/src/server/mix.cpp
@@ -20,8 +20,8 @@
#include "RunContext.hpp"
#include "types.hpp"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/util.h"
+#include <lv2/atom/atom.h>
+#include <lv2/atom/util.h>
namespace ingen::server {
diff --git a/src/server/util.hpp b/src/server/util.hpp
index 2076aa62..abfa06b6 100644
--- a/src/server/util.hpp
+++ b/src/server/util.hpp
@@ -17,10 +17,10 @@
#ifndef INGEN_ENGINE_UTIL_HPP
#define INGEN_ENGINE_UTIL_HPP
-#include "ingen/Log.hpp"
+#include <ingen/Log.hpp>
#ifdef __SSE__
-#include <xmmintrin.h> // IWYU pragma: keep
+#include <xmmintrin.h>
#endif
#ifdef __clang__