summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/.clang-tidy3
-rw-r--r--src/client/BlockModel.cpp31
-rw-r--r--src/client/ClientStore.cpp81
-rw-r--r--src/client/GraphModel.cpp35
-rw-r--r--src/client/ObjectModel.cpp14
-rw-r--r--src/client/PluginModel.cpp62
-rw-r--r--src/client/PluginUI.cpp34
-rw-r--r--src/client/PortModel.cpp6
-rw-r--r--src/client/ingen_client.cpp2
-rw-r--r--src/client/meson.build50
-rw-r--r--src/client/wscript24
11 files changed, 181 insertions, 161 deletions
diff --git a/src/client/.clang-tidy b/src/client/.clang-tidy
new file mode 100644
index 00000000..2561514f
--- /dev/null
+++ b/src/client/.clang-tidy
@@ -0,0 +1,3 @@
+Checks: >
+ -google-readability-todo,
+InheritParentConfig: true
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp
index cdfb3fcd..998c118d 100644
--- a/src/client/BlockModel.cpp
+++ b/src/client/BlockModel.cpp
@@ -26,7 +26,6 @@
#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
-#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdlib>
@@ -35,8 +34,7 @@
#include <string>
#include <utility>
-namespace ingen {
-namespace client {
+namespace ingen::client {
BlockModel::BlockModel(URIs& uris,
const std::shared_ptr<PluginModel>& plugin,
@@ -47,8 +45,7 @@ BlockModel::BlockModel(URIs& uris,
, _num_values(0)
, _min_values(nullptr)
, _max_values(nullptr)
-{
-}
+{}
BlockModel::BlockModel(URIs& uris, URI plugin_uri, const raul::Path& path)
: ObjectModel(uris, path)
@@ -56,8 +53,7 @@ BlockModel::BlockModel(URIs& uris, URI plugin_uri, const raul::Path& path)
, _num_values(0)
, _min_values(nullptr)
, _max_values(nullptr)
-{
-}
+{}
BlockModel::BlockModel(const BlockModel& copy)
: ObjectModel(copy)
@@ -206,8 +202,9 @@ BlockModel::default_port_value_range(
}
if (port->port_property(_uris.lv2_sampleRate)) {
- min *= srate;
- max *= srate;
+ const auto frate = static_cast<float>(srate);
+ min *= frate;
+ max *= frate;
}
}
@@ -236,8 +233,9 @@ BlockModel::port_value_range(const std::shared_ptr<const PortModel>& port,
}
if (port->port_property(_uris.lv2_sampleRate)) {
- min *= srate;
- max *= srate;
+ const auto frate = static_cast<float>(srate);
+ min *= frate;
+ max *= frate;
}
}
@@ -247,11 +245,13 @@ BlockModel::label() const
const Atom& name_property = get_property(_uris.lv2_name);
if (name_property.type() == _uris.forge.String) {
return name_property.ptr<char>();
- } else if (plugin_model()) {
+ }
+
+ if (plugin_model()) {
return plugin_model()->human_name();
- } else {
- return symbol().c_str();
}
+
+ return symbol().c_str();
}
std::string
@@ -293,5 +293,4 @@ BlockModel::set(const std::shared_ptr<ObjectModel>& model)
ObjectModel::set(model);
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index d8238c8a..7cfd439d 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -19,7 +19,6 @@
#include "ingen/Atom.hpp"
#include "ingen/Forge.hpp"
#include "ingen/Log.hpp"
-#include "ingen/Node.hpp"
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
#include "ingen/URIs.hpp"
@@ -33,7 +32,6 @@
#include "ingen/paths.hpp"
#include "raul/Path.hpp"
-#include <boost/variant/apply_visitor.hpp>
#include <sigc++/functors/mem_fun.h>
#include <cassert>
@@ -41,9 +39,9 @@
#include <memory>
#include <string>
#include <utility>
+#include <variant>
-namespace ingen {
-namespace client {
+namespace ingen::client {
ClientStore::ClientStore(URIs& uris,
Log& log,
@@ -76,7 +74,7 @@ ClientStore::add_object(const std::shared_ptr<ObjectModel>& object)
std::dynamic_pointer_cast<ObjectModel>(existing->second)->set(object);
} else {
if (!object->path().is_root()) {
- std::shared_ptr<ObjectModel> parent = _object(object->path().parent());
+ const std::shared_ptr<ObjectModel> parent = _object(object->path().parent());
if (parent) {
assert(object->path().is_child_of(parent->path()));
object->set_parent(parent);
@@ -103,7 +101,7 @@ std::shared_ptr<ObjectModel>
ClientStore::remove_object(const raul::Path& path)
{
// Find the object, the "top" of the tree to remove
- const iterator top = find(path);
+ const auto top = find(path);
if (top == end()) {
return nullptr;
}
@@ -142,7 +140,7 @@ ClientStore::remove_object(const raul::Path& path)
std::shared_ptr<PluginModel>
ClientStore::_plugin(const URI& uri)
{
- const Plugins::iterator i = _plugins->find(uri);
+ const auto i = _plugins->find(uri);
return (i == _plugins->end()) ? std::shared_ptr<PluginModel>() : (*i).second;
}
@@ -152,7 +150,7 @@ ClientStore::_plugin(const Atom& uri)
/* FIXME: Should probably be stored with URIs rather than strings, to make
this a fast case. */
- const Plugins::iterator i = _plugins->find(URI(_uris.forge.str(uri, false)));
+ const auto i = _plugins->find(URI(_uris.forge.str(uri, false)));
return (i == _plugins->end()) ? std::shared_ptr<PluginModel>() : (*i).second;
}
@@ -165,15 +163,15 @@ ClientStore::plugin(const URI& uri) const
std::shared_ptr<ObjectModel>
ClientStore::_object(const raul::Path& path)
{
- const iterator i = find(path);
+ const auto i = find(path);
if (i == end()) {
return nullptr;
- } else {
- auto model = std::dynamic_pointer_cast<ObjectModel>(i->second);
- assert(model);
- assert(model->path().is_root() || model->parent());
- return model;
}
+
+ auto model = std::dynamic_pointer_cast<ObjectModel>(i->second);
+ assert(model);
+ assert(model->path().is_root() || model->parent());
+ return model;
}
std::shared_ptr<const ObjectModel>
@@ -187,9 +185,9 @@ ClientStore::_resource(const URI& uri)
{
if (uri_is_path(uri)) {
return _object(uri_to_path(uri));
- } else {
- return _plugin(uri);
}
+
+ return _plugin(uri);
}
std::shared_ptr<const Resource>
@@ -201,7 +199,7 @@ ClientStore::resource(const URI& uri) const
void
ClientStore::add_plugin(const std::shared_ptr<PluginModel>& pm)
{
- std::shared_ptr<PluginModel> existing = _plugin(pm->uri());
+ const std::shared_ptr<PluginModel> existing = _plugin(pm->uri());
if (existing) {
existing->set(pm);
} else {
@@ -235,7 +233,7 @@ ClientStore::operator()(const Copy&)
void
ClientStore::operator()(const Move& msg)
{
- const iterator top = find(msg.old_path);
+ const auto top = find(msg.old_path);
if (top != end()) {
rename(top, msg.new_path);
}
@@ -244,14 +242,12 @@ ClientStore::operator()(const Move& msg)
void
ClientStore::message(const Message& msg)
{
- boost::apply_visitor(*this, msg);
+ std::visit(*this, msg);
}
void
ClientStore::operator()(const Put& msg)
{
- using Iterator = Properties::const_iterator;
-
const auto& uri = msg.uri;
const auto& properties = msg.properties;
@@ -263,12 +259,12 @@ ClientStore::operator()(const Put& msg)
is_graph, is_block, is_port, is_output);
// Check for specially handled types
- const Iterator t = properties.find(_uris.rdf_type);
+ const auto t = properties.find(_uris.rdf_type);
if (t != properties.end()) {
const Atom& type(t->second);
if (_uris.pset_Preset == type) {
- const Iterator p = properties.find(_uris.lv2_appliesTo);
- const Iterator l = properties.find(_uris.rdfs_label);
+ const auto p = properties.find(_uris.lv2_appliesTo);
+ const auto l = properties.find(_uris.rdfs_label);
std::shared_ptr<PluginModel> plug;
if (p == properties.end()) {
_log.error("Preset <%1%> with no plugin\n", uri.c_str());
@@ -283,10 +279,12 @@ ClientStore::operator()(const Put& msg)
plug->add_preset(uri, l->second.ptr<char>());
}
return;
- } else if (_uris.ingen_Graph == type) {
+ }
+
+ if (_uris.ingen_Graph == type) {
is_graph = true;
} else if (_uris.ingen_Internal == type || _uris.lv2_Plugin == type) {
- std::shared_ptr<PluginModel> p(new PluginModel(uris(), uri, type, properties));
+ const std::shared_ptr<PluginModel> p{new PluginModel(uris(), uri, type, properties)};
add_plugin(p);
return;
}
@@ -310,7 +308,7 @@ ClientStore::operator()(const Put& msg)
}
if (is_graph) {
- std::shared_ptr<GraphModel> model(new GraphModel(uris(), path));
+ const std::shared_ptr<GraphModel> model{new GraphModel(uris(), path)};
model->set_properties(properties);
add_object(model);
} else if (is_block) {
@@ -331,23 +329,23 @@ ClientStore::operator()(const Put& msg)
add_plugin(plug);
}
- std::shared_ptr<BlockModel> bm(new BlockModel(uris(), plug, path));
+ const std::shared_ptr<BlockModel> bm{new BlockModel(uris(), plug, path)};
bm->set_properties(properties);
add_object(bm);
} else {
_log.warn("Block %1% has no prototype\n", path.c_str());
}
} else if (is_port) {
- PortModel::Direction pdir = (is_output)
+ const PortModel::Direction pdir = (is_output)
? PortModel::Direction::OUTPUT
: PortModel::Direction::INPUT;
- uint32_t index = 0;
- const Iterator i = properties.find(_uris.lv2_index);
+ uint32_t index = 0;
+ const auto i = properties.find(_uris.lv2_index);
if (i != properties.end() && i->second.type() == _uris.forge.Int) {
index = i->second.get<int32_t>();
}
- std::shared_ptr<PortModel> p(new PortModel(uris(), path, index, pdir));
+ const std::shared_ptr<PortModel> p{new PortModel(uris(), path, index, pdir)};
p->set_properties(properties);
add_object(p);
} else {
@@ -371,7 +369,7 @@ ClientStore::operator()(const Delta& msg)
const raul::Path path(uri_to_path(uri));
- std::shared_ptr<ObjectModel> obj = _object(path);
+ const std::shared_ptr<ObjectModel> obj = _object(path);
if (obj) {
obj->remove_properties(msg.remove);
obj->add_properties(msg.add);
@@ -392,7 +390,7 @@ ClientStore::operator()(const SetProperty& msg)
predicate.c_str(), _uris.forge.str(value, false));
return;
}
- std::shared_ptr<Resource> subject = _resource(subject_uri);
+ const std::shared_ptr<Resource> subject = _resource(subject_uri);
if (subject) {
if (predicate == _uris.ingen_activity) {
/* Activity is transient, trigger any live actions (like GUI
@@ -402,7 +400,7 @@ ClientStore::operator()(const SetProperty& msg)
subject->set_property(predicate, value, msg.ctx);
}
} else {
- std::shared_ptr<PluginModel> plugin = _plugin(subject_uri);
+ const std::shared_ptr<PluginModel> plugin = _plugin(subject_uri);
if (plugin) {
plugin->set_property(predicate, value);
} else if (predicate != _uris.ingen_activity) {
@@ -450,14 +448,14 @@ ClientStore::attempt_connection(const raul::Path& tail_path,
auto head = std::dynamic_pointer_cast<PortModel>(_object(head_path));
if (tail && head) {
- std::shared_ptr<GraphModel> graph = connection_graph(tail_path, head_path);
- std::shared_ptr<ArcModel> arc(new ArcModel(tail, head));
+ const std::shared_ptr<GraphModel> graph = connection_graph(tail_path, head_path);
+ const std::shared_ptr<ArcModel> arc(new ArcModel(tail, head));
graph->add_arc(arc);
return true;
- } else {
- _log.warn("Failed to connect %1% => %2%\n", tail_path, head_path);
- return false;
}
+
+ _log.warn("Failed to connect %1% => %2%\n", tail_path, head_path);
+ return false;
}
void
@@ -501,5 +499,4 @@ ClientStore::operator()(const DisconnectAll& msg)
}
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index d4104742..45d0eb31 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -30,8 +30,7 @@
#include <string>
#include <utility>
-namespace ingen {
-namespace client {
+namespace ingen::client {
void
GraphModel::add_child(const std::shared_ptr<ObjectModel>& c)
@@ -75,7 +74,7 @@ GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p)
{
// Remove any connections which referred to this object,
// since they can't possibly exist anymore
- for (auto j = _arcs.begin(); j != _arcs.end();) {
+ for (auto j = _graph_arcs.begin(); j != _graph_arcs.end();) {
auto next = j;
++next;
@@ -85,7 +84,7 @@ GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p)
|| arc->head_path().parent() == p->path()
|| arc->head_path() == p->path()) {
_signal_removed_arc.emit(arc);
- _arcs.erase(j); // Cuts our reference
+ _graph_arcs.erase(j); // Cuts our reference
}
j = next;
}
@@ -94,23 +93,23 @@ GraphModel::remove_arcs_on(const std::shared_ptr<PortModel>& p)
void
GraphModel::clear()
{
- _arcs.clear();
+ _graph_arcs.clear();
BlockModel::clear();
- assert(_arcs.empty());
+ assert(_graph_arcs.empty());
assert(_ports.empty());
}
std::shared_ptr<ArcModel>
GraphModel::get_arc(const Node* tail, const Node* head)
{
- auto i = _arcs.find(std::make_pair(tail, head));
- if (i != _arcs.end()) {
+ auto i = _graph_arcs.find(std::make_pair(tail, head));
+ if (i != _graph_arcs.end()) {
return std::dynamic_pointer_cast<ArcModel>(i->second);
- } else {
- return nullptr;
}
+
+ return nullptr;
}
/** Add a connection to this graph.
@@ -135,15 +134,16 @@ GraphModel::add_arc(const std::shared_ptr<ArcModel>& arc)
assert(arc->head()->parent().get() == this
|| arc->head()->parent()->parent().get() == this);
- std::shared_ptr<ArcModel> existing = get_arc(
+ const std::shared_ptr<ArcModel> existing = get_arc(
arc->tail().get(), arc->head().get());
if (existing) {
assert(arc->tail() == existing->tail());
assert(arc->head() == existing->head());
} else {
- _arcs.emplace(std::make_pair(arc->tail().get(), arc->head().get()),
- arc);
+ _graph_arcs.emplace(std::make_pair(arc->tail().get(),
+ arc->head().get()),
+ arc);
_signal_new_arc.emit(arc);
}
}
@@ -151,11 +151,11 @@ GraphModel::add_arc(const std::shared_ptr<ArcModel>& arc)
void
GraphModel::remove_arc(const Node* tail, const Node* head)
{
- auto i = _arcs.find(std::make_pair(tail, head));
- if (i != _arcs.end()) {
+ auto i = _graph_arcs.find(std::make_pair(tail, head));
+ if (i != _graph_arcs.end()) {
auto arc = std::dynamic_pointer_cast<ArcModel>(i->second);
_signal_removed_arc.emit(arc);
- _arcs.erase(i);
+ _graph_arcs.erase(i);
}
}
@@ -180,5 +180,4 @@ GraphModel::polyphonic() const
return poly.is_valid() && poly.get<int32_t>();
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index c172c445..0c3bf517 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -22,6 +22,8 @@
#include "ingen/Resource.hpp"
#include "ingen/URIs.hpp"
#include "ingen/paths.hpp"
+#include "raul/Path.hpp"
+#include "raul/Symbol.hpp"
#include <cassert>
#include <cstdint>
@@ -29,23 +31,20 @@
#include <string>
#include <utility>
-namespace ingen {
-namespace client {
+namespace ingen::client {
ObjectModel::ObjectModel(URIs& uris, const raul::Path& path)
: Node(uris, path)
, _path(path)
, _symbol((path == "/") ? "root" : path.symbol())
-{
-}
+{}
ObjectModel::ObjectModel(const ObjectModel& copy)
: Node(copy)
, _parent(copy._parent)
, _path(copy._path)
, _symbol(copy._symbol)
-{
-}
+{}
bool
ObjectModel::is_a(const URIs::Quark& type) const
@@ -115,5 +114,4 @@ ObjectModel::set_parent(const std::shared_ptr<ObjectModel>& p)
_parent = p;
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 4dddd147..333bf568 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -18,21 +18,19 @@
#include "ingen/Atom.hpp"
#include "ingen/client/PluginUI.hpp"
+#include "lilv/lilv.h"
#include "lv2/core/lv2.h"
-
-#include <boost/optional/optional.hpp>
+#include "raul/Symbol.hpp"
#include <cctype>
#include <cstring>
-#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
using std::string;
-namespace ingen {
-namespace client {
+namespace ingen::client {
LilvWorld* PluginModel::_lilv_world = nullptr;
const LilvPlugins* PluginModel::_lilv_plugins = nullptr;
@@ -45,13 +43,12 @@ PluginModel::PluginModel(URIs& uris,
const Properties& properties)
: Resource(uris, uri)
, _type(type)
- , _fetched(false)
{
if (!_type.is_valid()) {
if (uri.string().find("ingen-internals") != string::npos) {
_type = uris.ingen_Internal.urid_atom();
} else {
- _type = uris.lv2_Plugin.urid_atom(); // Assume LV2 and hope for the best...
+ _type = uris.lv2_Plugin.urid_atom(); // Assume LV2 and hope for the best...
}
}
@@ -111,32 +108,38 @@ PluginModel::get_property(const URI& key) const
}
str = str.substr(last_delim + 1);
- std::string symbol = raul::Symbol::symbolify(str);
+ const std::string symbol = raul::Symbol::symbolify(str);
set_property(_uris.lv2_symbol, _uris.forge.alloc(symbol));
return get_property(key);
}
if (_lilv_plugin) {
- boost::optional<const Atom&> ret;
- LilvNode* lv2_pred = lilv_new_uri(_lilv_world, key.c_str());
- LilvNodes* values = lilv_plugin_get_value(_lilv_plugin, lv2_pred);
+ const Atom* ret = nullptr;
+ LilvNode* lv2_pred = lilv_new_uri(_lilv_world, key.c_str());
+ LilvNodes* values = lilv_plugin_get_value(_lilv_plugin, lv2_pred);
lilv_node_free(lv2_pred);
- LILV_FOREACH(nodes, i, values) {
+ LILV_FOREACH (nodes, i, values) {
const LilvNode* value = lilv_nodes_get(values, i);
if (lilv_node_is_uri(value)) {
- ret = set_property(
+ ret = &set_property(
key, _uris.forge.make_urid(URI(lilv_node_as_uri(value))));
break;
- } else if (lilv_node_is_string(value)) {
- ret = set_property(
+ }
+
+ if (lilv_node_is_string(value)) {
+ ret = &set_property(
key, _uris.forge.alloc(lilv_node_as_string(value)));
break;
- } else if (lilv_node_is_float(value)) {
- ret = set_property(
+ }
+
+ if (lilv_node_is_float(value)) {
+ ret = &set_property(
key, _uris.forge.make(lilv_node_as_float(value)));
break;
- } else if (lilv_node_is_int(value)) {
- ret = set_property(
+ }
+
+ if (lilv_node_is_int(value)) {
+ ret = &set_property(
key, _uris.forge.make(lilv_node_as_int(value)));
break;
}
@@ -181,9 +184,9 @@ PluginModel::default_block_symbol() const
const Atom& name_atom = get_property(_uris.lv2_symbol);
if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) {
return raul::Symbol::symbolify(name_atom.ptr<char>());
- } else {
- return raul::Symbol("_");
}
+
+ return raul::Symbol("_");
}
string
@@ -192,9 +195,9 @@ PluginModel::human_name() const
const Atom& name_atom = get_property(_uris.doap_name);
if (name_atom.type() == _uris.forge.String) {
return name_atom.ptr<char>();
- } else {
- return default_block_symbol().c_str();
}
+
+ return default_block_symbol().c_str();
}
string
@@ -218,7 +221,7 @@ PluginModel::port_scale_points(const uint32_t index) const
if (_lilv_plugin) {
const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index);
LilvScalePoints* sp = lilv_port_get_scale_points(_lilv_plugin, port);
- LILV_FOREACH(scale_points, i, sp) {
+ LILV_FOREACH (scale_points, i, sp) {
const LilvScalePoint* p = lilv_scale_points_get(sp, i);
points.emplace(
lilv_node_as_float(lilv_scale_point_get_value(p)),
@@ -257,9 +260,9 @@ heading(const std::string& text, bool html, unsigned level)
if (html) {
const std::string tag = std::string("h") + std::to_string(level);
return std::string("<") + tag + ">" + text + "</" + tag + ">\n";
- } else {
- return text + ":\n\n";
}
+
+ return text + ":\n\n";
}
static std::string
@@ -267,9 +270,9 @@ link(const std::string& addr, bool html)
{
if (html) {
return std::string("<a href=\"") + addr + "\">" + addr + "</a>";
- } else {
- return addr;
}
+
+ return addr;
}
std::string
@@ -357,5 +360,4 @@ PluginModel::set_lilv_world(LilvWorld* world)
_lilv_plugins = lilv_world_get_all_plugins(_lilv_world);
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 7292d8b2..61813cab 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -24,10 +24,12 @@
#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>
@@ -36,8 +38,7 @@
#include <string>
#include <utility>
-namespace ingen {
-namespace client {
+namespace ingen::client {
SuilHost* PluginUI::ui_host = nullptr;
@@ -78,7 +79,7 @@ lv2_ui_write(SuilController controller,
const float value = *static_cast<const float*>(buffer);
if (port->value().type() == uris.atom_Float &&
value == port->value().get<float>()) {
- return; // Ignore feedback
+ return; // Ignore feedback
}
ui->signal_property_changed()(
@@ -89,9 +90,9 @@ lv2_ui_write(SuilController controller,
} else if (format == uris.atom_eventTransfer.urid()) {
const auto* atom = static_cast<const LV2_Atom*>(buffer);
- Atom val = Forge::alloc(atom->size,
- atom->type,
- LV2_ATOM_BODY_CONST(atom));
+ const Atom val =
+ Forge::alloc(atom->size, atom->type, LV2_ATOM_BODY_CONST(atom));
+
ui->signal_property_changed()(port->uri(),
uris.ingen_activity,
val,
@@ -123,8 +124,8 @@ lv2_ui_subscribe(SuilController controller,
uint32_t protocol,
const LV2_Feature* const* features)
{
- auto* const ui = static_cast<PluginUI*>(controller);
- std::shared_ptr<const PortModel> port = get_port(ui, port_index);
+ auto* const ui = static_cast<PluginUI*>(controller);
+ const std::shared_ptr<const PortModel> port = get_port(ui, port_index);
if (!port) {
return 1;
}
@@ -166,17 +167,15 @@ PluginUI::PluginUI(ingen::World& world,
const LilvNode* ui_type)
: _world(world)
, _block(std::move(block))
- , _instance(nullptr)
, _uis(uis)
, _ui(ui)
, _ui_node(lilv_node_duplicate(lilv_ui_get_uri(ui)))
, _ui_type(lilv_node_duplicate(ui_type))
-{
-}
+{}
PluginUI::~PluginUI()
{
- for (uint32_t i : _subscribed_ports) {
+ for (const uint32_t i : _subscribed_ports) {
lv2_ui_unsubscribe(this, i, 0, nullptr);
}
suil_instance_free(_instance);
@@ -205,7 +204,7 @@ PluginUI::create(ingen::World& world,
LilvUIs* uis = lilv_plugin_get_uis(plugin);
const LilvUI* ui = nullptr;
const LilvNode* ui_type = nullptr;
- LILV_FOREACH(uis, u, uis) {
+ LILV_FOREACH (uis, u, uis) {
const LilvUI* this_ui = lilv_uis_get(uis, u);
if (lilv_ui_is_supported(this_ui,
suil_ui_supported,
@@ -247,7 +246,7 @@ PluginUI::instantiate()
LilvNode* ui_plugin = lilv_new_uri(lworld, LV2_UI__plugin);
LilvNodes* notes = lilv_world_find_nodes(
lworld, lilv_ui_get_uri(_ui), ui_portNotification, nullptr);
- LILV_FOREACH(nodes, n, notes) {
+ LILV_FOREACH (nodes, n, notes) {
const LilvNode* note = lilv_nodes_get(notes, n);
const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, nullptr);
const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, nullptr);
@@ -262,7 +261,7 @@ PluginUI::instantiate()
plugin_uri, lilv_node_as_string(_ui_node));
} else if (!strcmp(lilv_node_as_uri(plug), plugin_uri.c_str())) {
// Notification is valid and for this plugin
- uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym));
+ const uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym));
if (index != LV2UI_INVALID_PORT_INDEX) {
lv2_ui_subscribe(this, index, 0, nullptr);
_subscribed_ports.insert(index);
@@ -296,7 +295,7 @@ PluginUI::instantiate()
if (!_instance) {
_world.log().error("Failed to instantiate LV2 UI\n");
// Cancel any subscriptions
- for (uint32_t i : _subscribed_ports) {
+ for (const uint32_t i : _subscribed_ports) {
lv2_ui_unsubscribe(this, i, 0, nullptr);
}
return false;
@@ -346,5 +345,4 @@ PluginUI::is_resizable() const
return !fs_matches && !nrs_matches;
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index 0d695a54..73f273c7 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -27,8 +27,7 @@
#include <memory>
#include <utility>
-namespace ingen {
-namespace client {
+namespace ingen::client {
void
PortModel::on_property(const URI& uri, const Atom& value)
@@ -84,5 +83,4 @@ PortModel::set(const std::shared_ptr<ObjectModel>& model)
}
}
-} // namespace client
-} // namespace ingen
+} // namespace ingen::client
diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp
index f4d6bbc7..63705ebc 100644
--- a/src/client/ingen_client.cpp
+++ b/src/client/ingen_client.cpp
@@ -31,7 +31,7 @@ struct ClientModule : public ingen::Module {
extern "C" {
-ingen::Module*
+INGEN_MODULE_EXPORT ingen::Module*
ingen_module_load()
{
return new ingen::client::ClientModule();
diff --git a/src/client/meson.build b/src/client/meson.build
new file mode 100644
index 00000000..7c040634
--- /dev/null
+++ b/src/client/meson.build
@@ -0,0 +1,50 @@
+# Copyright 2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later
+
+################
+# Dependencies #
+################
+
+sigcpp_dep = dependency('sigc++-2.0', include_type: 'system')
+
+##########
+# Module #
+##########
+
+client_sources = files(
+ 'BlockModel.cpp',
+ 'ClientStore.cpp',
+ 'GraphModel.cpp',
+ 'ObjectModel.cpp',
+ 'PluginModel.cpp',
+ 'PluginUI.cpp',
+ 'PortModel.cpp',
+ 'ingen_client.cpp',
+)
+
+client_dependencies = [
+ boost_dep,
+ ingen_dep,
+ lilv_dep,
+ lv2_dep,
+ raul_dep,
+ sigcpp_dep,
+ suil_dep,
+]
+
+libingen_client = shared_library(
+ 'ingen_client',
+ client_sources,
+ cpp_args: cpp_suppressions + platform_defines + ['-DINGEN_CLIENT_INTERNAL'],
+ dependencies: client_dependencies,
+ gnu_symbol_visibility: 'hidden',
+ implicit_include_directories: false,
+ include_directories: ingen_include_dirs,
+ install: true,
+ install_dir: ingen_module_dir,
+)
+
+ingen_client_dep = declare_dependency(
+ dependencies: client_dependencies,
+ link_with: libingen_client,
+)
diff --git a/src/client/wscript b/src/client/wscript
deleted file mode 100644
index d63fb56c..00000000
--- a/src/client/wscript
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-
-
-def build(bld):
- obj = bld(features = 'cxx cxxshlib',
- cflags = ['-fvisibility=hidden'],
- includes = ['../../', '../../include'],
- export_includes = ['../../include'],
- name = 'libingen_client',
- target = 'ingen_client',
- install_path = '${LIBDIR}',
- use = 'libingen',
- uselib = 'GLIBMM LV2 LILV SUIL RAUL SERD SORD SIGCPP')
-
- obj.source = '''
- BlockModel.cpp
- ClientStore.cpp
- GraphModel.cpp
- ObjectModel.cpp
- PluginModel.cpp
- PluginUI.cpp
- PortModel.cpp
- ingen_client.cpp
- '''