summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/DeprecatedLoader.cpp12
-rw-r--r--src/libs/client/NodeModel.cpp20
-rw-r--r--src/libs/client/NodeModel.hpp10
-rw-r--r--src/libs/client/PluginModel.cpp2
-rw-r--r--src/libs/client/PluginModel.hpp2
-rw-r--r--src/libs/client/PortModel.hpp8
-rw-r--r--src/libs/client/Serializer.cpp32
-rw-r--r--src/libs/client/Serializer.hpp9
8 files changed, 57 insertions, 38 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp
index 4913b038..22fe1cda 100644
--- a/src/libs/client/DeprecatedLoader.cpp
+++ b/src/libs/client/DeprecatedLoader.cpp
@@ -378,22 +378,22 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
if (plugin_type == "Internal") {
if (plugin_label == "audio_input") {
- _engine->create_port(path, "ingen:audio", false);
+ _engine->create_port(path, "ingen:AudioPort", false);
is_port = true;
} else if (plugin_label == "audio_output") {
- _engine->create_port(path, "ingen:audio", true);
+ _engine->create_port(path, "ingen:AudioPort", true);
is_port = true;
} else if (plugin_label == "control_input") {
- _engine->create_port(path, "ingen:control", false);
+ _engine->create_port(path, "ingen:ControlPort", false);
is_port = true;
} else if (plugin_label == "control_output" ) {
- _engine->create_port(path, "ingen:control", true);
+ _engine->create_port(path, "ingen:ControlPort", true);
is_port = true;
} else if (plugin_label == "midi_input") {
- _engine->create_port(path, "ingen:midi", false);
+ _engine->create_port(path, "ingen:MidiPort", false);
is_port = true;
} else if (plugin_label == "midi_output" ) {
- _engine->create_port(path, "ingen:midi", true);
+ _engine->create_port(path, "ingen:MidiPort", true);
is_port = true;
}
}
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index c3348f89..87b62dd9 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -17,9 +17,10 @@
#include CONFIG_H_PATH
+#include <cassert>
+#include "interface/Port.hpp"
#include "NodeModel.hpp"
#include "PatchModel.hpp"
-#include <cassert>
namespace Ingen {
namespace Client {
@@ -135,6 +136,13 @@ NodeModel::get_port(const string& port_name) const
return (*i);
return SharedPtr<PortModel>();
}
+
+
+Shared::Port*
+NodeModel::port(uint32_t index) const
+{
+ return dynamic_cast<Shared::Port*>(_ports[index].get());
+}
void
@@ -148,14 +156,14 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max)
// Plugin value first
#ifdef HAVE_SLV2
- if (plugin() && plugin()->type() == PluginModel::LV2) {
+ if (_plugin && _plugin->type() == PluginModel::LV2) {
min = slv2_port_get_minimum_value(
- plugin()->slv2_plugin(),
- slv2_plugin_get_port_by_symbol(plugin()->slv2_plugin(),
+ _plugin->slv2_plugin(),
+ slv2_plugin_get_port_by_symbol(_plugin->slv2_plugin(),
port->path().name().c_str()));
max = slv2_port_get_maximum_value(
- plugin()->slv2_plugin(),
- slv2_plugin_get_port_by_symbol(plugin()->slv2_plugin(),
+ _plugin->slv2_plugin(),
+ slv2_plugin_get_port_by_symbol(_plugin->slv2_plugin(),
port->path().name().c_str()));
//cerr << "SLV2: " << min << " .. " << max << endl;
diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp
index 1df7f35e..c4f9afe2 100644
--- a/src/libs/client/NodeModel.hpp
+++ b/src/libs/client/NodeModel.hpp
@@ -51,10 +51,12 @@ public:
SharedPtr<PortModel> get_port(const string& port_name) const;
- const string& plugin_uri() const { return _plugin_uri; }
- SharedPtr<PluginModel> plugin() const { return _plugin; }
- uint32_t num_ports() const { return _ports.size(); }
- const PortModelList& ports() const { return _ports; }
+ Shared::Port* port(uint32_t index) const;
+
+ const string& plugin_uri() const { return _plugin_uri; }
+ const Shared::Plugin* plugin() const { return _plugin.get(); }
+ uint32_t num_ports() const { return _ports.size(); }
+ const PortModelList& ports() const { return _ports; }
void port_value_range(SharedPtr<PortModel> port, float& min, float& max);
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index 15b346e5..ff26abeb 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -102,7 +102,7 @@ lv2_ui_program_save(LV2UI_Controller controller,
#ifdef HAVE_SLV2
SLV2UIInstance
-PluginModel::ui(EngineInterface* engine, NodeModel* node)
+PluginModel::ui(EngineInterface* engine, NodeModel* node) const
{
if (_type != LV2)
return NULL;
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index 67a0295f..b4b0ab96 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -105,7 +105,7 @@ public:
_slv2_plugins = slv2_world_get_all_plugins(_slv2_world);
}
- SLV2UIInstance ui(Ingen::Shared::EngineInterface* engine, NodeModel* node);
+ SLV2UIInstance ui(Ingen::Shared::EngineInterface* engine, NodeModel* node) const;
#endif
static void set_rdf_world(Raul::RDF::World& world) {
diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp
index fd965c2b..d6a766d8 100644
--- a/src/libs/client/PortModel.hpp
+++ b/src/libs/client/PortModel.hpp
@@ -46,10 +46,10 @@ public:
inline bool connected() const { return (_connections > 0); }
inline bool is_input() const { return (_direction == INPUT); }
inline bool is_output() const { return (_direction == OUTPUT); }
- inline bool is_audio() const { return (_type == "ingen:audio"); }
- inline bool is_control() const { return (_type == "ingen:control"); }
- inline bool is_midi() const { return (_type == "ingen:midi"); }
- inline bool is_osc() const { return (_type == "ingen:osc"); }
+ inline bool is_audio() const { return (_type == "ingen:AudioPort"); }
+ inline bool is_control() const { return (_type == "ingen:ControlPort"); }
+ inline bool is_midi() const { return (_type == "ingen:MidiPort"); }
+ inline bool is_osc() const { return (_type == "ingen:OSCPort"); }
bool is_logarithmic() const;
bool is_integer() const;
diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp
index e1b3805d..d367733d 100644
--- a/src/libs/client/Serializer.cpp
+++ b/src/libs/client/Serializer.cpp
@@ -35,6 +35,7 @@
#include <raul/RDFWorld.hpp>
#include <raul/TableImpl.hpp>
#include "interface/EngineInterface.hpp"
+#include "interface/Port.hpp"
#include "ConnectionModel.hpp"
#include "NodeModel.hpp"
#include "PatchModel.hpp"
@@ -46,6 +47,7 @@
using namespace std;
using namespace Raul;
using namespace Raul::RDF;
+using namespace Ingen;
using namespace Ingen::Shared;
namespace Ingen {
@@ -225,15 +227,15 @@ Serializer::serialize(SharedPtr<ObjectModel> object) throw (std::logic_error)
return;
}
- SharedPtr<NodeModel> node = PtrCast<NodeModel>(object);
+ SharedPtr<Shared::Node> node = PtrCast<Shared::Node>(object);
if (node) {
serialize_node(node, path_to_node_id(node->path()));
return;
}
- SharedPtr<PortModel> port = PtrCast<PortModel>(object);
+ SharedPtr<Port> port = PtrCast<Port>(object);
if (port) {
- serialize_port(port, path_to_node_id(port->path()));
+ serialize_port(port.get(), path_to_node_id(port->path()));
return;
}
@@ -306,10 +308,11 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch)
}
}
- for (PortModelList::const_iterator p = patch->ports().begin(); p != patch->ports().end(); ++p) {
- const RDF::Node port_id = path_to_node_id((*p)->path());
+ for (uint32_t i=0; i < patch->num_ports(); ++i) {
+ Port* p = patch->port(i);
+ const RDF::Node port_id = path_to_node_id(p->path());
_model->add_statement(patch_id, "ingen:port", port_id);
- serialize_port(*p, port_id);
+ serialize_port(p, port_id);
}
for (ConnectionList::const_iterator c = patch->connections().begin(); c != patch->connections().end(); ++c) {
@@ -333,7 +336,7 @@ Serializer::serialize_plugin(SharedPtr<PluginModel> plugin)
void
-Serializer::serialize_node(SharedPtr<NodeModel> node, const RDF::Node& node_id)
+Serializer::serialize_node(SharedPtr<Shared::Node> node, const RDF::Node& node_id)
{
const RDF::Node plugin_id
= RDF::Node(_model->world(), RDF::Node::RESOURCE, node->plugin()->uri());
@@ -365,9 +368,10 @@ Serializer::serialize_node(SharedPtr<NodeModel> node, const RDF::Node& node_id)
"ingen:name",
Atom(node->path().name()));*/
- for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) {
- const RDF::Node port_id = path_to_node_id((*p)->path());
- serialize_port(*p, port_id);
+ for (uint32_t i=0; i < node->num_ports(); ++i) {
+ Port* p = node->port(i);
+ const RDF::Node port_id = path_to_node_id(p->path());
+ serialize_port(p, port_id);
_model->add_statement(node_id, "ingen:port", port_id);
}
@@ -387,7 +391,7 @@ Serializer::serialize_node(SharedPtr<NodeModel> node, const RDF::Node& node_id)
* Audio output ports with no metadata will not be written, for example.
*/
void
-Serializer::serialize_port(SharedPtr<PortModel> port, const RDF::Node& port_id)
+Serializer::serialize_port(const Port* port, const RDF::Node& port_id)
{
if (port->is_input())
_model->add_statement(port_id, "rdf:type",
@@ -398,10 +402,10 @@ Serializer::serialize_port(SharedPtr<PortModel> port, const RDF::Node& port_id)
_model->add_statement(port_id, "ingen:name", Atom(port->path().name().c_str()));
- _model->add_statement(port_id, "ingen:dataType", Atom(port->type()));
+ _model->add_statement(port_id, "rdf:type", Atom(port->type().uri()));
- if (port->is_control() && port->is_input())
- _model->add_statement(port_id, "ingen:value", Atom(port->value()));
+ if (port->type() == DataType::CONTROL && port->is_input())
+ _model->add_statement(port_id, "ingen:value", port->value());
if (port->metadata().size() > 0) {
for (GraphObject::MetadataMap::const_iterator m = port->metadata().begin();
diff --git a/src/libs/client/Serializer.hpp b/src/libs/client/Serializer.hpp
index 4a6cfa6a..d40e77ae 100644
--- a/src/libs/client/Serializer.hpp
+++ b/src/libs/client/Serializer.hpp
@@ -30,7 +30,12 @@
#include <raul/RDFModel.hpp>
#include "ObjectModel.hpp"
+using namespace Ingen::Shared;
+
namespace Ingen {
+
+namespace Shared { class Node; class Port; }
+
namespace Client {
class PluginModel;
@@ -68,8 +73,8 @@ private:
void serialize_plugin(SharedPtr<PluginModel> p);
void serialize_patch(SharedPtr<PatchModel> p);
- void serialize_node(SharedPtr<NodeModel> n, const Raul::RDF::Node& id);
- void serialize_port(SharedPtr<PortModel> p, const Raul::RDF::Node& id);
+ void serialize_node(SharedPtr<Shared::Node> n, const Raul::RDF::Node& id);
+ void serialize_port(const Shared::Port* p, const Raul::RDF::Node& id);
Raul::RDF::Node path_to_node_id(const Path& path);
Raul::RDF::Node patch_path_to_rdf_id(const Path& path);