diff options
94 files changed, 128 insertions, 255 deletions
diff --git a/.clang-tidy b/.clang-tidy index 6e3cd008..d4cd324f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -7,7 +7,10 @@ Checks: > -abseil-*, -altera-*, -bugprone-assignment-in-if-condition, + -bugprone-reserved-identifier, -bugprone-switch-missing-default-case, + -cert-dcl37-c, + -cert-dcl51-cpp, -cppcoreguidelines-avoid-const-or-ref-data-members, -cppcoreguidelines-avoid-do-while, -cppcoreguidelines-macro-usage, diff --git a/include/ingen/Clock.hpp b/include/ingen/Clock.hpp index 6a966701..9e20a031 100644 --- a/include/ingen/Clock.hpp +++ b/include/ingen/Clock.hpp @@ -48,8 +48,8 @@ private: uint64_t now_microseconds() const { struct timespec time{}; clock_gettime(_clock, &time); - return static_cast<uint64_t>(time.tv_sec) * 1000000U + - static_cast<uint64_t>(time.tv_nsec) / 1000U; + return (static_cast<uint64_t>(time.tv_sec) * 1000000U) + + (static_cast<uint64_t>(time.tv_nsec) / 1000U); } private: diff --git a/include/ingen/Configuration.hpp b/include/ingen/Configuration.hpp index 4a7168b1..5c4d2841 100644 --- a/include/ingen/Configuration.hpp +++ b/include/ingen/Configuration.hpp @@ -82,7 +82,7 @@ public: /** Parse a command line. * - * @throw OptionError + * @throw OptionError An option is unknown or an option value is invalid. */ void parse(int argc, char **argv); diff --git a/include/ingen/LV2Features.hpp b/include/ingen/LV2Features.hpp index 41bdf848..fe6fd707 100644 --- a/include/ingen/LV2Features.hpp +++ b/include/ingen/LV2Features.hpp @@ -59,10 +59,7 @@ public: const char* uri() const override { return _uri; } - std::shared_ptr<LV2_Feature> feature(World& world, Node* block) override - { - return nullptr; - } + std::shared_ptr<LV2_Feature> feature(World& world, Node* block) override; const char* _uri; }; diff --git a/include/ingen/Log.hpp b/include/ingen/Log.hpp index 173127a1..afde276a 100644 --- a/include/ingen/Log.hpp +++ b/include/ingen/Log.hpp @@ -26,7 +26,6 @@ #include <cstdarg> #include <functional> -#include <memory> #include <string> #include <utility> @@ -34,7 +33,6 @@ namespace ingen { class Node; class URIs; -class World; class INGEN_API Log { diff --git a/include/ingen/Serialiser.hpp b/include/ingen/Serialiser.hpp index 72941866..6e9d6ad4 100644 --- a/include/ingen/Serialiser.hpp +++ b/include/ingen/Serialiser.hpp @@ -77,14 +77,14 @@ public: /** Serialize an object (graph, block, or port). * - * @throw std::logic_error + * @throw std::logic_error A serialization hasn't been started. */ virtual void serialise(const std::shared_ptr<const Node>& object, Property::Graph context = Property::Graph::DEFAULT); /** Serialize an arc. * - * @throw std::logic_error + * @throw std::logic_error A serialization hasn't been started. */ virtual void serialise_arc(const Sord::Node& parent, const std::shared_ptr<const Arc>& arc); diff --git a/include/ingen/URIMap.hpp b/include/ingen/URIMap.hpp index 2f90ec7f..fbb0523c 100644 --- a/include/ingen/URIMap.hpp +++ b/include/ingen/URIMap.hpp @@ -34,8 +34,6 @@ namespace ingen { class Log; -class Node; -class World; /** URI to integer map and implementation of LV2 URID extension. * @ingroup IngenShared diff --git a/include/ingen/client/GraphModel.hpp b/include/ingen/client/GraphModel.hpp index 08251663..837a28a5 100644 --- a/include/ingen/client/GraphModel.hpp +++ b/include/ingen/client/GraphModel.hpp @@ -36,7 +36,6 @@ class URIs; namespace client { class ArcModel; -class ObjectModel; class PortModel; /** Client's model of a graph. diff --git a/include/ingen/client/ObjectModel.hpp b/include/ingen/client/ObjectModel.hpp index 01528e3d..f9f0e041 100644 --- a/include/ingen/client/ObjectModel.hpp +++ b/include/ingen/client/ObjectModel.hpp @@ -22,7 +22,6 @@ #define INGEN_CLIENT_OBJECTMODEL_HPP #include <ingen/Node.hpp> -#include <ingen/URI.hpp> #include <ingen/URIs.hpp> #include <ingen/client/signal.hpp> #include <ingen/ingen.h> @@ -34,6 +33,7 @@ namespace ingen { class Atom; +class URI; namespace client { diff --git a/include/ingen/client/PluginUI.hpp b/include/ingen/client/PluginUI.hpp index 036872d7..6ecaed89 100644 --- a/include/ingen/client/PluginUI.hpp +++ b/include/ingen/client/PluginUI.hpp @@ -61,7 +61,7 @@ public: /** Instantiate the UI. * - * If true is returned, instantiation was successfull and the widget can be + * If true is returned, instantiation was successful and the widget can be * obtained with get_widget(). Otherwise, instantiation failed, so there is * no widget and the UI can not be used. */ diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp index ec1e325c..c87f2f03 100644 --- a/include/ingen/client/PortModel.hpp +++ b/include/ingen/client/PortModel.hpp @@ -18,7 +18,6 @@ #define INGEN_CLIENT_PORTMODEL_HPP #include <ingen/Node.hpp> -#include <ingen/URI.hpp> #include <ingen/URIs.hpp> #include <ingen/client/ObjectModel.hpp> #include <ingen/client/signal.hpp> @@ -26,7 +25,6 @@ #include <raul/Path.hpp> #include <cstdint> -#include <memory> #include <string> namespace ingen { diff --git a/meson.build b/meson.build index f7aa186d..3510d895 100644 --- a/meson.build +++ b/meson.build @@ -218,45 +218,42 @@ thread_dep = dependency('threads') serd_dep = dependency( 'serd-0', - fallback: ['serd', 'serd_dep'], + include_type: 'system', version: '>= 0.30.4', ) sord_dep = dependency( 'sord-0', - fallback: ['sord', 'sord_dep'], include_type: 'system', version: '>= 0.16.15', ) sratom_dep = dependency( 'sratom-0', - fallback: ['sratom', 'sratom_dep'], + include_type: 'system', version: '>= 0.6.0', ) suil_dep = dependency( 'suil-0', - fallback: ['suil', 'suil_dep'], + include_type: 'system', version: '>= 0.10.0', ) lv2_dep = dependency( 'lv2', - fallback: ['lv2', 'lv2_dep'], include_type: 'system', version: '>= 1.18.0', ) lilv_dep = dependency( 'lilv-0', - fallback: ['lilv', 'lilv_dep'], + include_type: 'system', version: '>= 0.24.21', ) raul_dep = dependency( 'raul-2', - fallback: ['raul', 'raul_dep'], include_type: 'system', version: '>= 2.0.0', ) diff --git a/src/.clang-tidy b/src/.clang-tidy index 1d7809c3..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,4 +28,5 @@ Checks: > -misc-no-recursion, -misc-unused-parameters, -readability-function-cognitive-complexity, + -readability-static-accessed-through-instance, InheritParentConfig: true diff --git a/src/AtomForge.cpp b/src/AtomForge.cpp index 95edb2ea..727bd64e 100644 --- a/src/AtomForge.cpp +++ b/src/AtomForge.cpp @@ -107,7 +107,7 @@ AtomForge::deref(const intptr_t ref) 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)); + return static_cast<LV2_Atom*>(ptr + ((ref - 1) / sizeof(LV2_Atom))); // Alternatively: // return (LV2_Atom*)((uint8_t*)_buf.get() + ref - 1); diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index f2132a39..5200cfde 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -67,6 +67,7 @@ #include <cassert> #include <cstdint> #include <map> +#include <string> #include <utility> #include <variant> diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index 098c9b6d..ed4dc91a 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -158,7 +158,7 @@ ClashAvoider::adjust_name(const raul::Path& old_path, { 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/LV2Features.cpp b/src/LV2Features.cpp index c33ba4c4..73cc9382 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -31,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) { diff --git a/src/Log.cpp b/src/Log.cpp index 5c582cfa..fbcaeca1 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -27,6 +27,7 @@ #include <cstdio> #include <cstdlib> +#include <memory> namespace ingen { diff --git a/src/Resource.cpp b/src/Resource.cpp index 362e6b08..29a82772 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -53,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);) { @@ -66,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/client/BlockModel.cpp b/src/client/BlockModel.cpp index c8f76195..beef0117 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -39,10 +39,6 @@ #include <string> #include <utility> -namespace ingen { -class Node; -} // namespace ingen - namespace ingen::client { BlockModel::BlockModel(URIs& uris, @@ -230,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/ObjectModel.cpp b/src/client/ObjectModel.cpp index d233dd1a..4baa895c 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -32,10 +32,6 @@ #include <string> #include <utility> -namespace ingen { -class URI; -} // namespace ingen - namespace ingen::client { ObjectModel::ObjectModel(URIs& uris, const raul::Path& path) diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp index 2f1a8aa6..88619115 100644 --- a/src/client/ingen_client.cpp +++ b/src/client/ingen_client.cpp @@ -16,18 +16,13 @@ #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 7c1a626c..260afdba 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -72,6 +72,7 @@ #include <algorithm> #include <cassert> +#include <cstdarg> #include <cstdio> #include <exception> #include <iostream> diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 7265796a..edafdfa4 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -476,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(); @@ -485,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) { @@ -515,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/GraphBox.cpp b/src/gui/GraphBox.cpp index b47393f3..47c567e3 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -50,6 +50,7 @@ #include <raul/Symbol.hpp> #include <gdk/gdk.h> +#include <glib.h> #include <glib/gstdio.h> #include <glibmm/convert.h> #include <glibmm/fileutils.h> diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 22edbf15..3090186a 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -253,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 { @@ -269,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); diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index d32b2a17..1d141271 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -47,6 +47,7 @@ #include <cassert> #include <cstdint> #include <memory> +#include <string> namespace ingen { diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 6c46776f..8d1e1777 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -45,6 +45,7 @@ #include <cstdint> #include <map> #include <memory> +#include <string> #include <utility> namespace ingen { 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/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 56551318..3d8b2cd5 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -43,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/MessagesWindow.hpp b/src/gui/MessagesWindow.hpp index c0de6b61..0a70e76c 100644 --- a/src/gui/MessagesWindow.hpp +++ b/src/gui/MessagesWindow.hpp @@ -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/NodeMenu.cpp b/src/gui/NodeMenu.cpp index b18101e3..2815194c 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -207,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)); diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 770e4a40..0dde0ab2 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -39,6 +39,7 @@ #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/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index 148124fc..27ba7c8c 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -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. * diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index daaadfd3..78acf4fb 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -224,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/ingen_gui.cpp b/src/gui/ingen_gui.cpp index 133286f6..7fba2d50 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -28,6 +28,7 @@ #include <glibmm/thread.h> #include <memory> +#include <string> namespace ingen::gui { 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/server/ArcImpl.hpp b/src/server/ArcImpl.hpp index b0914929..5be51187 100644 --- a/src/server/ArcImpl.hpp +++ b/src/server/ArcImpl.hpp @@ -26,10 +26,6 @@ #include <cstdint> -namespace raul { -class Path; -} // namespace raul - namespace ingen::server { class InputPort; diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index 9c9b9e98..a70de0b6 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -38,6 +38,7 @@ #include <cstdint> #include <iterator> #include <memory> +#include <string> #include <utility> #include <vector> diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 31f66c7b..b4f407c3 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -28,15 +28,12 @@ #include <raul/Array.hpp> #include <raul/Symbol.hpp> +#include <algorithm> #include <cassert> #include <cstdint> #include <initializer_list> #include <string> -namespace ingen { -class Resource; -} // namespace ingen - namespace ingen::server { BlockImpl::BlockImpl(PluginImpl* plugin, @@ -249,9 +246,7 @@ BlockImpl::process(RunContext& ctx) 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); } } diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 5589d979..69564ff4 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -45,8 +45,6 @@ namespace ingen { enum class PortType; -class Node; - namespace server { class BufferFactory; diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 0d280e43..489d5384 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -38,6 +38,7 @@ #include <boost/intrusive/bstree.hpp> +#include <algorithm> #include <cmath> #include <cstring> #include <string> @@ -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/DuplexPort.hpp b/src/server/DuplexPort.hpp index da00b4bf..fb3eb74e 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -22,7 +22,6 @@ #include "server.h" #include "types.hpp" -#include <ingen/URI.hpp> #include <lv2/urid/urid.h> #include <raul/Maid.hpp> @@ -40,14 +39,12 @@ 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 8a250d77..4d753bbc 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -72,6 +72,7 @@ #include <limits> #include <map> #include <memory> +#include <string> #include <thread> #include <utility> diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index e6c543d9..8fa1d169 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -19,7 +19,6 @@ #include "Event.hpp" #include "Load.hpp" -#include "RunContext.hpp" #include "server.h" #include "types.hpp" @@ -61,6 +60,7 @@ class GraphImpl; class LV2Options; class PostProcessor; class PreProcessor; +class RunContext; class SocketListener; class Task; class UndoStack; diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 0d381175..9e44a4d4 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -42,6 +42,7 @@ #include <cstddef> #include <map> #include <memory> +#include <string> #include <unordered_map> namespace ingen::server { diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index c22e8510..01622209 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -34,6 +34,7 @@ #include <raul/Array.hpp> #include <raul/Maid.hpp> +#include <algorithm> #include <cassert> #include <cstdlib> #include <memory> @@ -177,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>()) { @@ -231,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 00834dc1..f3c6e553 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -96,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 a1eb0027..2eb0d411 100644 --- a/src/server/InternalBlock.cpp +++ b/src/server/InternalBlock.cpp @@ -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.hpp b/src/server/InternalPlugin.hpp index 5fffcb17..4d715491 100644 --- a/src/server/InternalPlugin.hpp +++ b/src/server/InternalPlugin.hpp @@ -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 d796f289..e508c850 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -37,7 +37,6 @@ #include <ingen/URIMap.hpp> #include <ingen/URIs.hpp> #include <ingen/World.hpp> -#include <ingen/memory.hpp> #include <lv2/atom/atom.h> #include <lv2/atom/forge.h> #include <lv2/atom/util.h> diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index 192604f4..4c8e779e 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -39,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 1cc266bf..ad7b28ae 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -56,6 +56,7 @@ #include <cstdint> #include <map> #include <memory> +#include <optional> #include <string> #include <utility> @@ -225,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 diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 7b7466bb..78b5ffac 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -23,8 +23,6 @@ #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> @@ -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/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index c657f8d8..c94e88f7 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -21,7 +21,6 @@ #include <ingen/URI.hpp> #include <lilv/lilv.h> -#include <raul/Symbol.hpp> 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/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 6d5843a0..e820a44e 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -28,10 +28,6 @@ #include <map> #include <utility> -namespace ingen { -class URI; -} // namespace ingen - namespace ingen::server { NodeImpl::NodeImpl(const ingen::URIs& uris, diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 614f18de..fcf2f57f 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -18,7 +18,6 @@ #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> @@ -27,7 +26,6 @@ namespace ingen { -class Atom; class URIs; namespace server { diff --git a/src/server/PortAudioDriver.cpp b/src/server/PortAudioDriver.cpp index 4dc85352..ef893478 100644 --- a/src/server/PortAudioDriver.cpp +++ b/src/server/PortAudioDriver.cpp @@ -34,10 +34,6 @@ #include <cstring> #include <string> -namespace ingen { -class URI; -} // namespace ingen - namespace ingen::server { static bool diff --git a/src/server/PortAudioDriver.hpp b/src/server/PortAudioDriver.hpp index 77d91461..6c7bfb9e 100644 --- a/src/server/PortAudioDriver.hpp +++ b/src/server/PortAudioDriver.hpp @@ -21,7 +21,6 @@ #include "EnginePort.hpp" #include "types.hpp" -#include <ingen/URI.hpp> #include <raul/Semaphore.hpp> #include <boost/intrusive/options.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 a812882d..f6eed11f 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -537,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/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 bcca7d0a..b3bad0b2 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -34,6 +34,7 @@ #include <cstdint> #include <cstdio> #include <memory> +#include <string> namespace ingen::server { diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index f917897d..1c04bb36 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -30,11 +30,7 @@ #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 b2ad6d4b..08b75509 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -30,8 +30,6 @@ namespace ingen { class Log; -class Node; -class World; namespace server { diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 5c295dca..458df0ef 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -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.hpp b/src/server/events/Copy.hpp index ee26ab43..8031bb42 100644 --- a/src/server/events/Copy.hpp +++ b/src/server/events/Copy.hpp @@ -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 b8170702..55c9b782 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -45,13 +45,10 @@ #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 41918175..0ee6e36f 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -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 3f1b1f45..5df28afa 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -43,6 +43,7 @@ #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 2140c991..1d7f04a5 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -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 a975fd07..b42542f8 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -45,6 +45,7 @@ #include <cassert> #include <map> #include <memory> +#include <string> #include <utility> namespace ingen::server::events { diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 6e1066f0..151bf82f 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -41,8 +41,6 @@ class DuplexPort; class Engine; class EnginePort; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 1a5fb93d..9e940ea7 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -50,11 +50,7 @@ #include <string> #include <string_view> -namespace ingen::server { - -class RunContext; - -namespace events { +namespace ingen::server::events { Delete::Delete(Engine& engine, const std::shared_ptr<Interface>& client, @@ -231,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 246adc21..7e901f4b 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -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 9072e34d..cba21214 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -58,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, @@ -674,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 a2a63a71..befbdcc7 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -45,8 +45,6 @@ namespace server { class Engine; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index c89b6e95..92dd81d3 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -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.hpp b/src/server/events/DisconnectAll.hpp index 753460de..0eeda6f8 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -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.hpp b/src/server/events/Get.hpp index c434d0d8..0f5ed235 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -35,8 +35,6 @@ namespace server { class Engine; class PluginImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index c98ca0d9..e7180764 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -34,8 +34,6 @@ namespace server { class Engine; class GraphImpl; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 2b79a58b..cca4d310 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -31,8 +31,6 @@ class Interface; namespace server { class Engine; -class PreProcessContext; -class RunContext; namespace events { diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index 548f5475..32a8b761 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -35,7 +35,6 @@ namespace server { class Engine; class PortImpl; -class PreProcessContext; class RunContext; namespace events { 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_lv2.cpp b/src/server/ingen_lv2.cpp index 192a8450..658f759b 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -76,11 +76,7 @@ // #define CLEAR_GRAPH_ON_RESTORE 1 -namespace ingen { - -class Atom; - -namespace server { +namespace ingen::server { class GraphImpl; @@ -102,6 +98,8 @@ public: Graphs graphs; }; +namespace { + inline size_t ui_ring_size(SampleCount block_length) { @@ -109,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: @@ -857,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/internals/BlockDelay.cpp b/src/server/internals/BlockDelay.cpp index b929f2e9..acc68851 100644 --- a/src/server/internals/BlockDelay.cpp +++ b/src/server/internals/BlockDelay.cpp @@ -33,11 +33,7 @@ #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 cbc62eea..9103649e 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -172,7 +172,7 @@ ControllerNode::control(RunContext& ctx, uint8_t control_num, uint8_t val, Frame } const Sample min = logf(min_port_val + 1 + log_offset); const Sample max = logf(max_port_val + 1 + log_offset); - scaled_value = expf(nval * (max - min) + min) - 1 - log_offset; + scaled_value = expf((nval * (max - min)) + min) - 1 - log_offset; } else { scaled_value = ((nval) * (max_port_val - min_port_val)) + min_port_val; } diff --git a/src/server/internals/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/tests/ingen_bench.cpp b/tests/ingen_bench.cpp index 07662ca4..ee890401 100644 --- a/tests/ingen_bench.cpp +++ b/tests/ingen_bench.cpp @@ -130,7 +130,7 @@ run(int argc, char** argv) if (ftell(log.get()) == 0) { fprintf(log.get(), "# n_threads\trun_time\treal_time\n"); } - fprintf(log.get(), "%u\t%f\t%f\n", + fprintf(log.get(), "%d\t%f\t%f\n", world->conf().option("threads").get<int32_t>(), static_cast<double>(t_end - t_start) / 1000000.0, (n_test_frames / 48000.0)); diff --git a/tests/lint/meson.build b/tests/lint/meson.build new file mode 100644 index 00000000..c641cbaa --- /dev/null +++ b/tests/lint/meson.build @@ -0,0 +1,24 @@ +# Copyright 2019-2024 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later + +if not meson.is_subproject() + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(ingen_build_root, 'compile_commands.json') + suppress_path = join_paths(ingen_src_root, '.suppress.cppcheck') + test( + 'cppcheck', + cppcheck, + args: [ + '--cppcheck-build-dir=' + meson.current_build_dir(), + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppressions-list=' + suppress_path, + '-q', + ], + suite: 'code', + ) + endif +endif diff --git a/tests/meson.build b/tests/meson.build index 39395bae..1637230b 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -96,25 +96,5 @@ endforeach ######## if get_option('lint') - if not meson.is_subproject() - # Check code with cppcheck - cppcheck = find_program('cppcheck', required: false) - if cppcheck.found() - compdb_path = join_paths(ingen_build_root, 'compile_commands.json') - suppress_path = join_paths(ingen_src_root, '.suppress.cppcheck') - test( - 'cppcheck', - cppcheck, - args: [ - '--enable=warning,style,performance,portability', - '--error-exitcode=1', - '--project=' + compdb_path, - '--suppressions-list=' + suppress_path, - '-q', - ], - suite: 'code', - timeout: 60, - ) - endif - endif + subdir('lint') endif |