summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ingen/EngineBase.hpp2
-rw-r--r--src/.clang-tidy1
-rw-r--r--src/Configuration.cpp4
-rw-r--r--src/gui/.clang-tidy1
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/gui/GraphBox.cpp2
-rw-r--r--src/gui/GraphCanvas.cpp2
-rw-r--r--src/gui/NewSubgraphWindow.cpp2
-rw-r--r--src/gui/Port.cpp2
-rw-r--r--src/ingen/ingen.cpp4
-rw-r--r--src/server/.clang-tidy1
-rw-r--r--src/server/BufferFactory.cpp2
-rw-r--r--src/server/BufferFactory.hpp2
-rw-r--r--src/server/DirectDriver.hpp7
-rw-r--r--src/server/Driver.hpp2
-rw-r--r--src/server/Engine.cpp18
-rw-r--r--src/server/Engine.hpp6
-rw-r--r--src/server/GraphImpl.cpp2
-rw-r--r--src/server/JackDriver.cpp7
-rw-r--r--src/server/JackDriver.hpp5
-rw-r--r--src/server/PortAudioDriver.hpp13
-rw-r--r--src/server/events/Delete.cpp2
-rw-r--r--src/server/events/Get.cpp6
-rw-r--r--src/server/ingen_lv2.cpp11
-rw-r--r--tests/.clang-tidy1
-rw-r--r--tests/ingen_bench.cpp2
-rw-r--r--tests/ingen_test.cpp2
27 files changed, 58 insertions, 53 deletions
diff --git a/include/ingen/EngineBase.hpp b/include/ingen/EngineBase.hpp
index 1b6b105a..48a1464d 100644
--- a/include/ingen/EngineBase.hpp
+++ b/include/ingen/EngineBase.hpp
@@ -46,7 +46,7 @@ public:
*/
virtual void init(double sample_rate,
uint32_t block_length,
- size_t seq_size) = 0;
+ uint32_t seq_size) = 0;
/**
Return true iff the engine and driver supports dynamic ports.
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 16ba6620..bee2fecc 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -22,7 +22,6 @@ Checks: >
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-fuchsia-statically-constructed-objects,
- -google-readability-casting,
-hicpp-no-array-decay,
-hicpp-no-malloc,
-misc-no-recursion,
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 5ee2ad2d..918bd9d3 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -55,6 +55,8 @@ Configuration::Configuration(Forge& forge)
" ingen -eg # Run engine and GUI in one process\n"
" ingen -eg foo.ingen # Run engine and GUI and load a graph")
{
+ static const auto default_n_threads = static_cast<int32_t>(std::max(std::thread::hardware_concurrency(), 1U));
+
add("atomicBundles", "atomic-bundles", 'a', "Execute bundles atomically", GLOBAL, forge.Bool, forge.make(false));
add("bufferSize", "buffer-size", 'b', "Buffer size in samples", GLOBAL, forge.Int, forge.make(1024));
add("clientPort", "client-port", 'C', "Client port", GLOBAL, forge.Int, Atom());
@@ -77,7 +79,7 @@ Configuration::Configuration(Forge& forge)
add("flushLog", "flush-log", 'f', "Flush logs after every entry", GLOBAL, forge.Bool, forge.make(false));
add("dump", "dump", 'd', "Print debug output", SESSION, forge.Bool, forge.make(false));
add("trace", "trace", 't', "Show LV2 plugin trace messages", SESSION, forge.Bool, forge.make(false));
- add("threads", "threads", 'p', "Number of processing threads", GLOBAL, forge.Int, forge.make(int32_t(std::max(std::thread::hardware_concurrency(), 1U))));
+ add("threads", "threads", 'p', "Number of processing threads", GLOBAL, forge.Int, forge.make(default_n_threads));
add("humanNames", "human-names", 0, "Show human names in GUI", GUI, forge.Bool, forge.make(true));
add("portLabels", "port-labels", 0, "Show port labels in GUI", GUI, forge.Bool, forge.make(true));
add("graphDirectory", "graph-directory", 0, "Default directory for opening graphs", GUI, forge.String, Atom());
diff --git a/src/gui/.clang-tidy b/src/gui/.clang-tidy
index 4dc4facc..99bd2aba 100644
--- a/src/gui/.clang-tidy
+++ b/src/gui/.clang-tidy
@@ -15,7 +15,6 @@ Checks: >
-clang-analyzer-core.CallAndMessage,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-constant-array-index,
- -cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-static-cast-downcast,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-slicing,
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 82447888..f645bb30 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -111,7 +111,7 @@ ConnectWindow::start(App& app, ingen::World& world)
}
set_connected_to(world.interface());
- connect(bool(world.interface()));
+ connect(!!world.interface());
}
void
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 2de4fa33..e4a95bed 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -390,7 +390,7 @@ GraphBox::set_graph(const std::shared_ptr<const GraphModel>& graph,
}
}
- _menu_parent->property_sensitive() = bool(graph->parent());
+ _menu_parent->property_sensitive() = !!graph->parent();
new_port_connection = graph->signal_new_port().connect(
sigc::mem_fun(this, &GraphBox::graph_port_added));
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 5ea39de0..e02c4e5b 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -876,7 +876,7 @@ GraphCanvas::menu_add_port(const string& sym_base,
uris.rdf_type,
Property(is_output ? uris.lv2_OutputPort : uris.lv2_InputPort));
props.emplace(uris.lv2_index,
- _app.forge().make(int32_t(_graph->num_ports())));
+ _app.forge().make(static_cast<int32_t>(_graph->num_ports())));
props.emplace(uris.lv2_name, _app.forge().alloc(name.c_str()));
_app.interface()->put(path_to_uri(path), props);
}
diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp
index 9ccb6904..28a5afa7 100644
--- a/src/gui/NewSubgraphWindow.cpp
+++ b/src/gui/NewSubgraphWindow.cpp
@@ -118,7 +118,7 @@ NewSubgraphWindow::ok_clicked()
// Create graph
Properties props;
props.emplace(_app->uris().rdf_type, Property(_app->uris().ingen_Graph));
- props.emplace(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)));
+ props.emplace(_app->uris().ingen_polyphony, _app->forge().make(static_cast<int32_t>(poly)));
props.emplace(_app->uris().ingen_enabled, _app->forge().make(true));
_app->interface()->put(
path_to_uri(path), props, Resource::Graph::INTERNAL);
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 36e03c5c..3925ed0c 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -230,7 +230,7 @@ Port::on_value_changed(double value)
return; // No change
}
- const Atom atom = _app.forge().make(float(value));
+ const Atom atom = _app.forge().make(static_cast<float>(value));
_app.set_property(model()->uri(),
_app.world().uris().ingen_value,
atom);
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index 6917c9b7..cfe529b8 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -131,7 +131,7 @@ run(int argc, char** argv)
ingen_try(world->load_module("server"), "Failed to load server module");
- ingen_try(bool(world->engine()), "Unable to create engine");
+ ingen_try(!!world->engine(), "Unable to create engine");
world->engine()->listen();
}
@@ -195,7 +195,7 @@ run(int argc, char** argv)
}
}
- ingen_try(bool(world->parser()), "Failed to create parser");
+ ingen_try(!!world->parser(), "Failed to create parser");
const std::string graph = conf.option("load").ptr<char>();
diff --git a/src/server/.clang-tidy b/src/server/.clang-tidy
index ccc90183..bb3d2c63 100644
--- a/src/server/.clang-tidy
+++ b/src/server/.clang-tidy
@@ -12,7 +12,6 @@ Checks: >
-cert-dcl37-c,
-cert-dcl51-cpp,
-cppcoreguidelines-pro-bounds-constant-array-index,
- -cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-static-cast-downcast,
-google-readability-todo,
-google-runtime-int,
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index 1afbf93f..0df5a025 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -109,7 +109,7 @@ BufferFactory::default_size(LV2_URID type) const
}
if (type == _uris.atom_Sequence) {
- if (_seq_size == 0) {
+ if (_seq_size == 0U) {
return _engine.sequence_size();
}
diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp
index 657ce7d2..2f6c95ba 100644
--- a/src/server/BufferFactory.hpp
+++ b/src/server/BufferFactory.hpp
@@ -111,7 +111,7 @@ private:
std::mutex _mutex;
Engine& _engine;
URIs& _uris;
- uint32_t _seq_size{0};
+ uint32_t _seq_size{0U};
BufferRef _silent_buffer;
};
diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp
index 2361034c..46187527 100644
--- a/src/server/DirectDriver.hpp
+++ b/src/server/DirectDriver.hpp
@@ -29,6 +29,7 @@
#include <boost/intrusive/slist.hpp>
#include <cstddef>
+#include <cstdint>
#include <string>
namespace boost::intrusive {
@@ -53,7 +54,7 @@ public:
DirectDriver(Engine& engine,
double sample_rate,
SampleCount block_length,
- size_t seq_size)
+ uint32_t seq_size)
: _engine(engine)
, _sample_rate(sample_rate)
, _block_length(block_length)
@@ -100,7 +101,7 @@ public:
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
@@ -120,7 +121,7 @@ private:
Ports _ports;
SampleCount _sample_rate;
SampleCount _block_length;
- size_t _seq_size;
+ uint32_t _seq_size;
};
} // namespace server
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index 83436389..7f0f4c40 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -98,7 +98,7 @@ public:
virtual SampleCount block_length() const = 0;
/** Return the event buffer size in bytes */
- virtual size_t seq_size() const = 0;
+ virtual uint32_t seq_size() const = 0;
/** Return the sample rate in Hz */
virtual SampleRate sample_rate() const = 0;
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index c4c492b7..cc3012d4 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -104,11 +104,14 @@ Engine::Engine(ingen::World& world)
}
for (int i = 0; i < world.conf().option("threads").get<int32_t>(); ++i) {
+ const bool is_threaded = (i > 0);
_notifications.emplace_back(
- std::make_unique<raul::RingBuffer>(uint32_t(24 * event_queue_size())));
+ std::make_unique<raul::RingBuffer>(24U * event_queue_size()));
_run_contexts.emplace_back(
- std::make_unique<RunContext>(
- *this, _notifications.back().get(), unsigned(i), i > 0));
+ std::make_unique<RunContext>(*this,
+ _notifications.back().get(),
+ static_cast<unsigned>(i),
+ is_threaded));
}
_world.lv2_features().add_feature(_worker->schedule_feature());
@@ -295,16 +298,17 @@ Engine::block_length() const
return _driver->block_length();
}
-size_t
+uint32_t
Engine::sequence_size() const
{
return _driver->seq_size();
}
-size_t
+uint32_t
Engine::event_queue_size() const
{
- return _world.conf().option("queue-size").get<int32_t>();
+ return static_cast<uint32_t>(
+ std::max(0, _world.conf().option("queue-size").get<int32_t>()));
}
void
@@ -378,7 +382,7 @@ Engine::reset_load()
}
void
-Engine::init(double sample_rate, uint32_t block_length, size_t seq_size)
+Engine::init(double sample_rate, uint32_t block_length, uint32_t seq_size)
{
set_driver(std::make_shared<DirectDriver>(
*this, sample_rate, block_length, seq_size));
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index f0f19740..6557ac53 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -88,7 +88,7 @@ public:
Engine& operator=(const Engine&) = delete;
// EngineBase methods
- void init(double sample_rate, uint32_t block_length, size_t seq_size) override;
+ void init(double sample_rate, uint32_t block_length, uint32_t seq_size) override;
bool supports_dynamic_ports() const override;
bool activate() override;
void deactivate() override;
@@ -173,8 +173,8 @@ public:
SampleRate sample_rate() const;
SampleCount block_length() const;
- size_t sequence_size() const;
- size_t event_queue_size() const;
+ uint32_t sequence_size() const;
+ uint32_t event_queue_size() const;
size_t n_threads() const { return _run_contexts.size(); }
bool atomic_bundles() const { return _atomic_bundles; }
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index 0d3c5234..8435818b 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -331,7 +331,7 @@ bool
GraphImpl::has_port_with_index(uint32_t index) const
{
BufferFactory& bufs = *_engine.buffer_factory();
- const auto index_atom = bufs.forge().make(int32_t(index));
+ const auto index_atom = bufs.forge().make(static_cast<int32_t>(index));
for (const auto& p : _inputs) {
if (p.has_property(bufs.uris().lv2_index, index_atom)) {
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index d991879e..0589a021 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -52,6 +52,7 @@
#include <cassert>
#include <chrono>
+#include <cstdint>
#include <map>
#include <string>
#include <utility>
@@ -109,7 +110,8 @@ JackDriver::attach(const std::string& server_name,
_sample_rate = jack_get_sample_rate(_client);
_block_length = jack_get_buffer_size(_client);
- _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE);
+ _seq_size = static_cast<uint32_t>(
+ jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE));
_fallback_buffer = AudioBufPtr(
static_cast<float*>(
@@ -522,7 +524,8 @@ JackDriver::_block_length_cb(jack_nframes_t nframes)
{
if (_engine.root_graph()) {
_block_length = nframes;
- _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE);
+ _seq_size = static_cast<uint32_t>(
+ jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE));
_engine.root_graph()->set_buffer_size(
_engine.run_context(), *_engine.buffer_factory(), PortType::AUDIO,
_engine.buffer_factory()->audio_buffer_size(nframes));
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index bd1b3477..28931e9e 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -33,7 +33,6 @@
#include <jack/types.h>
#include <atomic>
-#include <cstddef>
#include <cstdint>
#include <exception>
#include <memory>
@@ -100,7 +99,7 @@ public:
jack_client_t* jack_client() const { return _client; }
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
SampleCount frame_time() const override {
@@ -157,7 +156,7 @@ protected:
std::atomic<bool> _flag{false};
jack_client_t* _client{nullptr};
jack_nframes_t _block_length{0};
- size_t _seq_size{0};
+ uint32_t _seq_size{0};
jack_nframes_t _sample_rate{0};
uint32_t _midi_event_type;
bool _is_activated{false};
diff --git a/src/server/PortAudioDriver.hpp b/src/server/PortAudioDriver.hpp
index c0a28ba9..c8a83479 100644
--- a/src/server/PortAudioDriver.hpp
+++ b/src/server/PortAudioDriver.hpp
@@ -29,7 +29,6 @@
#include <portaudio.h>
#include <atomic>
-#include <cstddef>
#include <cstdint>
#include <memory>
@@ -77,7 +76,7 @@ public:
int real_time_priority() override { return 80; }
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
private:
@@ -118,14 +117,14 @@ protected:
Ports _ports;
PaStreamParameters _inputParameters;
PaStreamParameters _outputParameters;
- raul::Semaphore _sem{0};
+ raul::Semaphore _sem{0U};
std::unique_ptr<FrameTimer> _timer;
PaStream* _stream{nullptr};
- size_t _seq_size{4096};
+ uint32_t _seq_size{4096U};
uint32_t _block_length;
- uint32_t _sample_rate{48000};
- uint32_t _n_inputs{0};
- uint32_t _n_outputs{0};
+ uint32_t _sample_rate{48000U};
+ uint32_t _n_inputs{0U};
+ uint32_t _n_outputs{0U};
std::atomic<bool> _flag{false};
bool _is_activated{false};
};
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 62653752..bcebe2ba 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -225,7 +225,7 @@ Delete::undo(Interface& target)
if (c.first != _msg.uri.path()) {
target.set_property(path_to_uri(c.first),
uris.lv2_index,
- forge.make(int32_t(c.second.first)));
+ forge.make(static_cast<int32_t>(c.second.first)));
}
}
}
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 9efef123..385e55f3 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -105,11 +105,11 @@ Get::post_process()
URIs& uris = _engine.world().uris();
Properties props = {
{ uris.param_sampleRate,
- uris.forge.make(int32_t(_engine.sample_rate())) },
+ uris.forge.make(static_cast<int32_t>(_engine.sample_rate())) },
{ uris.bufsz_maxBlockLength,
- uris.forge.make(int32_t(_engine.block_length())) },
+ uris.forge.make(static_cast<int32_t>(_engine.block_length())) },
{ uris.ingen_numThreads,
- uris.forge.make(int32_t(_engine.n_threads())) } };
+ uris.forge.make(static_cast<int32_t>(_engine.n_threads())) } };
const Properties load_props = _engine.load_properties();
props.insert(load_props.begin(), load_props.end());
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index d474693d..f5b4e79f 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -113,7 +113,7 @@ class LV2Driver : public Driver, public ingen::AtomSink
public:
LV2Driver(Engine& engine,
SampleCount block_length,
- size_t seq_size,
+ uint32_t seq_size,
SampleCount sample_rate)
: _engine(engine)
, _main_sem(0)
@@ -388,7 +388,7 @@ public:
}
SampleCount block_length() const override { return _block_length; }
- size_t seq_size() const override { return _seq_size; }
+ uint32_t seq_size() const override { return _seq_size; }
SampleCount sample_rate() const override { return _sample_rate; }
SampleCount frame_time() const override { return _frame_time; }
@@ -412,7 +412,7 @@ private:
GraphImpl* _root_graph{nullptr};
uint32_t _notify_capacity{0};
SampleCount _block_length;
- size_t _seq_size;
+ uint32_t _seq_size;
SampleCount _sample_rate;
SampleCount _frame_time{0};
raul::Semaphore _to_ui_overflow_sem{0};
@@ -552,7 +552,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
block_length = 4096;
plugin->world->log().warn("No maximum block length given\n");
}
- if (seq_size == 0) {
+ if (seq_size < 1) {
seq_size = 16384;
plugin->world->log().warn("No maximum sequence size given\n");
}
@@ -575,7 +575,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
ThreadManager::set_flag(THREAD_PRE_PROCESS);
ThreadManager::single_threaded = true;
- auto* driver = new LV2Driver(*engine, block_length, seq_size, rate);
+ auto* driver = new LV2Driver(
+ *engine, block_length, static_cast<uint32_t>(seq_size), rate);
engine->set_driver(std::shared_ptr<Driver>(driver));
engine->activate();
diff --git a/tests/.clang-tidy b/tests/.clang-tidy
index 7e189145..6c26f23c 100644
--- a/tests/.clang-tidy
+++ b/tests/.clang-tidy
@@ -10,7 +10,6 @@ Checks: >
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-fuchsia-statically-constructed-objects,
- -google-readability-casting,
-google-readability-todo,
-llvm-header-guard,
-readability-function-cognitive-complexity,
diff --git a/tests/ingen_bench.cpp b/tests/ingen_bench.cpp
index a445bdc0..c20e2782 100644
--- a/tests/ingen_bench.cpp
+++ b/tests/ingen_bench.cpp
@@ -97,7 +97,7 @@ run(int argc, char** argv)
"Unable to load server module");
// Initialise engine
- ingen_try(bool(world->engine()),
+ ingen_try(!!world->engine(),
"Unable to create engine");
world->engine()->init(48000.0, 4096, 4096);
world->engine()->activate();
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index 8a3d9007..1e0fcfec 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -115,7 +115,7 @@ run(int argc, char** argv)
"Unable to load server module");
// Initialise engine
- ingen_try(bool(world->engine()),
+ ingen_try(!!world->engine(),
"Unable to create engine");
world->engine()->init(48000.0, 4096, 4096);
world->engine()->activate();