diff options
Diffstat (limited to 'src')
205 files changed, 1981 insertions, 1833 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy index 8a58aa7b..83a09b52 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,7 +1,9 @@ Checks: > -*-avoid-c-arrays, + -*-macro-to-enum, -*-vararg, -android-cloexec-*, + -boost-use-ranges, -bugprone-easily-swappable-parameters, -bugprone-multi-level-implicit-pointer-conversion, -bugprone-unchecked-optional-access, @@ -26,5 +28,5 @@ Checks: > -misc-no-recursion, -misc-unused-parameters, -readability-function-cognitive-complexity, - -readability-use-anyofallof, + -readability-static-accessed-through-instance, InheritParentConfig: true diff --git a/src/AtomForge.cpp b/src/AtomForge.cpp new file mode 100644 index 00000000..727bd64e --- /dev/null +++ b/src/AtomForge.cpp @@ -0,0 +1,130 @@ +/* + This file is part of Ingen. + 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 + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <ingen/AtomForge.hpp> +#include <ingen/memory.hpp> + +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/urid/urid.h> +#include <sord/sord.h> +#include <sord/sordmm.hpp> +#include <sratom/sratom.h> + +#include <cassert> +#include <cstring> +#include <utility> + +namespace ingen { + +AtomForge::AtomForge(LV2_URID_Map& map) + : LV2_Atom_Forge{} + , _sratom{sratom_new(&map)} + , _buf{static_cast<LV2_Atom*>(calloc(8, sizeof(LV2_Atom)))} +{ + lv2_atom_forge_init(this, &map); + lv2_atom_forge_set_sink(this, c_append, c_deref, this); +} + +void +AtomForge::read(Sord::World& world, + SordModel* const model, + const SordNode* const node) +{ + sratom_read(_sratom.get(), this, world.c_obj(), model, node); +} + +const LV2_Atom* +AtomForge::atom() const +{ + return _buf.get(); +} + +void +AtomForge::clear() +{ + lv2_atom_forge_set_sink(this, c_append, c_deref, this); + _size = 0; + *_buf = {0U, 0U}; +} + +Sratom& +AtomForge::sratom() +{ + return *_sratom; +} + +intptr_t +AtomForge::append(const void* const data, const uint32_t len) +{ + // Record offset of the start of this write (+1 to avoid null) + const auto ref = static_cast<intptr_t>(_size + 1U); + + // Update size and reallocate if necessary + if (lv2_atom_pad_size(_size + len) > _capacity) { + const size_t new_size = lv2_atom_pad_size(_size + len); + + // Release buffer and try to realloc it + auto* const old = _buf.release(); + auto* const new_buf = static_cast<LV2_Atom*>(realloc(old, new_size)); + if (!new_buf) { + // Failure, reclaim old buffer and signal error to caller + _buf = AtomPtr{old, FreeDeleter<LV2_Atom>{}}; + return 0; + } + + // Adopt new buffer and update capacity to make room for the new data + std::unique_ptr<LV2_Atom, FreeDeleter<LV2_Atom>> ptr{new_buf}; + _capacity = new_size; + _buf = std::move(ptr); + } + + // Append new data + memcpy(reinterpret_cast<uint8_t*>(_buf.get()) + _size, data, len); + _size += len; + return ref; +} + +LV2_Atom* +AtomForge::deref(const intptr_t ref) +{ + /* Make some assumptions and do unnecessary math to appease + -Wcast-align. This is questionable at best, though the forge should + only dereference references to aligned atoms. */ + LV2_Atom* const ptr = _buf.get(); + assert((ref - 1) % sizeof(LV2_Atom) == 0); + return static_cast<LV2_Atom*>(ptr + ((ref - 1) / sizeof(LV2_Atom))); + + // Alternatively: + // return (LV2_Atom*)((uint8_t*)_buf.get() + ref - 1); +} + +LV2_Atom_Forge_Ref +AtomForge::c_append(void* const self, + const void* const data, + const uint32_t len) +{ + return static_cast<AtomForge*>(self)->append(data, len); +} + +LV2_Atom* +AtomForge::c_deref(void* const self, const LV2_Atom_Forge_Ref ref) +{ + return static_cast<AtomForge*>(self)->deref(ref); +} + +} // namespace ingen diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index df9a8e4b..21cb9e40 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -14,21 +14,21 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/AtomReader.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" -#include "ingen/Message.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/URIs.hpp" -#include "ingen/paths.hpp" -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "raul/Path.hpp" +#include <ingen/AtomReader.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Log.hpp> +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/URIs.hpp> +#include <ingen/paths.hpp> +#include <lv2/atom/atom.h> +#include <lv2/atom/util.h> +#include <raul/Path.hpp> #include <cstdint> #include <cstring> diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index e18b48b8..5200cfde 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -47,26 +47,27 @@ * manipulating data in this model which resemble HTTP methods. */ -#include "ingen/AtomWriter.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/AtomForge.hpp" -#include "ingen/AtomSink.hpp" -#include "ingen/Message.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/URIs.hpp" -#include "ingen/paths.hpp" -#include "lv2/atom/forge.h" -#include "lv2/urid/urid.h" -#include "raul/Path.hpp" -#include "serd/serd.h" +#include <ingen/AtomWriter.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/AtomForge.hpp> +#include <ingen/AtomSink.hpp> +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/URIs.hpp> +#include <ingen/paths.hpp> +#include <lv2/atom/forge.h> +#include <lv2/urid/urid.h> +#include <raul/Path.hpp> +#include <serd/serd.h> #include <cassert> #include <cstdint> #include <map> +#include <string> #include <utility> #include <variant> @@ -293,8 +294,8 @@ AtomWriter::operator()(const Delta& message) * Send a [Copy](http://lv2plug.in/ns/ext/copy#Copy) to copy an object from * its current location (subject) to another (destination). * - * If both the subject and destination are inside Ingen, like block paths, then the old object - * is copied by, for example, creating a new plugin instance. + * If both the subject and destination are inside Ingen, like block paths, then + * the old object is copied by, for example, creating a new plugin instance. * * If the subject is a filename (file URI or atom:Path) and the destination is * inside Ingen, then the subject must be an Ingen graph file or bundle, which @@ -434,7 +435,8 @@ AtomWriter::operator()(const Undo& message) /** @page protocol * @subsection Undo * - * Use [ingen:Redo](http://drobilla.net/ns/ingen#Redo) to redo the last undone change. + * Use [ingen:Redo](http://drobilla.net/ns/ingen#Redo) to redo the last undone + * change. * * @code{.ttl} * [] a ingen:Redo . diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index b782bcc7..ed4dc91a 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -14,12 +14,12 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/ClashAvoider.hpp" -#include "ingen/Store.hpp" -#include "ingen/URI.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/ClashAvoider.hpp> +#include <ingen/Store.hpp> +#include <ingen/URI.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <cassert> #include <cctype> @@ -62,7 +62,7 @@ ClashAvoider::map_path(const raul::Path& in) // Path without _n suffix std::string base_path_str = in; if (has_offset) { - base_path_str = base_path_str.substr(0, base_path_str.find_last_of('_')); + base_path_str.resize(base_path_str.find_last_of('_')); } raul::Path base_path(base_path_str); @@ -98,12 +98,6 @@ ClashAvoider::map_path(const raul::Path& in) auto o = _offsets.find(base_path); if (o != _offsets.end()) { offset = ++o->second; - } else { - std::string parent_str = in.parent().base(); - parent_str = parent_str.substr(0, parent_str.find_last_of('/')); - if (parent_str.empty()) { - parent_str = "/"; - } } if (offset == 0) { @@ -158,13 +152,13 @@ numeric_suffix_start(const std::string& str) } std::string -ClashAvoider::adjust_name(const raul::Path& old_path, - const raul::Path& new_path, - std::string name) +ClashAvoider::adjust_name(const raul::Path& old_path, + const raul::Path& new_path, + const std::string& name) { const auto name_suffix_start = numeric_suffix_start(name); if (!name_suffix_start) { - return name; // No numeric suffix, just re-use old label + return name; // No numeric suffix, just reuse old label } const auto name_suffix = atoi(name.c_str() + *name_suffix_start); diff --git a/src/ColorContext.cpp b/src/ColorContext.cpp index a4e60ca5..9706cb81 100644 --- a/src/ColorContext.cpp +++ b/src/ColorContext.cpp @@ -14,7 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/ColorContext.hpp" +#include <ingen/ColorContext.hpp> + #include "ingen_config.h" #if USE_ISATTY diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 918bd9d3..9abdc288 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -14,26 +14,34 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Configuration.hpp" -#include "ingen/Forge.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/fmt.hpp" -#include "ingen/ingen.h" -#include "ingen/runtime_paths.hpp" -#include "lv2/urid/urid.h" -#include "serd/serd.h" -#include "sord/sord.h" -#include "sord/sordmm.hpp" -#include "sratom/sratom.h" +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/FilePath.hpp> +#include <ingen/Forge.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/fmt.hpp> +#include <ingen/ingen.h> +#include <ingen/runtime_paths.hpp> +#include <lv2/urid/urid.h> +#include <serd/serd.h> +#include <sord/sord.h> +#include <sord/sordmm.hpp> +#include <sratom/sratom.h> #include <algorithm> #include <cassert> #include <cerrno> #include <cstdint> +#include <cstdio> #include <cstdlib> #include <cstring> #include <filesystem> +#include <list> +#include <map> #include <memory> +#include <ostream> +#include <string> +#include <system_error> #include <thread> #include <utility> #include <vector> @@ -185,7 +193,7 @@ Configuration::parse(int argc, char** argv) std::string name = std::string(argv[i]).substr(2); const char* equals = strchr(argv[i], '='); if (equals) { - name = name.substr(0, name.find('=')); + name.resize(name.find('=')); } const auto o = _options.find(name); @@ -284,8 +292,10 @@ Configuration::save(URIMap& uri_map, } // Create parent directories if necessary - const FilePath dir = path.parent_path(); - if (!std::filesystem::create_directories(dir)) { + const FilePath dir = path.parent_path(); + std::error_code ec; + std::filesystem::create_directories(dir, ec); + if (ec) { throw FileError(fmt("Error creating directory %1% (%2%)", dir, strerror(errno))); } diff --git a/src/Forge.cpp b/src/Forge.cpp index abce74f2..8b222c64 100644 --- a/src/Forge.cpp +++ b/src/Forge.cpp @@ -14,13 +14,16 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Forge.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIMap.hpp" -#include "lv2/atom/forge.h" -#include "lv2/urid/urid.h" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIMap.hpp> +#include <lv2/atom/forge.h> +#include <lv2/urid/urid.h> +#include <cstdint> #include <sstream> +#include <string> namespace ingen { diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index 7d9003c0..73cc9382 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.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 @@ -14,10 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/LV2Features.hpp" +#include <ingen/LV2Features.hpp> -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> +#include <algorithm> #include <cstdlib> #include <memory> @@ -30,6 +31,12 @@ LV2Features::Feature::free_feature(LV2_Feature* feature) free(feature); } +std::shared_ptr<LV2_Feature> +LV2Features::EmptyFeature::feature(World& world, Node* block) +{ + return std::make_shared<LV2_Feature>(LV2_Feature{_uri, nullptr}); +} + void LV2Features::add_feature(const std::shared_ptr<Feature>& feature) { @@ -58,12 +65,9 @@ LV2Features::is_supported(const std::string& uri) const return true; } - for (const auto& f : _features) { - if (f->uri() == uri) { - return true; - } - } - return false; + return std::any_of(_features.begin(), + _features.end(), + [&uri](const auto& f) { return f->uri() == uri; }); } std::shared_ptr<LV2Features::FeatureArray> diff --git a/src/Library.cpp b/src/Library.cpp index a8a7107e..4add6577 100644 --- a/src/Library.cpp +++ b/src/Library.cpp @@ -14,7 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Library.hpp" +#include <ingen/FilePath.hpp> +#include <ingen/Library.hpp> #ifdef _WIN32 # include <windows.h> diff --git a/src/Log.cpp b/src/Log.cpp index e17e1555..fbcaeca1 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2016 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 @@ -14,19 +14,20 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Log.hpp" +#include <ingen/Log.hpp> -#include "ingen/ColorContext.hpp" -#include "ingen/Node.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "lv2/core/lv2.h" -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" -#include "raul/Path.hpp" +#include <ingen/ColorContext.hpp> +#include <ingen/Node.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <lv2/core/lv2.h> +#include <lv2/log/log.h> +#include <lv2/urid/urid.h> +#include <raul/Path.hpp> #include <cstdio> #include <cstdlib> +#include <memory> namespace ingen { @@ -39,46 +40,44 @@ void Log::rt_error(const char* msg) { #ifndef NDEBUG - va_list args; - vtprintf(_uris.log_Error, msg, args); + tprintf(_uris.log_Error, msg); #endif } void Log::error(const std::string& msg) { - va_list args; - vtprintf(_uris.log_Error, msg.c_str(), args); + tprintf(_uris.log_Error, msg.c_str()); } void Log::warn(const std::string& msg) { - va_list args; - vtprintf(_uris.log_Warning, msg.c_str(), args); + tprintf(_uris.log_Warning, msg.c_str()); } void Log::info(const std::string& msg) { - va_list args; - vtprintf(_uris.log_Note, msg.c_str(), args); + tprintf(_uris.log_Note, msg.c_str()); } void Log::trace(const std::string& msg) { - va_list args; - vtprintf(_uris.log_Trace, msg.c_str(), args); + tprintf(_uris.log_Trace, msg.c_str()); } -void -Log::print(FILE* stream, const std::string& msg) const +int +Log::tprintf(LV2_URID type, const char* fmt, ...) { - fprintf(stream, "%s", msg.c_str()); - if (_flush) { - fflush(stdout); - } + va_list args; + va_start(args, fmt); + + const int ret = vtprintf(type, fmt, args); + + va_end(args); + return ret; } int @@ -120,11 +119,10 @@ Log::vtprintf(LV2_URID type, const char* fmt, va_list args) static int log_vprintf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, va_list args) { - auto* f = static_cast<Log::Feature::Handle*>(handle); - va_list noargs = {}; + auto* const f = static_cast<Log::Feature::Handle*>(handle); - int ret = f->log->vtprintf(type, f->node->path().c_str(), noargs); - ret += f->log->vtprintf(type, ": ", noargs); + int ret = f->log->tprintf(type, f->node->path().c_str()); + ret += f->log->tprintf(type, ": "); ret += f->log->vtprintf(type, fmt, args); return ret; diff --git a/src/Parser.cpp b/src/Parser.cpp index 2a22c31b..c03f0abf 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -14,28 +14,31 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Parser.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/AtomForge.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.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 "ingen/paths.hpp" -#include "lv2/atom/atom.h" -#include "lv2/core/lv2.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" -#include "serd/serd.h" -#include "sord/sord.h" -#include "sord/sordmm.hpp" - +#include <ingen/Parser.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/AtomForge.hpp> +#include <ingen/FilePath.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.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 <ingen/ingen.h> +#include <ingen/paths.hpp> +#include <lv2/atom/atom.h> +#include <lv2/core/lv2.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <serd/serd.h> +#include <sord/sord.h> +#include <sord/sordmm.hpp> + +#include <algorithm> #include <cassert> #include <cstdint> #include <cstring> @@ -633,19 +636,18 @@ Parser::parse_file(ingen::World& world, return false; } - /* Choose the graph to load. If this is a manifest, then there should only - be one, but if this is a graph file, subgraphs will be returned as well. - In this case, choose the one with the file URI. */ - URI uri; - for (const ResourceRecord& r : resources) { - if (r.uri == URI(manifest_path)) { - uri = r.uri; - file_path = r.filename; - break; - } - } + // Try to find the graph with the manifest path for a URI + const auto m = std::find_if(resources.begin(), + resources.end(), + [manifest_path](const auto& r) { + return r.uri == URI(manifest_path); + }); - if (uri.empty()) { + URI uri; + if (m != resources.end()) { + uri = m->uri; + file_path = m->filename; + } else { // Didn't find a graph with the same URI as the file, use the first uri = (*resources.begin()).uri; file_path = (*resources.begin()).filename; diff --git a/src/Resource.cpp b/src/Resource.cpp index 2171c438..29a82772 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -14,11 +14,13 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Resource.hpp" +#include <ingen/Resource.hpp> -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/URIs.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> #include <map> #include <utility> @@ -51,6 +53,8 @@ Resource::add_property(const URI& uri, const Atom& value, Graph ctx) const Atom& Resource::set_property(const URI& uri, const Atom& value, Resource::Graph ctx) { + assert(uri != _uris.ingen_activity); // Always ephemeral + // Erase existing property in this context for (auto i = _properties.find(uri); (i != _properties.end()) && (i->first == uri);) { @@ -64,16 +68,10 @@ Resource::set_property(const URI& uri, const Atom& value, Resource::Graph ctx) i = next; } - if (uri != _uris.ingen_activity) { - // Insert new property - const Atom& v = _properties.emplace(uri, Property(value, ctx))->second; - on_property(uri, v); - return v; - } - - // Announce ephemeral activity, but do not store - on_property(uri, value); - return value; + // Insert new property + const Atom& v = _properties.emplace(uri, Property(value, ctx))->second; + on_property(uri, v); + return v; } const Atom& diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index 860334d6..785e12ba 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -14,30 +14,32 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Serialiser.hpp" - -#include "ingen/Arc.hpp" -#include "ingen/Atom.hpp" -#include "ingen/FilePath.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Log.hpp" -#include "ingen/Node.hpp" -#include "ingen/Resource.hpp" -#include "ingen/Store.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "lv2/core/lv2.h" -#include "lv2/state/state.h" -#include "lv2/ui/ui.h" -#include "lv2/urid/urid.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" -#include "serd/serd.h" -#include "sord/sord.h" -#include "sord/sordmm.hpp" -#include "sratom/sratom.h" +#include <ingen/Serialiser.hpp> + +#include <ingen/Arc.hpp> +#include <ingen/Atom.hpp> +#include <ingen/FilePath.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Log.hpp> +#include <ingen/Node.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/Store.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/ingen.h> +#include <lv2/core/lv2.h> +#include <lv2/state/state.h> +#include <lv2/ui/ui.h> +#include <lv2/urid/urid.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <serd/serd.h> +#include <sord/sord.h> +#include <sord/sordmm.hpp> +#include <sratom/sratom.h> #include <cassert> #include <cstdint> diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp index d1014a95..5499fb66 100644 --- a/src/SocketReader.cpp +++ b/src/SocketReader.cpp @@ -14,18 +14,18 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/SocketReader.hpp" - -#include "ingen/AtomForge.hpp" -#include "ingen/AtomReader.hpp" -#include "ingen/Log.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/World.hpp" -#include "lv2/urid/urid.h" -#include "raul/Socket.hpp" -#include "serd/serd.h" -#include "sord/sord.h" -#include "sord/sordmm.hpp" +#include <ingen/SocketReader.hpp> + +#include <ingen/AtomForge.hpp> +#include <ingen/AtomReader.hpp> +#include <ingen/Log.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/World.hpp> +#include <lv2/urid/urid.h> +#include <raul/Socket.hpp> +#include <serd/serd.h> +#include <sord/sord.h> +#include <sord/sordmm.hpp> #include <cerrno> #include <cstdint> diff --git a/src/SocketWriter.cpp b/src/SocketWriter.cpp index 47427e7f..7512ecbd 100644 --- a/src/SocketWriter.cpp +++ b/src/SocketWriter.cpp @@ -14,10 +14,12 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/SocketWriter.hpp" +#include <ingen/SocketWriter.hpp> -#include "ingen/URI.hpp" -#include "raul/Socket.hpp" +#include <ingen/Message.hpp> +#include <ingen/TurtleWriter.hpp> +#include <ingen/URI.hpp> +#include <raul/Socket.hpp> #include <memory> #include <sys/socket.h> diff --git a/src/Store.cpp b/src/Store.cpp index d85d5932..ab8425cb 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -14,11 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Store.hpp" +#include <ingen/Store.hpp> -#include "ingen/Node.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Node.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <cassert> #include <cstdint> diff --git a/src/StreamWriter.cpp b/src/StreamWriter.cpp index 0d3d97d6..c40389e4 100644 --- a/src/StreamWriter.cpp +++ b/src/StreamWriter.cpp @@ -14,10 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/StreamWriter.hpp" +#include <ingen/StreamWriter.hpp> -#include "ingen/ColorContext.hpp" -#include "ingen/URI.hpp" +#include <ingen/ColorContext.hpp> +#include <ingen/TurtleWriter.hpp> +#include <ingen/URI.hpp> namespace ingen { diff --git a/src/TurtleWriter.cpp b/src/TurtleWriter.cpp index 61f8b543..e19c14e2 100644 --- a/src/TurtleWriter.cpp +++ b/src/TurtleWriter.cpp @@ -14,12 +14,15 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/TurtleWriter.hpp" - -#include "ingen/URIMap.hpp" -#include "lv2/atom/atom.h" -#include "serd/serd.h" -#include "sratom/sratom.h" +#include <ingen/TurtleWriter.hpp> + +#include <ingen/AtomWriter.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/ingen.h> +#include <lv2/atom/atom.h> +#include <serd/serd.h> +#include <sratom/sratom.h> #include <utility> diff --git a/src/URI.cpp b/src/URI.cpp index c4020c4d..3161b7d2 100644 --- a/src/URI.cpp +++ b/src/URI.cpp @@ -14,11 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/URI.hpp" +#include <ingen/URI.hpp> -#include "ingen/FilePath.hpp" -#include "serd/serd.h" -#include "sord/sordmm.hpp" +#include <ingen/FilePath.hpp> +#include <serd/serd.h> +#include <sord/sordmm.hpp> #include <cassert> @@ -52,14 +52,14 @@ URI::URI(const std::string& str, const URI& base) { } -URI::URI(SerdNode node) +URI::URI(const SerdNode& node) : _uri(SERD_URI_NULL) , _node(serd_node_new_uri_from_node(&node, nullptr, &_uri)) { assert(node.type == SERD_URI); } -URI::URI(SerdNode node, SerdURI uri) : _uri(uri), _node(node) +URI::URI(const SerdNode& node, const SerdURI& uri) : _uri(uri), _node(node) { assert(node.type == SERD_URI); } diff --git a/src/URIMap.cpp b/src/URIMap.cpp index bb484529..25764762 100644 --- a/src/URIMap.cpp +++ b/src/URIMap.cpp @@ -14,11 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/URIMap.hpp" +#include <ingen/URIMap.hpp> -#include "ingen/Log.hpp" -#include "ingen/URI.hpp" -#include "lv2/urid/urid.h" +#include <ingen/Log.hpp> +#include <ingen/URI.hpp> +#include <lv2/urid/urid.h> #include <cassert> #include <cstdint> diff --git a/src/URIs.cpp b/src/URIs.cpp index 27e2e8f1..49eb1707 100644 --- a/src/URIs.cpp +++ b/src/URIs.cpp @@ -14,26 +14,27 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/URIs.hpp" +#include <ingen/URIs.hpp> -#include "ingen/Forge.hpp" -#include "ingen/ingen.h" -#include "lilv/lilv.h" -#include "lv2/atom/atom.h" -#include "lv2/buf-size/buf-size.h" -#include "lv2/core/lv2.h" -#include "lv2/log/log.h" -#include "lv2/midi/midi.h" -#include "lv2/morph/morph.h" -#include "lv2/options/options.h" -#include "lv2/parameters/parameters.h" -#include "lv2/patch/patch.h" -#include "lv2/port-props/port-props.h" -#include "lv2/presets/presets.h" -#include "lv2/resize-port/resize-port.h" -#include "lv2/state/state.h" -#include "lv2/time/time.h" -#include "lv2/worker/worker.h" +#include <ingen/Forge.hpp> +#include <ingen/URI.hpp> +#include <ingen/ingen.h> +#include <lilv/lilv.h> +#include <lv2/atom/atom.h> +#include <lv2/buf-size/buf-size.h> +#include <lv2/core/lv2.h> +#include <lv2/log/log.h> +#include <lv2/midi/midi.h> +#include <lv2/morph/morph.h> +#include <lv2/options/options.h> +#include <lv2/parameters/parameters.h> +#include <lv2/patch/patch.h> +#include <lv2/port-props/port-props.h> +#include <lv2/presets/presets.h> +#include <lv2/resize-port/resize-port.h> +#include <lv2/state/state.h> +#include <lv2/time/time.h> +#include <lv2/worker/worker.h> namespace ingen { diff --git a/src/World.cpp b/src/World.cpp index 03a47773..7e643002 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -14,29 +14,29 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/World.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/DataAccess.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/Forge.hpp" -#include "ingen/InstanceAccess.hpp" -#include "ingen/LV2Features.hpp" -#include "ingen/Library.hpp" -#include "ingen/Log.hpp" -#include "ingen/Module.hpp" -#include "ingen/Parser.hpp" -#include "ingen/Serialiser.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/URIs.hpp" -#include "ingen/ingen.h" -#include "ingen/runtime_paths.hpp" -#include "lilv/lilv.h" -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" -#include "sord/sordmm.hpp" +#include <ingen/World.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/DataAccess.hpp> +#include <ingen/EngineBase.hpp> +#include <ingen/Forge.hpp> +#include <ingen/InstanceAccess.hpp> +#include <ingen/LV2Features.hpp> +#include <ingen/Library.hpp> +#include <ingen/Log.hpp> +#include <ingen/Module.hpp> +#include <ingen/Parser.hpp> +#include <ingen/Serialiser.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIMap.hpp> +#include <ingen/URIs.hpp> +#include <ingen/ingen.h> +#include <ingen/runtime_paths.hpp> +#include <lilv/lilv.h> +#include <lv2/log/log.h> +#include <lv2/urid/urid.h> +#include <sord/sordmm.hpp> #include <cstdint> #include <filesystem> diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index dce30655..beef0117 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -14,17 +14,21 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/BlockModel.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "lilv/lilv.h" -#include "lv2/core/lv2.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/client/BlockModel.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <lilv/lilv.h> +#include <lv2/core/lv2.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> + +#include <sigc++/signal.h> #include <algorithm> #include <cassert> @@ -75,23 +79,26 @@ BlockModel::~BlockModel() void BlockModel::remove_port(const std::shared_ptr<PortModel>& port) { - for (auto i = _ports.begin(); i != _ports.end(); ++i) { - if ((*i) == port) { - _ports.erase(i); - break; - } + const auto i = std::find_if(_ports.begin(), + _ports.end(), + [&port](const auto& p) { return p == port; }); + + if (i != _ports.end()) { + _ports.erase(i); + _signal_removed_port.emit(port); } - _signal_removed_port.emit(port); } void BlockModel::remove_port(const raul::Path& port_path) { - for (auto i = _ports.begin(); i != _ports.end(); ++i) { - if ((*i)->path() == port_path) { - _ports.erase(i); - break; - } + const auto i = + std::find_if(_ports.begin(), _ports.end(), [&port_path](const auto& p) { + return p->path() == port_path; + }); + + if (i != _ports.end()) { + _ports.erase(i); } } @@ -219,7 +226,7 @@ BlockModel::port_value_range(const std::shared_ptr<const PortModel>& port, default_port_value_range(port, min, max); - // Possibly overriden + // Possibly overridden const Atom& min_atom = port->get_property(_uris.lv2_minimum); const Atom& max_atom = port->get_property(_uris.lv2_maximum); if (min_atom.type() == _uris.forge.Float) { diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 7cfd439d..9f224db3 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -14,23 +14,27 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/ClientStore.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Log.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ArcModel.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/client/SigClientInterface.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" +#include <ingen/client/ClientStore.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Log.hpp> +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/Store.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ArcModel.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <ingen/client/SigClientInterface.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <sigc++/signal.h> #include <sigc++/functors/mem_fun.h> @@ -79,7 +83,7 @@ ClientStore::add_object(const std::shared_ptr<ObjectModel>& object) assert(object->path().is_child_of(parent->path())); object->set_parent(parent); parent->add_child(object); - assert(parent && (object->parent() == parent)); + assert(object->parent() == parent); (*this)[object->path()] = object; _signal_new_object.emit(object); diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index 1404f021..fe119361 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -14,16 +14,17 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/GraphModel.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ArcModel.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "raul/Path.hpp" +#include <ingen/client/GraphModel.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ArcModel.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <raul/Path.hpp> +#include <sigc++/signal.h> #include <cassert> #include <map> @@ -31,6 +32,10 @@ #include <string> #include <utility> +namespace ingen { +class Node; +} // namespace ingen + namespace ingen::client { GraphModel::GraphModel(URIs& uris, const raul::Path& graph_path) @@ -179,11 +184,4 @@ GraphModel::internal_poly() const return poly.is_valid() ? poly.get<int32_t>() : 1; } -bool -GraphModel::polyphonic() const -{ - const Atom& poly = get_property(_uris.ingen_polyphonic); - return poly.is_valid() && poly.get<int32_t>(); -} - } // namespace ingen::client diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 0c3bf517..4baa895c 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -14,16 +14,17 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/ObjectModel.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Node.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URIs.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/client/ObjectModel.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Node.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URIs.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <sigc++/signal.h> #include <cassert> #include <cstdint> diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 333bf568..f4dfccd2 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -14,13 +14,19 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/PluginModel.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/client/PluginUI.hpp" -#include "lilv/lilv.h" -#include "lv2/core/lv2.h" -#include "raul/Symbol.hpp" +#include <ingen/client/PluginModel.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/PluginUI.hpp> +#include <lilv/lilv.h> +#include <lv2/core/lv2.h> +#include <raul/Symbol.hpp> +#include <sigc++/signal.h> #include <cctype> #include <cstring> @@ -103,7 +109,7 @@ PluginModel::get_property(const URI& key) const size_t last_delim = last_uri_delim(str); while (last_delim != string::npos && !contains_alpha_after(str, last_delim)) { - str = str.substr(0, last_delim); + str.resize(last_delim); last_delim = last_uri_delim(str); } str = str.substr(last_delim + 1); diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 61813cab..c4aa748f 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -14,22 +14,24 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/PluginUI.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Log.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "lilv/lilv.h" -#include "lv2/atom/atom.h" -#include "lv2/core/lv2.h" -#include "lv2/ui/ui.h" -#include "raul/Symbol.hpp" -#include "suil/suil.h" +#include <ingen/client/PluginUI.hpp> + +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/LV2Features.hpp> +#include <ingen/Log.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <lilv/lilv.h> +#include <lv2/atom/atom.h> +#include <lv2/core/lv2.h> +#include <lv2/ui/ui.h> +#include <raul/Symbol.hpp> +#include <suil/suil.h> #include <sigc++/signal.h> diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index 73f273c7..14a5297e 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.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 @@ -14,18 +14,20 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/client/PortModel.hpp" +#include <ingen/client/PortModel.hpp> -#include "ingen/Properties.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "lv2/urid/urid.h" +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <lv2/urid/urid.h> +#include <sigc++/signal.h> +#include <algorithm> #include <cstdint> +#include <exception> #include <map> #include <memory> -#include <utility> namespace ingen::client { @@ -60,14 +62,24 @@ PortModel::port_property(const URIs::Quark& uri) const bool PortModel::is_uri() const { - // FIXME: Resource::has_property doesn't work, URI != URID - for (const auto& p : properties()) { - if (p.second.type() == _uris.atom_URID && - static_cast<LV2_URID>(p.second.get<int32_t>()) == _uris.atom_URID) { - return true; - } - } - return false; + return std::any_of( + properties().begin(), properties().end(), [this](const auto& p) { + return (p.second.type() == _uris.atom_URID && + static_cast<LV2_URID>(p.second.template get<int32_t>()) == + _uris.atom_URID); + }); +} + +void +PortModel::add_child(const std::shared_ptr<ObjectModel>&) +{ + std::terminate(); +} + +bool +PortModel::remove_child(const std::shared_ptr<ObjectModel>&) +{ + std::terminate(); } void diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp index 63705ebc..88619115 100644 --- a/src/client/ingen_client.cpp +++ b/src/client/ingen_client.cpp @@ -14,20 +14,15 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Module.hpp" +#include <ingen/Module.hpp> -namespace ingen { - -class World; - -namespace client { +namespace ingen::client { struct ClientModule : public ingen::Module { void load(ingen::World& world) override {} }; -} // namespace client -} // namespace ingen +} // namespace ingen::client extern "C" { diff --git a/src/gui/App.cpp b/src/gui/App.cpp index bd57696e..260afdba 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -27,26 +27,31 @@ #include "WindowFactory.hpp" #include "rgba.hpp" -#include "ingen/Atom.hpp" -#include "ingen/ColorContext.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" -#include "ingen/QueuedInterface.hpp" -#include "ingen/Status.hpp" -#include "ingen/StreamWriter.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/client/SigClientInterface.hpp" -#include "ingen/runtime_paths.hpp" -#include "lilv/lilv.h" -#include "lv2/urid/urid.h" -#include "suil/suil.h" +#include <ingen/Atom.hpp> +#include <ingen/ColorContext.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/EngineBase.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Log.hpp> +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/QueuedInterface.hpp> +#include <ingen/Resource.hpp> +#include <ingen/Status.hpp> +#include <ingen/StreamWriter.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <ingen/client/SigClientInterface.hpp> +#include <ingen/fmt.hpp> +#include <ingen/runtime_paths.hpp> +#include <lilv/lilv.h> +#include <lv2/urid/urid.h> +#include <suil/suil.h> #include <glib.h> #include <glibmm/main.h> @@ -67,6 +72,7 @@ #include <algorithm> #include <cassert> +#include <cstdarg> #include <cstdio> #include <exception> #include <iostream> diff --git a/src/gui/App.hpp b/src/gui/App.hpp index d7776896..0138f25a 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -17,13 +17,13 @@ #ifndef INGEN_GUI_APP_HPP #define INGEN_GUI_APP_HPP -#include "ingen/Message.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "ingen/ingen.h" -#include "lilv/lilv.h" +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <ingen/ingen.h> +#include <lilv/lilv.h> #include <sigc++/signal.h> @@ -77,6 +77,11 @@ class INGEN_API App public: ~App(); + App(const App&) = delete; + App& operator=(const App&) = delete; + App(App&&) = delete; + App& operator=(App&&) = delete; + void error_message(const std::string& str); void attach(const std::shared_ptr<ingen::Interface>& client); diff --git a/src/gui/Arc.cpp b/src/gui/Arc.cpp index 17cd57df..c13cf4a7 100644 --- a/src/gui/Arc.cpp +++ b/src/gui/Arc.cpp @@ -16,11 +16,12 @@ #include "Arc.hpp" -#include "ingen/URI.hpp" -#include "ingen/client/ArcModel.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PortModel.hpp" +#include <ganv/Edge.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/ArcModel.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PortModel.hpp> #include <glib-object.h> diff --git a/src/gui/Arc.hpp b/src/gui/Arc.hpp index 82467a5a..ad1bc6f2 100644 --- a/src/gui/Arc.hpp +++ b/src/gui/Arc.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_GUI_ARC_HPP #define INGEN_GUI_ARC_HPP -#include "ganv/Edge.hpp" +#include <ganv/Edge.hpp> #include <memory> diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index be613407..5bd4d30a 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -19,13 +19,17 @@ #include "App.hpp" #include "GraphView.hpp" -#include "ingen/client/SigClientInterface.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Message.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/SigClientInterface.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <sigc++/adaptors/bind.h> #include <sigc++/functors/mem_fun.h> +#include <algorithm> #include <string> #include <variant> @@ -46,13 +50,13 @@ BreadCrumbs::BreadCrumbs(App& app) std::shared_ptr<GraphView> BreadCrumbs::view(const raul::Path& path) { - for (const auto& b : _breadcrumbs) { - if (b->path() == path) { - return b->view(); - } - } + const auto b = std::find_if(_breadcrumbs.begin(), + _breadcrumbs.end(), + [&path](const auto* crumb) { + return crumb->path() == path; + }); - return nullptr; + return b == _breadcrumbs.end() ? nullptr : (*b)->view(); } /** Sets up the crumbs to display `path`. @@ -69,7 +73,7 @@ BreadCrumbs::build(const raul::Path& path, if (!_breadcrumbs.empty() && (path.is_parent_of(_full_path) || path == _full_path)) { // Moving to a path we already contain, just switch the active button - for (const auto& b : _breadcrumbs) { + for (auto* b : _breadcrumbs) { if (b->path() == path) { b->set_active(true); if (!b->view()) { @@ -85,7 +89,6 @@ BreadCrumbs::build(const raul::Path& path, } _active_path = path; - _enable_signal = old_enable_signal; } else if (!_breadcrumbs.empty() && path.is_child_of(_full_path)) { // Moving to a child of the full path, append crumbs (preserve cache) @@ -108,7 +111,7 @@ BreadCrumbs::build(const raul::Path& path, suffix = suffix.substr(suffix.find('/') + 1); } - for (const auto& b : _breadcrumbs) { + for (auto* b : _breadcrumbs) { b->set_active(false); } _breadcrumbs.back()->set_active(true); @@ -121,7 +124,7 @@ BreadCrumbs::build(const raul::Path& path, _active_path = path; // Empty existing breadcrumbs - for (const auto& b : _breadcrumbs) { + for (auto* b : _breadcrumbs) { remove(*b); } _breadcrumbs.clear(); @@ -203,15 +206,19 @@ BreadCrumbs::message(const Message& msg) void BreadCrumbs::object_destroyed(const URI& uri) { - for (auto i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { - if ((*i)->path() == uri.c_str()) { - // Remove all crumbs after the removed one (inclusive) - for (auto j = i; j != _breadcrumbs.end(); ) { - BreadCrumb* bc = *j; - j = _breadcrumbs.erase(j); - remove(*bc); - } - break; + const auto i = std::find_if(_breadcrumbs.begin(), + _breadcrumbs.end(), + [&uri](const auto& b) { + return b->path() == uri.c_str(); + }); + + if (i != _breadcrumbs.end()) { + // Remove all crumbs after the removed one (inclusive) + for (auto j = i; j != _breadcrumbs.end();) { + BreadCrumb* const bc = *j; + + j = _breadcrumbs.erase(j); + remove(*bc); } } } @@ -219,7 +226,7 @@ BreadCrumbs::object_destroyed(const URI& uri) void BreadCrumbs::object_moved(const raul::Path& old_path, const raul::Path& new_path) { - for (const auto& b : _breadcrumbs) { + for (auto* b : _breadcrumbs) { if (b->path() == old_path) { b->set_path(new_path); } diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp index 6501288d..89a339f2 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -19,10 +19,10 @@ #include "GraphView.hpp" -#include "ingen/Message.hpp" -#include "ingen/URI.hpp" -#include "ingen/client/GraphModel.hpp" -#include "raul/Path.hpp" +#include <ingen/Message.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/GraphModel.hpp> +#include <raul/Path.hpp> #include <glibmm/ustring.h> #include <gtkmm/box.h> @@ -71,7 +71,7 @@ private: { public: BreadCrumb(const raul::Path& path, - const std::shared_ptr<GraphView>& view = nullptr) + const std::shared_ptr<GraphView>& view) : _path(path), _view(view) { assert(!view || view->graph()->path() == path); @@ -81,6 +81,10 @@ private: show_all(); } + explicit BreadCrumb(const raul::Path& path) + : BreadCrumb{path, nullptr} + {} + void set_view(const std::shared_ptr<GraphView>& view) { assert(!view || view->graph()->path() == _path); _view = view; diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index b33c3b81..edafdfa4 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -20,23 +20,26 @@ #include "Window.hpp" #include "WindowFactory.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" -#include "ingen/QueuedInterface.hpp" -#include "ingen/Status.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep -#include "ingen/client/SigClientInterface.hpp" -#include "ingen/client/SocketClient.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Process.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/EngineBase.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Log.hpp> +#include <ingen/Message.hpp> +#include <ingen/QueuedInterface.hpp> +#include <ingen/Status.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/SigClientInterface.hpp> +#include <ingen/client/SocketClient.hpp> +#include <ingen/fmt.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Process.hpp> #include <glib.h> #include <glibmm/main.h> @@ -440,18 +443,17 @@ ConnectWindow::internal_toggled() void ConnectWindow::next_stage() { - static const char* labels[] = { - "Connecting...", - "Pinging engine...", - "Attaching to engine...", - "Requesting root graph...", - "Waiting for root graph...", - "Connected" - }; - - ++_connect_stage; if (_widgets_loaded) { + static const char* labels[] = { + "Connecting...", + "Pinging engine...", + "Attaching to engine...", + "Requesting root graph...", + "Waiting for root graph...", + "Connected" + }; + _progress_label->set_text(labels[_connect_stage]); } } @@ -474,8 +476,8 @@ ConnectWindow::gtk_callback() // Show if attempted connection goes on for a noticeable amount of time if (!is_visible()) { - const float ms_since_start = (now.tv_sec - start.tv_sec) * 1000.0f + - (now.tv_usec - start.tv_usec) * 0.001f; + const float ms_since_start = ((now.tv_sec - start.tv_sec) * 1000.0f) + + ((now.tv_usec - start.tv_usec) * 0.001f); if (ms_since_start > 500) { present(); set_connecting_widget_states(); @@ -483,8 +485,8 @@ ConnectWindow::gtk_callback() } if (_connect_stage == 0) { - const float ms_since_last = (now.tv_sec - last.tv_sec) * 1000.0f + - (now.tv_usec - last.tv_usec) * 0.001f; + const float ms_since_last = ((now.tv_sec - last.tv_sec) * 1000.0f) + + ((now.tv_usec - last.tv_usec) * 0.001f); if (ms_since_last >= 250) { last = now; if (_mode == Mode::INTERNAL) { @@ -513,8 +515,8 @@ ConnectWindow::gtk_callback() if (_attached) { next_stage(); } else { - const float ms_since_last = (now.tv_sec - last.tv_sec) * 1000.0f + - (now.tv_usec - last.tv_usec) * 0.001f; + const float ms_since_last = ((now.tv_sec - last.tv_sec) * 1000.0f) + + ((now.tv_usec - last.tv_usec) * 0.001f); if (attempts > 10) { error("Failed to ping engine"); _connect_stage = -1; diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index 269a4d76..cd9059e1 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -19,8 +19,8 @@ #include "Window.hpp" -#include "ingen/Message.hpp" -#include "ingen/URI.hpp" +#include <ingen/Message.hpp> +#include <ingen/URI.hpp> #include <glibmm/refptr.h> #include <gtkmm/builder.h> diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 0764e4ed..47c567e3 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.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 @@ -29,27 +29,28 @@ #include "WindowFactory.hpp" #include "ingen_config.h" -#include "ganv/canvas.h" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.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 "ingen/World.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/fmt.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ganv/canvas.h> +#include <ingen/Atom.hpp> +#include <ingen/Configuration.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 <ingen/World.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <ingen/fmt.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <gdk/gdk.h> +#include <glib.h> #include <glib/gstdio.h> #include <glibmm/convert.h> #include <glibmm/fileutils.h> @@ -91,6 +92,7 @@ # include <webkit/webkit.h> #endif +#include <algorithm> #include <cassert> #include <cstdint> #include <cstdio> @@ -100,7 +102,6 @@ #include <sstream> #include <string> #include <utility> -#include <vector> namespace ingen { @@ -382,12 +383,12 @@ GraphBox::set_graph(const std::shared_ptr<const GraphModel>& graph, _menu_view_control_window->property_sensitive() = false; - for (const auto& p : graph->ports()) { - if (_app->can_control(p.get())) { - _menu_view_control_window->property_sensitive() = true; - break; - } - } + _menu_view_control_window->property_sensitive() = + std::any_of(graph->ports().begin(), + graph->ports().end(), + [this](const auto& p) { + return _app->can_control(p.get()); + }); _menu_parent->property_sensitive() = !!graph->parent(); @@ -425,14 +426,12 @@ GraphBox::graph_port_removed(const std::shared_ptr<const PortModel>& port) return; } - for (const auto& p : _graph->ports()) { - if (p->is_input() && _app->can_control(p.get())) { - _menu_view_control_window->property_sensitive() = true; - return; - } - } - - _menu_view_control_window->property_sensitive() = false; + _menu_view_control_window->property_sensitive() = + std::any_of(_graph->ports().begin(), + _graph->ports().end(), + [this](const auto& p) { + return p->is_input() && _app->can_control(p.get()); + }); } void @@ -885,10 +884,10 @@ GraphBox::event_refresh_activated() void GraphBox::event_fullscreen_toggled() { - // FIXME: ugh, use GTK signals to track state and know for sure - static bool is_fullscreen = false; - if (_window) { + // FIXME: ugh, use GTK signals to track state and know for sure + static bool is_fullscreen = false; + if (!is_fullscreen) { _window->fullscreen(); is_fullscreen = true; diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index cfc4a67f..07962a3d 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_GUI_GRAPH_BOX_HPP #define INGEN_GUI_GRAPH_BOX_HPP -#include "ingen/ingen.h" +#include <ingen/ingen.h> #include <gdk/gdk.h> #include <glibmm/ustring.h> diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 6d5c3b5a..3090186a 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -28,39 +28,42 @@ #include "WidgetFactory.hpp" #include "WindowFactory.hpp" -#include "ganv/Canvas.hpp" -#include "ganv/Edge.hpp" -#include "ganv/Module.hpp" -#include "ganv/Node.hpp" -#include "ganv/Port.hpp" -#include "ganv/canvas.h" -#include "ganv/edge.h" -#include "ganv/module.h" -#include "ganv/types.h" -#include "ingen/Arc.hpp" -#include "ingen/Atom.hpp" -#include "ingen/ClashAvoider.hpp" -#include "ingen/Configuration.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/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ArcModel.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" -#include "sord/sordmm.hpp" +#include <ganv/Canvas.hpp> +#include <ganv/Edge.hpp> +#include <ganv/Module.hpp> +#include <ganv/Node.hpp> +#include <ganv/Port.hpp> +#include <ganv/canvas.h> +#include <ganv/edge.h> +#include <ganv/module.h> +#include <ganv/types.h> +#include <ingen/Arc.hpp> +#include <ingen/Atom.hpp> +#include <ingen/ClashAvoider.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Log.hpp> +#include <ingen/Node.hpp> +#include <ingen/Parser.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/Serialiser.hpp> +#include <ingen/Store.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/ArcModel.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <sord/sordmm.hpp> #include <gdk/gdk.h> #include <gdk/gdkkeysyms-compat.h> @@ -250,7 +253,7 @@ GraphCanvas::build_menus() _menu->reorder_child(*internal_menu_item, 4); } - // Build skeleton LV2 plugin class heirarchy for 'Plugin' menu + // Build skeleton LV2 plugin class hierarchy for 'Plugin' menu if (_plugin_menu) { _plugin_menu->clear(); } else { @@ -266,7 +269,7 @@ GraphCanvas::build_menus() sigc::mem_fun(this, &GraphCanvas::load_plugin)); } - // Add known plugins to menu heirarchy + // Add known plugins to menu hierarchy auto plugins = _app.store()->plugins(); for (const auto& p : *plugins) { add_plugin(p.second); @@ -611,14 +614,14 @@ destroy_node(GanvNode* node, void* data) return; } - App* app = static_cast<App*>(data); + const App* app = static_cast<App*>(data); Ganv::Module* module = Glib::wrap(GANV_MODULE(node)); - auto* node_module = dynamic_cast<NodeModule*>(module); + const auto* node_module = dynamic_cast<NodeModule*>(module); if (node_module) { app->interface()->del(node_module->block()->uri()); } else { - auto* port_module = dynamic_cast<GraphPortModule*>(module); + const auto* port_module = dynamic_cast<GraphPortModule*>(module); if (port_module && strcmp(port_module->port()->path().symbol(), "control") && strcmp(port_module->port()->path().symbol(), "notify")) { @@ -630,11 +633,11 @@ destroy_node(GanvNode* node, void* data) static void destroy_arc(GanvEdge* arc, void* data) { - App* app = static_cast<App*>(data); + const App* app = static_cast<App*>(data); Ganv::Edge* arcmm = Glib::wrap(arc); - Port* tail = dynamic_cast<Port*>(arcmm->get_tail()); - Port* head = dynamic_cast<Port*>(arcmm->get_head()); + const Port* tail = dynamic_cast<Port*>(arcmm->get_tail()); + const Port* head = dynamic_cast<Port*>(arcmm->get_head()); app->interface()->disconnect(tail->model()->path(), head->model()->path()); } @@ -659,12 +662,12 @@ serialise_node(GanvNode* node, void* data) } Ganv::Module* module = Glib::wrap(GANV_MODULE(node)); - auto* node_module = dynamic_cast<NodeModule*>(module); + const auto* node_module = dynamic_cast<NodeModule*>(module); if (node_module) { serialiser->serialise(node_module->block()); } else { - auto* port_module = dynamic_cast<GraphPortModule*>(module); + const auto* port_module = dynamic_cast<GraphPortModule*>(module); if (port_module) { serialiser->serialise(port_module->port()); } @@ -679,7 +682,7 @@ serialise_arc(GanvEdge* arc, void* data) return; } - auto* garc = dynamic_cast<gui::Arc*>(Glib::wrap(GANV_EDGE(arc))); + const auto* garc = dynamic_cast<gui::Arc*>(Glib::wrap(GANV_EDGE(arc))); if (garc) { serialiser->serialise_arc(Sord::Node(), garc->model()); } @@ -735,7 +738,7 @@ GraphCanvas::paste() if (base_uri) { std::string base = *base_uri; if (base[base.size() - 1] == '/') { - base = base.substr(0, base.size() - 1); + base.resize(base.size() - 1); } copy_root = uri_to_path(URI(base)); } diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index 3ebd61df..38f3ab08 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_GUI_GRAPHCANVAS_HPP #define INGEN_GUI_GRAPHCANVAS_HPP -#include "ganv/Canvas.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "lilv/lilv.h" -#include "raul/Path.hpp" +#include <ganv/Canvas.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <lilv/lilv.h> +#include <raul/Path.hpp> #include <gdk/gdk.h> diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index ccbfbebf..cd471d97 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -20,17 +20,18 @@ #include "GraphCanvas.hpp" #include "Port.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "raul/Symbol.hpp" - -#include "ingen/Configuration.hpp" -#include "ingen/Interface.hpp" -#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep -#include "ingen/client/PortModel.hpp" +#include <ganv/Module.hpp> +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <raul/Symbol.hpp> #include <sigc++/functors/mem_fun.h> #include <sigc++/signal.h> diff --git a/src/gui/GraphPortModule.hpp b/src/gui/GraphPortModule.hpp index 56b4521a..a8091f38 100644 --- a/src/gui/GraphPortModule.hpp +++ b/src/gui/GraphPortModule.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_GRAPHPORTMODULE_HPP #define INGEN_GUI_GRAPHPORTMODULE_HPP -#include "ganv/Module.hpp" -#include "ingen/URI.hpp" +#include <ganv/Module.hpp> +#include <ingen/URI.hpp> #include <gdk/gdk.h> #include <glib.h> diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 9c3c4b3d..1d141271 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -20,16 +20,17 @@ #include "Window.hpp" #include "WindowFactory.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Log.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <glibmm/propertyproxy.h> #include <gtkmm/builder.h> @@ -46,6 +47,7 @@ #include <cassert> #include <cstdint> #include <memory> +#include <string> namespace ingen { diff --git a/src/gui/GraphTreeWindow.hpp b/src/gui/GraphTreeWindow.hpp index 16eb4647..6f33f258 100644 --- a/src/gui/GraphTreeWindow.hpp +++ b/src/gui/GraphTreeWindow.hpp @@ -19,7 +19,7 @@ #include "Window.hpp" -#include "ingen/URI.hpp" +#include <ingen/URI.hpp> #include <gdk/gdk.h> #include <glibmm/refptr.h> diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 5464b7c4..8d1e1777 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -20,12 +20,12 @@ #include "GraphCanvas.hpp" #include "WidgetFactory.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/GraphModel.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/GraphModel.hpp> #include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> @@ -45,6 +45,7 @@ #include <cstdint> #include <map> #include <memory> +#include <string> #include <utility> namespace ingen { diff --git a/src/gui/GraphView.hpp b/src/gui/GraphView.hpp index 0b6aee1e..812f2cbc 100644 --- a/src/gui/GraphView.hpp +++ b/src/gui/GraphView.hpp @@ -48,7 +48,7 @@ namespace gui { class App; class GraphCanvas; -/** The graph specific contents of a GraphWindow (ie the canvas and whatever else). +/** The graph specific contents of a GraphWindow (the canvas and whatever else). * * \ingroup GUI */ diff --git a/src/gui/GraphWindow.hpp b/src/gui/GraphWindow.hpp index 05c555a5..9936b5df 100644 --- a/src/gui/GraphWindow.hpp +++ b/src/gui/GraphWindow.hpp @@ -44,8 +44,6 @@ class PortModel; namespace gui { -class App; - /** A window for a graph. * * \ingroup GUI diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index 794cfe71..5124face 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -19,18 +19,19 @@ #include "App.hpp" #include "ThreadedLoader.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/FilePath.hpp" -#include "ingen/Forge.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/runtime_paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/FilePath.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/runtime_paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <glibmm/fileutils.h> #include <glibmm/miscutils.h> @@ -237,7 +238,7 @@ raul::Symbol LoadGraphWindow::symbol_from_filename(const Glib::ustring& filename) { std::string symbol_str = Glib::path_get_basename(get_filename()); - symbol_str = symbol_str.substr(0, symbol_str.find('.')); + symbol_str.resize(symbol_str.find('.')); return raul::Symbol::symbolify(symbol_str); } diff --git a/src/gui/LoadGraphWindow.hpp b/src/gui/LoadGraphWindow.hpp index adb6bce1..bfa2590e 100644 --- a/src/gui/LoadGraphWindow.hpp +++ b/src/gui/LoadGraphWindow.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_LOADGRAPHWINDOW_HPP #define INGEN_GUI_LOADGRAPHWINDOW_HPP -#include "ingen/Properties.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Properties.hpp> +#include <raul/Symbol.hpp> #include <glibmm/ustring.h> #include <gtkmm/filechooserdialog.h> diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index c19baa87..3d8b2cd5 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -19,17 +19,19 @@ #include "App.hpp" #include "Window.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/paths.hpp" -#include "lilv/lilv.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/paths.hpp> +#include <lilv/lilv.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <gdk/gdkkeysyms-compat.h> #include <glibmm/listhandle.h> @@ -41,6 +43,7 @@ #include <gtkmm/combobox.h> #include <gtkmm/enums.h> #include <gtkmm/messagedialog.h> +#include <gtkmm/object.h> #include <gtkmm/treeiter.h> #include <gtkmm/treepath.h> #include <gtkmm/treeview.h> diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index 2f98b3ae..eab48913 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -19,9 +19,9 @@ #include "Window.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URI.hpp" -#include "ingen/client/ClientStore.hpp" +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/ClientStore.hpp> #include <gdk/gdk.h> #include <glibmm/refptr.h> diff --git a/src/gui/MessagesWindow.cpp b/src/gui/MessagesWindow.cpp index 62bcfd00..993fbb33 100644 --- a/src/gui/MessagesWindow.cpp +++ b/src/gui/MessagesWindow.cpp @@ -20,8 +20,8 @@ #include "Window.hpp" #include "ingen_config.h" -#include "ingen/URIs.hpp" -#include "lv2/urid/urid.h" +#include <ingen/URIs.hpp> +#include <lv2/urid/urid.h> #include <gdkmm/color.h> #include <glibmm/propertyproxy.h> diff --git a/src/gui/MessagesWindow.hpp b/src/gui/MessagesWindow.hpp index 27b6a417..0a70e76c 100644 --- a/src/gui/MessagesWindow.hpp +++ b/src/gui/MessagesWindow.hpp @@ -19,7 +19,7 @@ #include "Window.hpp" -#include "lv2/urid/urid.h" +#include <lv2/urid/urid.h> #include <glibmm/refptr.h> #include <gtkmm/texttag.h> @@ -38,8 +38,6 @@ class TextView; namespace ingen::gui { -class App; - /** Messages Window. * * Loaded from XML as a derived object. diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index 3f2fcecb..3d6bf019 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -19,16 +19,17 @@ #include "App.hpp" #include "Window.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.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 <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> diff --git a/src/gui/NewSubgraphWindow.hpp b/src/gui/NewSubgraphWindow.hpp index acb6c977..b0fb24d2 100644 --- a/src/gui/NewSubgraphWindow.hpp +++ b/src/gui/NewSubgraphWindow.hpp @@ -19,7 +19,7 @@ #include "Window.hpp" -#include "ingen/Properties.hpp" +#include <ingen/Properties.hpp> #include <memory> diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index ced303fb..2815194c 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.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 @@ -19,16 +19,17 @@ #include "App.hpp" #include "ObjectMenu.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <raul/Symbol.hpp> #include <glib.h> #include <glibmm/convert.h> @@ -55,6 +56,7 @@ #include <sigc++/adaptors/bind.h> #include <sigc++/functors/mem_fun.h> +#include <algorithm> #include <cstdint> #include <map> #include <memory> @@ -205,7 +207,7 @@ NodeMenu::on_menu_randomize() bm->port_value_range(p, min, max, _app->sample_rate()); const auto r = static_cast<float>(g_random_double_range(0.0, 1.0)); - const float val = r * (max - min) + min; + const float val = (r * (max - min)) + min; _app->set_property(p->uri(), _app->uris().ingen_value, _app->forge().make(val)); @@ -273,13 +275,11 @@ NodeMenu::on_preset_activated(const std::string& uri) bool NodeMenu::has_control_inputs() { - for (const auto& p : block()->ports()) { - if (p->is_input() && p->is_numeric()) { - return true; - } - } - - return false; + return std::any_of(block()->ports().begin(), + block()->ports().end(), + [](const auto& p) { + return p->is_input() && p->is_numeric(); + }); } } // namespace ingen::gui diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index 7168bc7a..0427672c 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -19,7 +19,7 @@ #include "ObjectMenu.hpp" -#include "ingen/URI.hpp" +#include <ingen/URI.hpp> #include <sigc++/connection.h> #include <sigc++/signal.h> diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 20cfdbb3..deb8fe52 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -27,24 +27,26 @@ #include "WindowFactory.hpp" #include "ingen_config.h" -#include "ganv/Port.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PluginUI.hpp" -#include "ingen/client/PortModel.hpp" -#include "lv2/atom/util.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ganv/Module.hpp> +#include <ganv/Port.hpp> +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Log.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PluginUI.hpp> +#include <ingen/client/PortModel.hpp> +#include <lv2/atom/util.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <glibmm/main.h> #include <glibmm/ustring.h> diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index 226dccd1..64ad8f66 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_NODEMODULE_HPP #define INGEN_GUI_NODEMODULE_HPP -#include "ganv/Module.hpp" -#include "ingen/URI.hpp" +#include <ganv/Module.hpp> +#include <ingen/URI.hpp> #include <gdk/gdk.h> #include <glib.h> diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 1e9e0e94..8c41ff10 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -19,12 +19,13 @@ #include "App.hpp" #include "WindowFactory.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ObjectModel.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ObjectModel.hpp> #include <glibmm/refptr.h> #include <gtkmm/builder.h> diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index de105364..5a4c83f4 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_GUI_OBJECTMENU_HPP #define INGEN_GUI_OBJECTMENU_HPP -#include "ingen/URI.hpp" +#include <ingen/URI.hpp> #include <gtkmm/menu.h> diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp index 53917b1e..26bbed08 100644 --- a/src/gui/PluginMenu.cpp +++ b/src/gui/PluginMenu.cpp @@ -16,11 +16,11 @@ #include "PluginMenu.hpp" -#include "ingen/Log.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/PluginModel.hpp" -#include "lilv/lilv.h" +#include <ingen/Log.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/PluginModel.hpp> +#include <lilv/lilv.h> #include <glibmm/ustring.h> #include <gtkmm/menu_elems.h> diff --git a/src/gui/PluginMenu.hpp b/src/gui/PluginMenu.hpp index b2c75ffe..eb0a565a 100644 --- a/src/gui/PluginMenu.hpp +++ b/src/gui/PluginMenu.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_GUI_PLUGINMENU_HPP #define INGEN_GUI_PLUGINMENU_HPP -#include "lilv/lilv.h" +#include <lilv/lilv.h> #include <gtkmm/menu.h> #include <sigc++/signal.h> @@ -50,7 +50,7 @@ namespace gui { class PluginMenu : public Gtk::Menu { public: - PluginMenu(ingen::World& world); + explicit PluginMenu(ingen::World& world); void clear(); void add_plugin(const std::shared_ptr<client::PluginModel>& p); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index ecba0ac7..4d11e309 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -27,24 +27,25 @@ #include "ingen_config.h" #include "rgba.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/Forge.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 "ingen/client/BlockModel.hpp" -#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PluginModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "lilv/lilv.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" -#include "sord/sordmm.hpp" +#include <ganv/Port.hpp> +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Forge.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 <ingen/client/BlockModel.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <lilv/lilv.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <sord/sordmm.hpp> #include <glibmm/ustring.h> #include <gtkmm/menu.h> diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index 8e8077bc..bfd8e15d 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_GUI_PORT_HPP #define INGEN_GUI_PORT_HPP -#include "ganv/Port.hpp" +#include <ganv/Port.hpp> #include <gdk/gdk.h> #include <glib.h> diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 6cd30066..373425cf 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -19,20 +19,20 @@ #include "App.hpp" #include "ObjectMenu.hpp" -#include "ingen/Atom.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 "ingen/client/BlockModel.hpp" -#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Atom.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 <ingen/client/BlockModel.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PortModel.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <glibmm/refptr.h> #include <gtkmm/builder.h> diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 91473c1a..0dde0ab2 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -21,22 +21,25 @@ #include "URIEntry.hpp" #include "Window.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "lilv/lilv.h" -#include "lv2/urid/urid.h" -#include "raul/Path.hpp" -#include "sord/sordmm.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.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 <ingen/client/ObjectModel.hpp> +#include <lilv/lilv.h> +#include <lv2/urid/urid.h> +#include <raul/Path.hpp> +#include <sord/sordmm.hpp> #include <glibmm/containers.h> #include <glibmm/propertyproxy.h> #include <glibmm/ustring.h> +#include <gtk/gtk.h> #include <gtkmm/alignment.h> #include <gtkmm/bin.h> #include <gtkmm/box.h> diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp index 3210ceaa..e788d140 100644 --- a/src/gui/PropertiesWindow.hpp +++ b/src/gui/PropertiesWindow.hpp @@ -19,9 +19,9 @@ #include "Window.hpp" -#include "ingen/Atom.hpp" -#include "ingen/URI.hpp" -#include "lv2/urid/urid.h" +#include <ingen/Atom.hpp> +#include <ingen/URI.hpp> +#include <lv2/urid/urid.h> #include <glibmm/refptr.h> #include <gtkmm/liststore.h> diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index 64aa893b..09af81af 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -14,16 +14,17 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Forge.hpp" -#include "ingen/Log.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "lilv/lilv.h" - #include "RDFS.hpp" +#include <ingen/Forge.hpp> +#include <ingen/Log.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <lilv/lilv.h> + #include <utility> namespace ingen::gui::rdfs { diff --git a/src/gui/RDFS.hpp b/src/gui/RDFS.hpp index ad4e22e8..e4c2b673 100644 --- a/src/gui/RDFS.hpp +++ b/src/gui/RDFS.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_RDF_HPP #define INGEN_GUI_RDF_HPP -#include "ingen/URI.hpp" -#include "lilv/lilv.h" +#include <ingen/URI.hpp> +#include <lilv/lilv.h> #include <map> #include <memory> diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 0b6bdae9..569baea8 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -19,15 +19,15 @@ #include "App.hpp" #include "Window.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/paths.hpp" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/paths.hpp> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> diff --git a/src/gui/Style.cpp b/src/gui/Style.cpp index 9a9e7478..f1f1b12b 100644 --- a/src/gui/Style.cpp +++ b/src/gui/Style.cpp @@ -18,8 +18,8 @@ #include "App.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/PortModel.hpp" +#include <ingen/URIs.hpp> +#include <ingen/client/PortModel.hpp> #include <string> diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index a2f13b8a..a1b14bb6 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -20,13 +20,13 @@ #include "NodeModule.hpp" #include "WindowFactory.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/GraphModel.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/GraphModel.hpp> #include <cassert> #include <memory> diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 170b9a0e..abbedbaf 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -18,16 +18,17 @@ #include "App.hpp" -#include "ingen/Log.hpp" -#include "ingen/Parser.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Serialiser.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "ingen/client/GraphModel.hpp" -#include "raul/Path.hpp" -#include "raul/Semaphore.hpp" -#include "raul/Symbol.hpp" +#include <ingen/FilePath.hpp> +#include <ingen/Log.hpp> +#include <ingen/Parser.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Serialiser.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <ingen/client/GraphModel.hpp> +#include <raul/Path.hpp> +#include <raul/Semaphore.hpp> +#include <raul/Symbol.hpp> #include <glibmm/ustring.h> #include <sigc++/adaptors/bind.h> diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index 83860461..27ba7c8c 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_THREADEDLOADER_HPP #define INGEN_GUI_THREADEDLOADER_HPP -#include "ingen/FilePath.hpp" -#include "raul/Semaphore.hpp" +#include <ingen/FilePath.hpp> +#include <raul/Semaphore.hpp> #include <sigc++/functors/slot.h> @@ -50,7 +50,7 @@ class App; /** Thread for loading graph files. * - * This is a seperate thread so it can send all the loading message without + * This is a separate thread so it can send all the loading message without * blocking everything else, so the app can respond to the incoming events * caused as a result of the graph loading, while the graph loads. * @@ -88,7 +88,7 @@ private: save_graph_event(const std::shared_ptr<const client::GraphModel>& model, const URI& uri); - /** Returns nothing and takes no parameters (because they have all been bound) */ + /// Returns nothing and takes no parameters (because they're all bound) using Closure = sigc::slot<void>; void run(); diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp index fa03a05b..92320009 100644 --- a/src/gui/URIEntry.cpp +++ b/src/gui/URIEntry.cpp @@ -19,8 +19,9 @@ #include "App.hpp" #include "RDFS.hpp" -#include "ingen/World.hpp" -#include "lilv/lilv.h" +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <lilv/lilv.h> #include <gdk/gdk.h> #include <gtkmm/button.h> diff --git a/src/gui/URIEntry.hpp b/src/gui/URIEntry.hpp index 52c9db66..45fa6894 100644 --- a/src/gui/URIEntry.hpp +++ b/src/gui/URIEntry.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_URI_ENTRY_HPP #define INGEN_GUI_URI_ENTRY_HPP -#include "ingen/URI.hpp" -#include "lilv/lilv.h" +#include <ingen/URI.hpp> +#include <lilv/lilv.h> #include <gdk/gdk.h> #include <glibmm/signalproxy.h> diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp index b2d27e90..33660d77 100644 --- a/src/gui/WidgetFactory.cpp +++ b/src/gui/WidgetFactory.cpp @@ -16,7 +16,7 @@ #include "WidgetFactory.hpp" -#include "ingen/runtime_paths.hpp" +#include <ingen/runtime_paths.hpp> #include <cstdlib> #include <fstream> diff --git a/src/gui/WidgetFactory.hpp b/src/gui/WidgetFactory.hpp index 474071ec..d10a5e1a 100644 --- a/src/gui/WidgetFactory.hpp +++ b/src/gui/WidgetFactory.hpp @@ -19,7 +19,7 @@ #include <glibmm/refptr.h> #include <glibmm/ustring.h> -#include <gtkmm/builder.h> // IWYU pragma: keep +#include <gtkmm/builder.h> #include <string> diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 4fce885c..78acf4fb 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.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 @@ -26,16 +26,17 @@ #include "RenameWindow.hpp" #include "WidgetFactory.hpp" -#include "ingen/Log.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/GraphModel.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "raul/Path.hpp" +#include <ingen/Log.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <raul/Path.hpp> #include <gdkmm/window.h> #include <sigc++/adaptors/bind.h> #include <sigc++/functors/mem_fun.h> +#include <algorithm> #include <cassert> #include <memory> #include <stdexcept> @@ -44,6 +45,8 @@ namespace ingen { +class Properties; + using client::BlockModel; using client::GraphModel; using client::ObjectModel; @@ -93,14 +96,9 @@ WindowFactory::clear() size_t WindowFactory::num_open_graph_windows() { - size_t ret = 0; - for (const auto& w : _graph_windows) { - if (w.second->is_visible()) { - ++ret; - } - } - - return ret; + return std::count_if(_graph_windows.begin(), + _graph_windows.end(), + [](const auto& w) { return w.second->is_visible(); }); } GraphBox* @@ -226,7 +224,7 @@ WindowFactory::present_load_plugin( int width = 0; int height = 0; w->second->get_size(width, height); - _load_plugin_win->set_default_size(width - width / 8, height / 2); + _load_plugin_win->set_default_size(width - (width / 8), height / 2); } _load_plugin_win->set_title( std::string("Load Plugin - ") + graph->path() + " - Ingen"); diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index 2e772da2..e643505a 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_GUI_WINDOWFACTORY_HPP #define INGEN_GUI_WINDOWFACTORY_HPP -#include "ingen/Properties.hpp" -#include "raul/Path.hpp" +#include <ingen/Properties.hpp> +#include <raul/Path.hpp> #include <gdk/gdk.h> diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp index 8ddacb04..7fba2d50 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -16,18 +16,19 @@ #include "App.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Module.hpp" -#include "ingen/QueuedInterface.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "ingen/client/SigClientInterface.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Module.hpp> +#include <ingen/QueuedInterface.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <ingen/client/SigClientInterface.hpp> #include <glibmm/thread.h> #include <memory> +#include <string> namespace ingen::gui { diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 31ec22c5..67290c76 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -17,28 +17,28 @@ #include "App.hpp" #include "GraphBox.hpp" -#include "ingen/AtomReader.hpp" -#include "ingen/AtomSink.hpp" -#include "ingen/AtomWriter.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep -#include "ingen/client/SigClientInterface.hpp" -#include "ingen/ingen.h" -#include "ingen/paths.hpp" -#include "ingen/runtime_paths.hpp" -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/log/log.h" -#include "lv2/ui/ui.h" -#include "lv2/urid/urid.h" -#include "raul/Path.hpp" +#include <ingen/AtomReader.hpp> +#include <ingen/AtomSink.hpp> +#include <ingen/AtomWriter.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/World.hpp> +#include <ingen/client/ClientStore.hpp> +#include <ingen/client/GraphModel.hpp> +#include <ingen/client/SigClientInterface.hpp> +#include <ingen/ingen.h> +#include <ingen/paths.hpp> +#include <ingen/runtime_paths.hpp> +#include <lv2/atom/atom.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/log/log.h> +#include <lv2/ui/ui.h> +#include <lv2/urid/urid.h> +#include <raul/Path.hpp> #include <cstdint> #include <cstring> diff --git a/src/gui/meson.build b/src/gui/meson.build index 3b9a7bb6..810c7829 100644 --- a/src/gui/meson.build +++ b/src/gui/meson.build @@ -30,7 +30,7 @@ gtkmm_dep = dependency( ganv_dep = dependency( 'ganv-1', - fallback: ['ganv', 'ganv_dep'], + include_type: 'system', required: get_option('gui'), version: '>= 1.5.2', ) diff --git a/src/gui/rgba.hpp b/src/gui/rgba.hpp index bb53205e..e01a069d 100644 --- a/src/gui/rgba.hpp +++ b/src/gui/rgba.hpp @@ -34,7 +34,7 @@ rgba_to_uint(uint8_t r, uint8_t g, uint8_t b, uint8_t a) inline uint8_t mono_interpolate(uint8_t v1, uint8_t v2, float f) { - return static_cast<uint8_t>(rintf((v2) * (f) + (v1) * (1 - (f)))); + return static_cast<uint8_t>(rintf((v2 * f) + (v1 * (1.0f - f)))); } #define RGBA_R(x) (static_cast<uint32_t>(x) >> 24) diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index cfe529b8..7f1a587e 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -14,21 +14,21 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/Parser.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "ingen/fmt.hpp" -#include "ingen/paths.hpp" -#include "ingen/runtime_paths.hpp" -#include "ingen_config.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" -#include "serd/serd.h" +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/EngineBase.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/Parser.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <ingen/fmt.hpp> +#include <ingen/paths.hpp> +#include <ingen/runtime_paths.hpp> +#include <ingen_config.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <serd/serd.h> #if USE_SOCKET #include "ingen/client/SocketClient.hpp" diff --git a/src/meson.build b/src/meson.build index abe6193a..bbd4bb5f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,6 +2,7 @@ # SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later sources = files( + 'AtomForge.cpp', 'AtomReader.cpp', 'AtomWriter.cpp', 'ClashAvoider.cpp', @@ -30,13 +31,15 @@ endif ingen_deps = [ boost_dep, - lilv_dep, lv2_dep, raul_dep, serd_dep, + thread_dep, + sord_dep, + + lilv_dep, sratom_dep, - thread_dep, ] ingen_include_dirs = include_directories('../include', 'include') diff --git a/src/runtime_paths.cpp b/src/runtime_paths.cpp index b876ebd4..17167e9a 100644 --- a/src/runtime_paths.cpp +++ b/src/runtime_paths.cpp @@ -14,9 +14,10 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/runtime_paths.hpp" +#include <ingen/runtime_paths.hpp> + +#include <ingen/FilePath.hpp> -#include "ingen/FilePath.hpp" #include "ingen_config.h" #include <cstdlib> @@ -44,7 +45,8 @@ static const char* const library_suffix = ".so"; #endif static std::vector<FilePath> -parse_search_path(const char* search_path, std::vector<FilePath> defaults) +parse_search_path(const char* search_path, + const std::vector<FilePath>& defaults) { if (!search_path) { return defaults; diff --git a/src/server/.clang-tidy b/src/server/.clang-tidy index 6990b1fe..a580cc7e 100644 --- a/src/server/.clang-tidy +++ b/src/server/.clang-tidy @@ -6,7 +6,6 @@ Checks: > -bugprone-branch-clone, -bugprone-parent-virtual-call, -bugprone-reserved-identifier, - -bugprone-suspicious-realloc-usage, -bugprone-suspicious-string-compare, -cert-dcl37-c, -cert-dcl51-cpp, 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 b1565390..5be51187 100644 --- a/src/server/ArcImpl.hpp +++ b/src/server/ArcImpl.hpp @@ -19,19 +19,13 @@ #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> -// IWYU pragma: no_include "raul/Path.hpp" - -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 4c8dd1d7..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 cae6b252..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> @@ -202,8 +204,8 @@ BlockImpl::bypass(RunContext& ctx) // Dumb bypass 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 ef76e9bf..69564ff4 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -19,17 +19,16 @@ #include "BufferRef.hpp" #include "NodeImpl.hpp" -#include "PortType.hpp" #include "State.hpp" #include "types.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 +42,8 @@ class Symbol; } // namespace raul namespace ingen { -class Node; + +enum class PortType; namespace server { @@ -125,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()). */ diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index e7406dc6..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> diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 9bae44b1..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> diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 553ae92e..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; } 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 0df5a025..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> diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 2f6c95ba..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> diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp index 167cd294..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/URIs.hpp" -#include "raul/Path.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 a89623d0..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,12 +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/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> @@ -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) @@ -96,13 +94,11 @@ CompiledGraph::compile(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 diff --git a/src/server/CompiledGraph.hpp b/src/server/CompiledGraph.hpp index 89aab289..1949563d 100644 --- a/src/server/CompiledGraph.hpp +++ b/src/server/CompiledGraph.hpp @@ -19,7 +19,7 @@ #include "Task.hpp" -#include "raul/Noncopyable.hpp" +#include <raul/Noncopyable.hpp> #include <cstddef> #include <memory> @@ -46,7 +46,7 @@ public: void run(RunContext& ctx); private: - CompiledGraph(GraphImpl* graph); + explicit CompiledGraph(GraphImpl* graph); using BlockSet = std::set<BlockImpl*>; diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index e8dd3554..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> @@ -249,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; } @@ -296,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 @@ -316,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) { diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index a4ed0f94..0e6dbf63 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -19,8 +19,8 @@ #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> @@ -60,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) || @@ -82,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 46187527..bc52fc3a 100644 --- a/src/server/DirectDriver.hpp +++ b/src/server/DirectDriver.hpp @@ -24,7 +24,7 @@ #include "RunContext.hpp" #include "types.hpp" -#include "raul/Path.hpp" +#include <raul/Path.hpp> #include <boost/intrusive/slist.hpp> diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp index 7f0f4c40..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> 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 cc3012d4..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 @@ -42,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> @@ -70,6 +72,7 @@ #include <limits> #include <map> #include <memory> +#include <string> #include <thread> #include <utility> @@ -239,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 diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 6557ac53..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> @@ -35,12 +35,9 @@ #include <random> #include <vector> -// IWYU pragma: no_include "RunContext.hpp" -// IWYU pragma: no_include "raul/RingBuffer.hpp" - namespace raul { class Maid; -class RingBuffer; // IWYU pragma: keep +class RingBuffer; } // namespace raul namespace ingen { @@ -63,7 +60,7 @@ class GraphImpl; class LV2Options; class PostProcessor; class PreProcessor; -class RunContext; // IWYU pragma: keep +class RunContext; class SocketListener; class Task; class UndoStack; 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/GraphImpl.cpp b/src/server/GraphImpl.cpp index 8435818b..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/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 <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 <string> #include <unordered_map> namespace ingen::server { diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 7c3a56df..6c852106 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -23,8 +23,8 @@ #include "server.h" #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> @@ -34,8 +34,6 @@ #include <memory> #include <utility> -// IWYU pragma: no_include "CompiledGraph.hpp" - namespace raul { class Symbol; } // namespace raul @@ -44,7 +42,7 @@ namespace ingen::server { class ArcImpl; class BufferFactory; -class CompiledGraph; // IWYU pragma: keep +class CompiledGraph; class Engine; class PortImpl; class RunContext; @@ -99,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, 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 ab4c3e54..f3c6e553 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -17,13 +17,12 @@ #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> @@ -37,6 +36,8 @@ class Symbol; namespace ingen { +enum class PortType; + class Atom; namespace server { @@ -95,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 b2f2bae7..7670c931 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -24,9 +24,10 @@ #include "internals/Trigger.hpp" #include "types.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 <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 a2a7f951..e508c850 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -29,19 +29,19 @@ #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 "raul/Semaphore.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> @@ -263,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 } @@ -533,15 +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 = 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 e811e9c1..4c8e779e 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -18,16 +18,17 @@ #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/transport.h> // IWYU pragma: keep #include <jack/types.h> #include <jack/thread.h> @@ -38,18 +39,12 @@ #include <memory> #include <string> -namespace raul { -class Path; -} // namespace raul - namespace ingen { class Atom; namespace server { -class Buffer; -class DuplexPort; class Engine; class FrameTimer; class RunContext; diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index c5cd73dc..ad7b28ae 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -28,25 +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 "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 <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> @@ -54,6 +56,7 @@ #include <cstdint> #include <map> #include <memory> +#include <optional> #include <string> #include <utility> @@ -110,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(); @@ -223,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 @@ -693,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(); diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 4c0c5ea9..78b5ffac 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -22,14 +22,12 @@ #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> @@ -41,7 +39,6 @@ #include <filesystem> #include <memory> #include <mutex> -#include <optional> namespace raul { class Symbol; @@ -49,18 +46,14 @@ class Symbol; 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. * 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 ff571d0b..87072ab0 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -19,12 +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 "lilv/lilv.h" -#include "raul/Symbol.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> @@ -71,7 +72,7 @@ LV2Plugin::symbol() const { std::string working = uri(); if (working.back() == '/') { - working = working.substr(0, working.length() - 1); + working.resize(working.length() - 1); } while (!working.empty()) { @@ -82,7 +83,7 @@ LV2Plugin::symbol() const 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 f771d953..e820a44e 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -20,17 +20,14 @@ #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> -namespace raul { -class Symbol; -} - namespace ingen::server { NodeImpl::NodeImpl(const ingen::URIs& uris, 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 c8a83479..6c7bfb9e 100644 --- a/src/server/PortAudioDriver.hpp +++ b/src/server/PortAudioDriver.hpp @@ -18,11 +18,10 @@ #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> @@ -32,18 +31,8 @@ #include <cstdint> #include <memory> -namespace raul { -class Path; -} // namespace raul +namespace ingen::server { -namespace ingen { - -class Atom; - -namespace server { - -class Buffer; -class DuplexPort; class Engine; class FrameTimer; class RunContext; @@ -129,7 +118,6 @@ protected: 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 c7b20f2b..f6eed11f 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -23,16 +23,17 @@ #include "PortType.hpp" #include "ThreadManager.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 <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> @@ -136,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; @@ -238,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*>( @@ -420,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) { @@ -453,7 +454,7 @@ 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; @@ -463,7 +464,7 @@ PortImpl::monitor(RunContext& ctx, bool send_now) const URIs& uris = ctx.engine().world().uris(); LV2_URID key = 0; float val = 0.0f; - switch (_type.id()) { + switch (_type) { case PortType::UNKNOWN: break; case PortType::AUDIO: @@ -536,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 64c3322f..c202d4a0 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -20,16 +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/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> @@ -42,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/PreProcessor.cpp b/src/server/PreProcessor.cpp index 5d9d4660..b3bad0b2 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -24,16 +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 "raul/Semaphore.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 { @@ -64,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; 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 95d68f57..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> 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 a3139660..fb961ee2 100644 --- a/src/server/SocketListener.cpp +++ b/src/server/SocketListener.cpp @@ -19,12 +19,12 @@ #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> 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 c665c16f..f2141bd5 100644 --- a/src/server/Task.hpp +++ b/src/server/Task.hpp @@ -39,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); } + explicit Task(Mode mode) : Task{mode, nullptr} {} + Task(const Task&) = delete; Task& operator=(const Task&) = delete; diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp index abb9fe46..c6555123 100644 --- a/src/server/UndoStack.cpp +++ b/src/server/UndoStack.cpp @@ -16,14 +16,14 @@ #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> diff --git a/src/server/UndoStack.hpp b/src/server/UndoStack.hpp index 8954f05d..443497cc 100644 --- a/src/server/UndoStack.hpp +++ b/src/server/UndoStack.hpp @@ -17,12 +17,12 @@ #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 <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> @@ -42,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 cf252d37..1c04bb36 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -20,21 +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 "raul/RingBuffer.hpp" -#include "raul/Semaphore.hpp" +#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 { @@ -166,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 e1854ef2..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> diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 4224f109..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 { diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index 74398ea4..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,17 +23,18 @@ #include "GraphImpl.hpp" #include "PreProcessContext.hpp" -#include "ingen/Interface.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 <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> diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp index 744a61c2..8031bb42 100644 --- a/src/server/events/Copy.hpp +++ b/src/server/events/Copy.hpp @@ -20,7 +20,7 @@ #include "Event.hpp" #include "types.hpp" -#include "ingen/Message.hpp" +#include <ingen/Message.hpp> #include <memory> @@ -35,7 +35,6 @@ class CompiledGraph; class Engine; class GraphImpl; class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 7f50411c..55c9b782 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -28,30 +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/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, @@ -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 e8a49ea0..0ee6e36f 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -21,7 +21,7 @@ #include "Event.hpp" #include "types.hpp" -#include "raul/Path.hpp" +#include <raul/Path.hpp> #include <cstdint> #include <memory> @@ -37,8 +37,6 @@ class BlockImpl; class CompiledGraph; class Engine; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 7a8a973d..5df28afa 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -14,34 +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/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 { diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index b083ae8c..1d7f04a5 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -21,8 +21,8 @@ #include "Event.hpp" #include "types.hpp" -#include "ingen/Properties.hpp" -#include "raul/Path.hpp" +#include <ingen/Properties.hpp> +#include <raul/Path.hpp> #include <cstdint> #include <list> @@ -37,8 +37,6 @@ namespace server { class CompiledGraph; class Engine; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 4c054fd9..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(); 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 b42f0652..9e940ea7 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -30,17 +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/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> @@ -49,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, @@ -230,5 +227,4 @@ Delete::undo(Interface& target) } } -} // namespace events -} // namespace ingen::server +} // namespace ingen::server::events diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 87cde2c7..7e901f4b 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -22,10 +22,10 @@ #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> @@ -34,6 +34,8 @@ #include <utility> #include <vector> +// IWYU pragma: no_include <iterator> + namespace ingen { class Interface; @@ -45,8 +47,6 @@ class CompiledGraph; class DuplexPort; class Engine; class EnginePort; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 3f9e3b9d..cba21214 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -32,20 +32,23 @@ #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/Path.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/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> @@ -55,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, @@ -316,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); } @@ -671,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 ed04f8c9..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 <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> #include <cstdint> #include <memory> #include <optional> #include <vector> -// IWYU pragma: no_include "CompiledGraph.hpp" -// IWYU pragma: no_include <algorithm> - namespace ingen { class Interface; @@ -45,11 +43,8 @@ struct SetProperty; namespace server { -class CompiledGraph; // IWYU pragma: keep class Engine; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index bdb18ef9..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> diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index ad3d07b0..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 { diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index e429e0e6..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/Path.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,24 +112,31 @@ 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, - 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, - 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)) { diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index aeb180de..0eeda6f8 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -21,7 +21,7 @@ #include "Event.hpp" #include "types.hpp" -#include "ingen/Message.hpp" +#include <ingen/Message.hpp> #include <list> #include <memory> @@ -40,8 +40,6 @@ class CompiledGraph; class Engine; class GraphImpl; class PortImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index ab369c80..45e7ea94 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -22,16 +22,17 @@ #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> 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 87bc1035..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> diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index eb99c5a9..e7180764 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -17,14 +17,13 @@ #ifndef INGEN_EVENTS_MARK_HPP #define INGEN_EVENTS_MARK_HPP +#include "CompiledGraph.hpp" #include "Event.hpp" #include "types.hpp" #include <map> #include <memory> -// IWYU pragma: no_include "CompiledGraph.hpp" - namespace ingen { class Interface; @@ -33,11 +32,8 @@ struct BundleEnd; namespace server { -class CompiledGraph; // IWYU pragma: keep class Engine; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 3af0ce6c..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> 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 04da7338..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> 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 db1794de..48955143 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -17,13 +17,11 @@ #include "Engine.hpp" #include "util.hpp" -#include "ingen/Module.hpp" -#include "ingen/World.hpp" +#include <ingen/Module.hpp> +#include <ingen/World.hpp> #include <memory> -// IWYU pragma: no_include "ingen/Atom.hpp" - namespace ingen { struct EngineModule : public Module { 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 424a2d7f..658f759b 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -25,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> @@ -75,11 +76,7 @@ // #define CLEAR_GRAPH_ON_RESTORE 1 -namespace ingen { - -class Atom; - -namespace server { +namespace ingen::server { class GraphImpl; @@ -101,6 +98,8 @@ public: Graphs graphs; }; +namespace { + inline size_t ui_ring_size(SampleCount block_length) { @@ -108,6 +107,8 @@ ui_ring_size(SampleCount block_length) static_cast<size_t>(block_length) * 16U); } +} // namespace + class LV2Driver : public Driver, public ingen::AtomSink { public: @@ -216,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. */ @@ -318,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, @@ -461,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; } @@ -516,13 +523,13 @@ ingen_instantiate(const LV2_Descriptor* descriptor, 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); @@ -615,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); @@ -672,6 +679,7 @@ ingen_cleanup(LV2_Handle instance) auto world = std::move(me->world); delete me; + world.reset(); } static void @@ -849,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 6de5a40c..68b1b0bc 100644 --- a/src/server/ingen_portaudio.cpp +++ b/src/server/ingen_portaudio.cpp @@ -17,14 +17,12 @@ #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> -// IWYU pragma: no_include "ingen/FilePath.hpp" - namespace ingen::server { class Driver; 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 ec400075..9103649e 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -14,6 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include "Controller.hpp" + #include "Buffer.hpp" #include "BufferFactory.hpp" #include "BufferRef.hpp" @@ -23,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> @@ -171,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 94598fb7..960bca85 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "internals/Note.hpp" +#include "Note.hpp" #include "BlockImpl.hpp" #include "Buffer.hpp" @@ -25,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/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 d8f1ddef..2ea09b0b 100644 --- a/src/server/internals/Time.cpp +++ b/src/server/internals/Time.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "internals/Time.hpp" +#include "Time.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" @@ -26,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> 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 9b3b8f98..f033a345 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "internals/Trigger.hpp" +#include "Trigger.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" @@ -25,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/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__ |