summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/interface/ClientInterface.hpp1
-rw-r--r--src/common/interface/Port.hpp7
-rw-r--r--src/libs/client/NodeModel.cpp20
-rw-r--r--src/libs/client/OSCClientReceiver.cpp13
-rw-r--r--src/libs/client/PluginModel.cpp9
-rw-r--r--src/libs/client/PluginModel.hpp10
-rw-r--r--src/libs/client/PluginUI.cpp5
-rw-r--r--src/libs/client/PluginUI.hpp1
-rw-r--r--src/libs/client/PortModel.hpp17
-rw-r--r--src/libs/client/SigClientInterface.hpp6
-rw-r--r--src/libs/client/Store.cpp4
-rw-r--r--src/libs/client/Store.hpp2
-rw-r--r--src/libs/client/ThreadedSigClientInterface.hpp6
-rw-r--r--src/libs/engine/DuplexPort.cpp8
-rw-r--r--src/libs/engine/DuplexPort.hpp10
-rw-r--r--src/libs/engine/InputPort.cpp3
-rw-r--r--src/libs/engine/InputPort.hpp9
-rw-r--r--src/libs/engine/LADSPANode.cpp10
-rw-r--r--src/libs/engine/LV2Node.cpp26
-rw-r--r--src/libs/engine/LV2Plugin.cpp2
-rw-r--r--src/libs/engine/MidiControlNode.cpp22
-rw-r--r--src/libs/engine/MidiControlNode.hpp1
-rw-r--r--src/libs/engine/MidiNoteNode.cpp12
-rw-r--r--src/libs/engine/MidiTriggerNode.cpp11
-rw-r--r--src/libs/engine/NodeFactory.cpp15
-rw-r--r--src/libs/engine/OSCClientSender.cpp4
-rw-r--r--src/libs/engine/OSCClientSender.hpp1
-rw-r--r--src/libs/engine/ObjectSender.cpp2
-rw-r--r--src/libs/engine/OutputPort.cpp3
-rw-r--r--src/libs/engine/OutputPort.hpp1
-rw-r--r--src/libs/engine/PatchImpl.cpp2
-rw-r--r--src/libs/engine/PortImpl.cpp14
-rw-r--r--src/libs/engine/PortImpl.hpp25
-rw-r--r--src/libs/gui/PatchCanvas.cpp6
34 files changed, 156 insertions, 132 deletions
diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp
index 80044caf..0da613c7 100644
--- a/src/common/interface/ClientInterface.hpp
+++ b/src/common/interface/ClientInterface.hpp
@@ -86,6 +86,7 @@ public:
uint32_t num_ports) = 0;
virtual void new_port(const std::string& path,
+ uint32_t index,
const std::string& data_type,
bool is_output) = 0;
diff --git a/src/common/interface/Port.hpp b/src/common/interface/Port.hpp
index 7667b385..b7305519 100644
--- a/src/common/interface/Port.hpp
+++ b/src/common/interface/Port.hpp
@@ -35,9 +35,10 @@ namespace Shared {
class Port : public virtual GraphObject
{
public:
- virtual bool is_input() const = 0;
- virtual DataType type() const = 0;
- virtual Raul::Atom value() const = 0;
+ virtual uint32_t index() const = 0;
+ virtual bool is_input() const = 0;
+ virtual DataType type() const = 0;
+ virtual const Raul::Atom& value() const = 0;
};
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index b429d356..2f8af584 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -156,16 +156,16 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max)
// Plugin value first
if (_plugin && _plugin->type() == PluginModel::LV2) {
Glib::Mutex::Lock(PluginModel::rdf_world()->mutex());
-
- min = slv2_port_get_minimum_value(
- _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(),
- port->path().name().c_str()));
+
+ SLV2Value min_val, max_val;
+ slv2_port_get_range(_plugin->slv2_plugin(),
+ _plugin->slv2_port(port->index()),
+ NULL, &min_val, &max_val);
+
+ if (min_val)
+ min = slv2_value_as_float(min_val);
+ if (max_val)
+ max = slv2_value_as_float(max_val);
}
#endif
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index 6573c9bf..6002ca59 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -155,7 +155,7 @@ OSCClientReceiver::setup_callbacks()
lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_node", "ssTi", new_node_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_node", "ssFi", new_node_cb, this);
- lo_server_thread_add_method(_st, "/ingen/new_port", "ssi", new_port_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/new_port", "sisi", new_port_cb, this);
lo_server_thread_add_method(_st, "/ingen/polyphonic", "sT", polyphonic_cb, this);
lo_server_thread_add_method(_st, "/ingen/polyphonic", "sF", polyphonic_cb, this);
lo_server_thread_add_method(_st, "/ingen/variable_change", NULL, variable_change_cb, this);
@@ -263,7 +263,7 @@ OSCClientReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar
{
const char* uri = &argv[0]->s;
const char* node_path = &argv[1]->s;
- bool polyphonic = (types[2] == 'T');
+ const bool polyphonic = (types[2] == 'T');
const int32_t num_ports = argv[3]->i;
new_node(uri, node_path, polyphonic, num_ports);
@@ -277,11 +277,12 @@ OSCClientReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar
int
OSCClientReceiver::_new_port_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* port_path = &argv[0]->s;
- const char* type = &argv[1]->s;
- bool is_output = (argv[2]->i == 1);
+ const char* port_path = &argv[0]->s;
+ const uint32_t index = argv[1]->i;
+ const char* type = &argv[2]->s;
+ const bool is_output = (argv[3]->i == 1);
- new_port(port_path, type, is_output);
+ new_port(port_path, index, type, is_output);
return 0;
}
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index 83762566..df8d4bf7 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -102,7 +102,7 @@ PluginModel::ui(SharedPtr<EngineInterface> engine, SharedPtr<NodeModel> node) co
Glib::Mutex::Lock(_rdf_world->mutex());
- return PluginUI::create(engine, node, _slv2_plugin);
+ return PluginUI::create(engine, node, _slv2_world, _slv2_plugin);
}
@@ -120,8 +120,10 @@ string
PluginModel::get_lv2_icon_path(SLV2Plugin plugin)
{
string result;
- SLV2Values paths = slv2_plugin_get_value(plugin, SLV2_URI,
- "http://ll-plugins.nongnu.org/lv2/namespace#svgIcon");
+ SLV2Value svg_icon_pred = slv2_value_new_uri(_slv2_world,
+ "http://ll-plugins.nongnu.org/lv2/namespace#svgIcon");
+
+ SLV2Values paths = slv2_plugin_get_value(plugin, svg_icon_pred);
if (slv2_values_size(paths) > 0) {
SLV2Value value = slv2_values_get_at(paths, 0);
@@ -130,6 +132,7 @@ PluginModel::get_lv2_icon_path(SLV2Plugin plugin)
slv2_values_free(paths);
}
+ slv2_value_free(svg_icon_pred);
return result;
}
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index de90bba2..f5ac71f4 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -54,7 +54,9 @@ public:
, _name(name)
{
#ifdef HAVE_SLV2
- _slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, uri.c_str());
+ SLV2Value plugin_uri = slv2_value_new_uri(_slv2_world, uri.c_str());
+ _slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, plugin_uri);
+ slv2_value_free(plugin_uri);
#endif
}
@@ -82,8 +84,12 @@ public:
string default_node_name(SharedPtr<PatchModel> parent);
#ifdef HAVE_SLV2
- SLV2Plugin slv2_plugin() { return _slv2_plugin; }
static SLV2World slv2_world() { return _slv2_world; }
+ SLV2Plugin slv2_plugin() { return _slv2_plugin; }
+
+ SLV2Port slv2_port(uint32_t index) {
+ return slv2_plugin_get_port_by_index(_slv2_plugin, index);
+ }
static void set_slv2_world(SLV2World world) {
_slv2_world = world;
diff --git a/src/libs/client/PluginUI.cpp b/src/libs/client/PluginUI.cpp
index d1b911f8..5ce48bd1 100644
--- a/src/libs/client/PluginUI.cpp
+++ b/src/libs/client/PluginUI.cpp
@@ -74,11 +74,13 @@ PluginUI::~PluginUI()
SharedPtr<PluginUI>
PluginUI::create(SharedPtr<EngineInterface> engine,
SharedPtr<NodeModel> node,
+ SLV2World world,
SLV2Plugin plugin)
{
SharedPtr<PluginUI> ret;
- static const char* gtk_gui_uri = "http://ll-plugins.nongnu.org/lv2/ext/ui#GtkUI";
+ SLV2Value gtk_gui_uri = slv2_value_new_uri(world,
+ "http://ll-plugins.nongnu.org/lv2/ext/ui#GtkUI");
SLV2UIs uis = slv2_plugin_get_uis(plugin);
SLV2UI ui = NULL;
@@ -107,6 +109,7 @@ PluginUI::create(SharedPtr<EngineInterface> engine,
}
}
+ slv2_value_free(gtk_gui_uri);
return ret;
}
diff --git a/src/libs/client/PluginUI.hpp b/src/libs/client/PluginUI.hpp
index 62bbf9af..fc14d5c9 100644
--- a/src/libs/client/PluginUI.hpp
+++ b/src/libs/client/PluginUI.hpp
@@ -39,6 +39,7 @@ public:
static SharedPtr<PluginUI>
create(SharedPtr<Shared::EngineInterface> engine,
SharedPtr<NodeModel> node,
+ SLV2World world,
SLV2Plugin plugin);
SharedPtr<Shared::EngineInterface> engine() { return _engine; }
diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp
index 5455c1f9..940b967e 100644
--- a/src/libs/client/PortModel.hpp
+++ b/src/libs/client/PortModel.hpp
@@ -43,11 +43,12 @@ class PortModel : public ObjectModel, public Ingen::Shared::Port
public:
enum Direction { INPUT, OUTPUT };
- inline DataType type() const { return _type; }
- inline Atom value() const { return Atom(_current_val); }
- inline bool connected() const { return (_connections > 0); }
- inline bool is_input() const { return (_direction == INPUT); }
- inline bool is_output() const { return (_direction == OUTPUT); }
+ inline uint32_t index() const { return _index; }
+ inline DataType type() const { return _type; }
+ inline const Atom& value() const { return _current_val; }
+ inline bool connected() const { return (_connections > 0); }
+ inline bool is_input() const { return (_direction == INPUT); }
+ inline bool is_output() const { return (_direction == OUTPUT); }
bool is_logarithmic() const;
bool is_integer() const;
@@ -74,8 +75,9 @@ public:
private:
friend class Store;
- PortModel(Store& store, const Path& path, DataType type, Direction dir)
+ PortModel(Store& store, const Path& path, uint32_t index, DataType type, Direction dir)
: ObjectModel(store, path, true),
+ _index(index),
_type(type),
_direction(dir),
_current_val(0.0f),
@@ -91,9 +93,10 @@ private:
void connected_to(SharedPtr<PortModel> p) { ++_connections; signal_connection.emit(p); }
void disconnected_from(SharedPtr<PortModel> p) { --_connections; signal_disconnection.emit(p); }
+ uint32_t _index;
DataType _type;
Direction _direction;
- float _current_val;
+ Atom _current_val;
size_t _connections;
};
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index 4e57a7ec..14d96b21 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -53,7 +53,7 @@ public:
sigc::signal<void, string, string, string, string> signal_new_plugin;
sigc::signal<void, string, uint32_t> signal_new_patch;
sigc::signal<void, string, string, bool, uint32_t> signal_new_node;
- sigc::signal<void, string, string, bool> signal_new_port;
+ sigc::signal<void, string, uint32_t, string, bool> signal_new_port;
sigc::signal<void, string, bool> signal_polyphonic;
sigc::signal<void, string> signal_patch_enabled;
sigc::signal<void, string> signal_patch_disabled;
@@ -107,8 +107,8 @@ protected:
void new_node(const string& plugin_uri, const string& node_path, bool poly, uint32_t num_ports)
{ if (_enabled) signal_new_node.emit(plugin_uri, node_path, poly, num_ports); }
- void new_port(const string& path, const string& data_type, bool is_output)
- { if (_enabled) signal_new_port.emit(path, data_type, is_output); }
+ void new_port(const string& path, uint32_t index, const string& data_type, bool is_output)
+ { if (_enabled) signal_new_port.emit(path, index, data_type, is_output); }
void polyphonic(const string& path, bool polyphonic)
{ if (_enabled) signal_polyphonic.emit(path, polyphonic); }
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index 3068295a..10db5231 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -432,11 +432,11 @@ Store::new_node_event(const string& plugin_uri, const Path& node_path, bool is_p
void
-Store::new_port_event(const Path& path, const string& type, bool is_output)
+Store::new_port_event(const Path& path, uint32_t index, const string& type, bool is_output)
{
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
- SharedPtr<PortModel> p(new PortModel(*this, path, type, pdir));
+ SharedPtr<PortModel> p(new PortModel(*this, path, index, type, pdir));
add_object(p);
if (p->parent())
resolve_connection_orphans(p);
diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp
index 5dd4f34e..443a411f 100644
--- a/src/libs/client/Store.hpp
+++ b/src/libs/client/Store.hpp
@@ -100,7 +100,7 @@ private:
void new_plugin_event(const string& uri, const string& type_uri, const string& symbol, const string& name);
void new_patch_event(const Path& path, uint32_t poly);
void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports);
- void new_port_event(const Path& path, const string& data_type, bool is_output);
+ void new_port_event(const Path& path, uint32_t index, const string& data_type, bool is_output);
void polyphonic_event(const Path& path, bool polyphonic);
void patch_enabled_event(const Path& path);
void patch_disabled_event(const Path& path);
diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp
index e5ec2741..7cac212f 100644
--- a/src/libs/client/ThreadedSigClientInterface.hpp
+++ b/src/libs/client/ThreadedSigClientInterface.hpp
@@ -99,8 +99,8 @@ public:
void new_node(const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports)
{ push_sig(sigc::bind(new_node_slot, plugin_uri, node_path, is_polyphonic, num_ports)); }
- void new_port(const string& path, const string& data_type, bool is_output)
- { push_sig(sigc::bind(new_port_slot, path, data_type, is_output)); }
+ void new_port(const string& path, uint32_t index, const string& data_type, bool is_output)
+ { push_sig(sigc::bind(new_port_slot, path, index, data_type, is_output)); }
void polyphonic(const string& path, bool polyphonic)
{ push_sig(sigc::bind(polyphonic_slot, path, polyphonic)); }
@@ -162,7 +162,7 @@ private:
sigc::slot<void, string, string, string, string> new_plugin_slot;
sigc::slot<void, string, uint32_t> new_patch_slot;
sigc::slot<void, string, string, bool, int> new_node_slot;
- sigc::slot<void, string, string, bool> new_port_slot;
+ sigc::slot<void, string, uint32_t, string, bool> new_port_slot;
sigc::slot<void, string, bool> polyphonic_slot;
sigc::slot<void, string, string> connection_slot;
sigc::slot<void, string> patch_enabled_slot;
diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp
index 0da8d9d4..7fde9d0d 100644
--- a/src/libs/engine/DuplexPort.cpp
+++ b/src/libs/engine/DuplexPort.cpp
@@ -30,10 +30,10 @@ using namespace std;
namespace Ingen {
-DuplexPort::DuplexPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output)
- : PortImpl(parent, name, index, poly, type, buffer_size)
- , InputPort(parent, name, index, poly, type, buffer_size)
- , OutputPort(parent, name, index, poly, type, buffer_size)
+DuplexPort::DuplexPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, const Atom& value, size_t buffer_size, bool is_output)
+ : PortImpl(parent, name, index, poly, type, value, buffer_size)
+ , InputPort(parent, name, index, poly, type, value, buffer_size)
+ , OutputPort(parent, name, index, poly, type, value, buffer_size)
, _is_output(is_output)
{
assert(PortImpl::_parent == parent);
diff --git a/src/libs/engine/DuplexPort.hpp b/src/libs/engine/DuplexPort.hpp
index c8413b70..43d202a9 100644
--- a/src/libs/engine/DuplexPort.hpp
+++ b/src/libs/engine/DuplexPort.hpp
@@ -41,7 +41,15 @@ class NodeImpl;
class DuplexPort : public InputPort, public OutputPort
{
public:
- DuplexPort(NodeImpl* parent, const std::string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output);
+ DuplexPort(NodeImpl* parent,
+ const std::string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ const Atom& value,
+ size_t buffer_size,
+ bool is_output);
+
virtual ~DuplexPort() {}
void pre_process(ProcessContext& context);
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index 7e5f6623..6e216384 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -36,8 +36,9 @@ InputPort::InputPort(NodeImpl* parent,
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size)
- : PortImpl(parent, name, index, poly, type, buffer_size)
+ : PortImpl(parent, name, index, poly, type, value, buffer_size)
{
}
diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp
index cd185ad8..c3fa3dad 100644
--- a/src/libs/engine/InputPort.hpp
+++ b/src/libs/engine/InputPort.hpp
@@ -47,7 +47,14 @@ class NodeImpl;
class InputPort : virtual public PortImpl
{
public:
- InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size);
+ InputPort(NodeImpl* parent,
+ const string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ const Atom& value,
+ size_t buffer_size);
+
virtual ~InputPort() {}
typedef Raul::List< SharedPtr<ConnectionImpl> > Connections;
diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp
index 71e40c9d..921e6304 100644
--- a/src/libs/engine/LADSPANode.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -171,20 +171,20 @@ LADSPANode::instantiate()
}
assert (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])
|| LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j]));
+
+ Sample default_val, min, max;
+ get_port_limits(j, default_val, min, max);
if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) {
- port = new InputPort(this, port_name, j, _polyphony, type, port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, type, default_val, port_buffer_size);
_ports->at(j) = port;
} else if (LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])) {
- port = new OutputPort(this, port_name, j, _polyphony, type, port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, type, default_val, port_buffer_size);
_ports->at(j) = port;
}
assert(port);
assert(_ports->at(j) == port);
-
- Sample default_val, min, max;
- get_port_limits(j, default_val, min, max);
// Work around broke-ass crackhead plugins
if (default_val < min) {
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 2fbd390f..a0fdebc0 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -153,7 +153,7 @@ LV2Node::instantiate()
SLV2Port id = slv2_plugin_get_port_by_index(plug, j);
// LV2 shortnames are guaranteed to be unique, valid C identifiers
- port_name = (char*)slv2_port_get_symbol(plug, id);
+ port_name = slv2_value_as_string(slv2_port_get_symbol(plug, id));
assert(port_name.find("/") == string::npos);
@@ -185,15 +185,24 @@ LV2Node::instantiate()
_instances = NULL;
return false;
}
+
+ SLV2Value def, min, max;
+ slv2_port_get_range(plug, id, &def, &min, &max);
+
+ // FIXME: need nice type preserving SLV2Value -> Raul::Atom conversion
+ Atom defatm = (float)((def && slv2_value_is_float(def)) ? slv2_value_as_float(def) : 0.0f);
if (direction == INPUT)
- port = new InputPort(this, port_name, j, _polyphony, data_type, port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, data_type, defatm, port_buffer_size);
else
- port = new OutputPort(this, port_name, j, _polyphony, data_type, port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, data_type, defatm, port_buffer_size);
if (direction == INPUT && data_type == DataType::CONTROL)
- ((AudioBuffer*)port->buffer(0))->set(
- slv2_port_get_default_value(_lv2_plugin->slv2_plugin(), id), 0);
+ ((AudioBuffer*)port->buffer(0))->set(slv2_value_as_float(def), 0);
+
+ slv2_value_free(def);
+ slv2_value_free(min);
+ slv2_value_free(max);
_ports->at(j) = port;
}
@@ -213,12 +222,7 @@ LV2Node::activate()
set_port_buffer(i, j, port->buffer(i));
if (port->type() == DataType::CONTROL) {
-
- const float val = slv2_port_get_default_value(_lv2_plugin->slv2_plugin(),
- slv2_plugin_get_port_by_index(_lv2_plugin->slv2_plugin(), j));
-
- ((AudioBuffer*)port->buffer(i))->set(val, 0);
-
+ ((AudioBuffer*)port->buffer(i))->set(port->value().get_float(), 0);
} else if (port->type() == DataType::AUDIO) {
((AudioBuffer*)port->buffer(i))->set(0.0f, 0);
}
diff --git a/src/libs/engine/LV2Plugin.cpp b/src/libs/engine/LV2Plugin.cpp
index aaf6da61..7d069eda 100644
--- a/src/libs/engine/LV2Plugin.cpp
+++ b/src/libs/engine/LV2Plugin.cpp
@@ -47,7 +47,7 @@ LV2Plugin::symbol() const
const string
LV2Plugin::name() const
{
- return slv2_plugin_get_name(_slv2_plugin);
+ return slv2_value_as_string(slv2_plugin_get_name(_slv2_plugin));
}
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index c48d2e74..263180f7 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -42,33 +42,27 @@ MidiControlNode::MidiControlNode(const string& path,
{
_ports = new Raul::Array<PortImpl*>(7);
- _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, _buffer_size);
+ _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Atom(), _buffer_size);
_ports->at(0) = _midi_in_port;
- _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 1);
+ _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 0.0f, 1);
_param_port->set_variable("ingen:minimum", 0.0f);
_param_port->set_variable("ingen:maximum", 127.0f);
- _param_port->set_variable("ingen:default", 0.0f);
_param_port->set_variable("ingen:integer", 1);
_ports->at(1) = _param_port;
- _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 1);
+ _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 0.0f, 1);
_log_port->set_variable("ingen:toggled", 1);
- _log_port->set_variable("ingen:default", 0.0f);
_ports->at(2) = _log_port;
- _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 1);
- _min_port->set_variable("ingen:default", 0.0f);
+ _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 0.0f, 1);
_ports->at(3) = _min_port;
- _max_port = new InputPort(this, "maximum", 4, 1, DataType::CONTROL, 1);
+ _max_port = new InputPort(this, "maximum", 4, 1, DataType::CONTROL, 1.0f, 1);
_ports->at(4) = _max_port;
- _audio_port = new OutputPort(this, "ar_output", 5, 1, DataType::AUDIO, _buffer_size);
+ _audio_port = new OutputPort(this, "ar_output", 5, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(5) = _audio_port;
-
- _control_port = new OutputPort(this, "cr_output", 6, 1, DataType::CONTROL, 1);
- _ports->at(6) = _control_port;
}
@@ -139,10 +133,8 @@ MidiControlNode::control(uchar control_num, uchar val, SampleCount offset)
scaled_value = ((nval) * (max_port_val - min_port_val)) + min_port_val;
}
- if (control_num == ((AudioBuffer*)_param_port->buffer(0))->value_at(0)) {
- ((AudioBuffer*)_control_port->buffer(0))->set(scaled_value, 0);
+ if (control_num == ((AudioBuffer*)_param_port->buffer(0))->value_at(0))
((AudioBuffer*)_audio_port->buffer(0))->set(scaled_value, offset);
- }
}
diff --git a/src/libs/engine/MidiControlNode.hpp b/src/libs/engine/MidiControlNode.hpp
index c51f36f6..1df42b33 100644
--- a/src/libs/engine/MidiControlNode.hpp
+++ b/src/libs/engine/MidiControlNode.hpp
@@ -54,7 +54,6 @@ private:
InputPort* _log_port;
InputPort* _min_port;
InputPort* _max_port;
- OutputPort* _control_port;
OutputPort* _audio_port;
MidiLearnResponseEvent* _learn_event;
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 0ee5de92..531c48cb 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -45,25 +45,23 @@ MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, PatchImpl* paren
{
_ports = new Raul::Array<PortImpl*>(5);
- _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, _buffer_size);
+ _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Atom(), _buffer_size);
_ports->at(0) = _midi_in_port;
- _freq_port = new OutputPort(this, "frequency", 1, _polyphony, DataType::AUDIO, _buffer_size);
+ _freq_port = new OutputPort(this, "frequency", 1, _polyphony, DataType::AUDIO, 440.0f, _buffer_size);
_ports->at(1) = _freq_port;
- _vel_port = new OutputPort(this, "velocity", 2, _polyphony, DataType::AUDIO, _buffer_size);
+ _vel_port = new OutputPort(this, "velocity", 2, _polyphony, DataType::AUDIO, 0.0f, _buffer_size);
_vel_port->set_variable("ingen:minimum", 0.0f);
_vel_port->set_variable("ingen:maximum", 1.0f);
_ports->at(2) = _vel_port;
- _gate_port = new OutputPort(this, "gate", 3, _polyphony, DataType::AUDIO, _buffer_size);
+ _gate_port = new OutputPort(this, "gate", 3, _polyphony, DataType::AUDIO, 0.0f, _buffer_size);
_gate_port->set_variable("ingen:toggled", 1);
- _gate_port->set_variable("ingen:default", 0.0f);
_ports->at(3) = _gate_port;
- _trig_port = new OutputPort(this, "trigger", 4, _polyphony, DataType::AUDIO, _buffer_size);
+ _trig_port = new OutputPort(this, "trigger", 4, _polyphony, DataType::AUDIO, 0.0f, _buffer_size);
_trig_port->set_variable("ingen:toggled", 1);
- _trig_port->set_variable("ingen:default", 0.0f);
_ports->at(4) = _trig_port;
}
diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp
index de257b2b..4d7ea000 100644
--- a/src/libs/engine/MidiTriggerNode.cpp
+++ b/src/libs/engine/MidiTriggerNode.cpp
@@ -35,23 +35,22 @@ MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, PatchImpl*
{
_ports = new Raul::Array<PortImpl*>(5);
- _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, _buffer_size);
+ _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Atom(), _buffer_size);
_ports->at(0) = _midi_in_port;
- _note_port = new InputPort(this, "note", 1, 1, DataType::CONTROL, 1);
+ _note_port = new InputPort(this, "note", 1, 1, DataType::CONTROL, 60.0f, 1);
_note_port->set_variable("ingen:minimum", 0.0f);
_note_port->set_variable("ingen:maximum", 127.0f);
- _note_port->set_variable("ingen:default", 60.0f);
_note_port->set_variable("ingen:integer", 1);
_ports->at(1) = _note_port;
- _gate_port = new OutputPort(this, "gate", 2, 1, DataType::AUDIO, _buffer_size);
+ _gate_port = new OutputPort(this, "gate", 2, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(2) = _gate_port;
- _trig_port = new OutputPort(this, "trigger", 3, 1, DataType::AUDIO, _buffer_size);
+ _trig_port = new OutputPort(this, "trigger", 3, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(3) = _trig_port;
- _vel_port = new OutputPort(this, "velocity", 4, 1, DataType::AUDIO, _buffer_size);
+ _vel_port = new OutputPort(this, "velocity", 4, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(4) = _vel_port;
}
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index eb414978..4ca038b6 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -179,7 +179,7 @@ NodeFactory::load_lv2_plugins()
SLV2Plugin lv2_plug = slv2_plugins_get_at(plugins, i);
- const string uri((const char*)slv2_plugin_get_uri(lv2_plug));
+ const string uri(slv2_value_as_uri(slv2_plugin_get_uri(lv2_plug)));
#ifndef NDEBUG
assert(_plugins.find(uri) == _plugins.end());
@@ -188,16 +188,9 @@ NodeFactory::load_lv2_plugins()
LV2Plugin* const plugin = new LV2Plugin(_lv2_info, uri);
plugin->slv2_plugin(lv2_plug);
- plugin->library_path(slv2_uri_to_path(slv2_plugin_get_library_uri(lv2_plug)));
- char* const name = slv2_plugin_get_name(lv2_plug);
- if (name) {
- //plugin->name(name);
- free(name);
- _plugins.insert(make_pair(uri, plugin));
- } else {
- cerr << "ERROR: LV2 Plugin " << uri << " has no name. Ignoring." << endl;
- continue;
- }
+ plugin->library_path(slv2_uri_to_path(slv2_value_as_uri(
+ slv2_plugin_get_library_uri(lv2_plug))));
+ _plugins.insert(make_pair(uri, plugin));
}
slv2_plugins_free(_world->slv2_world, plugins);
diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp
index 95bf520e..7a62b3b7 100644
--- a/src/libs/engine/OSCClientSender.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -271,6 +271,7 @@ void OSCClientSender::new_node(const std::string& plugin_uri,
/** \page client_osc_namespace
* <p> \b /ingen/new_port - Notification of a new port's creation.
* \arg \b path (string) - Path of new port
+ * \arg \b index (integer) - Index (or sort key) of port on parent
* \arg \b data-type (string) - Type of port (ingen:AudioPort, ingen:ControlPort, ingen:MIDIPort, or ingen:OSCPort)
* \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1)
*
@@ -284,13 +285,14 @@ void OSCClientSender::new_node(const std::string& plugin_uri,
*/
void
OSCClientSender::new_port(const std::string& path,
+ uint32_t index,
const std::string& data_type,
bool is_output)
{
if (!_enabled)
return;
- lo_send(_address, "/ingen/new_port", "ssi", path.c_str(), data_type.c_str(), is_output);
+ lo_send(_address, "/ingen/new_port", "sisi", path.c_str(), index, data_type.c_str(), is_output);
}
diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp
index ec513b2e..4644b684 100644
--- a/src/libs/engine/OSCClientSender.hpp
+++ b/src/libs/engine/OSCClientSender.hpp
@@ -88,6 +88,7 @@ public:
uint32_t num_ports);
virtual void new_port(const std::string& path,
+ uint32_t index,
const std::string& data_type,
bool is_output);
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index bb1b5c54..f51f0ad0 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -116,7 +116,7 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port)
client->bundle_begin();
- client->new_port(port->path(), port->type().uri(), port->is_output());
+ client->new_port(port->path(), port->index(), port->type().uri(), port->is_output());
client->polyphonic(port->path(), port->polyphonic());
// Send variable
diff --git a/src/libs/engine/OutputPort.cpp b/src/libs/engine/OutputPort.cpp
index a80d1ddf..6f36a34a 100644
--- a/src/libs/engine/OutputPort.cpp
+++ b/src/libs/engine/OutputPort.cpp
@@ -30,8 +30,9 @@ OutputPort::OutputPort(NodeImpl* parent,
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size)
- : PortImpl(parent, name, index, poly, type, buffer_size)
+ : PortImpl(parent, name, index, poly, type, value, buffer_size)
{
if (type == DataType::CONTROL)
_broadcast = true;
diff --git a/src/libs/engine/OutputPort.hpp b/src/libs/engine/OutputPort.hpp
index a184c32b..8d441b5c 100644
--- a/src/libs/engine/OutputPort.hpp
+++ b/src/libs/engine/OutputPort.hpp
@@ -45,6 +45,7 @@ public:
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size);
void pre_process(ProcessContext& context);
diff --git a/src/libs/engine/PatchImpl.cpp b/src/libs/engine/PatchImpl.cpp
index 360b3838..13576f1c 100644
--- a/src/libs/engine/PatchImpl.cpp
+++ b/src/libs/engine/PatchImpl.cpp
@@ -320,7 +320,7 @@ PatchImpl::create_port(const string& name, DataType type, size_t buffer_size, bo
assert( !(type == DataType::UNKNOWN) );
- return new DuplexPort(this, name, 0, _polyphony, type, buffer_size, is_output);
+ return new DuplexPort(this, name, 0, _polyphony, type, Atom(), buffer_size, is_output);
}
diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp
index 4fc61c20..9500aab1 100644
--- a/src/libs/engine/PortImpl.cpp
+++ b/src/libs/engine/PortImpl.cpp
@@ -37,15 +37,17 @@ PortImpl::PortImpl(NodeImpl* const node,
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size)
: GraphObjectImpl(node, name, (type == DataType::AUDIO || type == DataType::CONTROL))
, _index(index)
, _poly(poly)
, _buffer_size(buffer_size)
, _type(type)
+ , _value(value)
, _fixed_buffers(false)
, _broadcast(false)
- , _last_broadcasted_value(0.0f) // default?
+ , _last_broadcasted_value(_value) // default?
, _buffers(new Raul::Array<Buffer*>(poly))
{
assert(node != NULL);
@@ -59,6 +61,8 @@ PortImpl::PortImpl(NodeImpl* const node,
if (type == DataType::EVENT)
_broadcast = true; // send activity blips
+
+ set_variable("ingen:default", value);
assert(_buffers->size() > 0);
}
@@ -122,14 +126,6 @@ PortImpl::apply_poly(Raul::Maid& maid, uint32_t poly)
}
-Raul::Atom
-PortImpl::value() const
-{
- // FIXME: will need this for ingen-side serialization
- throw;
-}
-
-
void
PortImpl::allocate_buffers()
{
diff --git a/src/libs/engine/PortImpl.hpp b/src/libs/engine/PortImpl.hpp
index 22e44c05..c2e2403d 100644
--- a/src/libs/engine/PortImpl.hpp
+++ b/src/libs/engine/PortImpl.hpp
@@ -27,7 +27,7 @@
#include "interface/DataType.hpp"
#include "Buffer.hpp"
-namespace Raul { class Maid; }
+namespace Raul { class Maid; class Atom; }
namespace Ingen {
@@ -68,7 +68,8 @@ public:
*/
virtual bool apply_poly(Raul::Maid& maid, uint32_t poly);
- virtual Raul::Atom value() const;
+ const Raul::Atom& value() const { return _value; }
+ void set_value(const Raul::Atom& v) { _value = v; }
inline Buffer* buffer(uint32_t voice) const {
Buffer* const buf = _buffers->at(voice);
@@ -87,11 +88,11 @@ public:
/** Empty buffer contents completely (ie silence) */
virtual void clear_buffers();
-
+
virtual bool is_input() const = 0;
virtual bool is_output() const = 0;
- uint32_t num() const { return _index; }
+ uint32_t index() const { return _index; }
uint32_t poly() const { return _poly; }
DataType type() const { return _type; }
size_t buffer_size() const { return _buffer_size; }
@@ -110,19 +111,21 @@ protected:
uint32_t index,
uint32_t poly,
DataType type,
+ const Raul::Atom& value,
size_t buffer_size);
virtual void allocate_buffers();
virtual void connect_buffers();
virtual void broadcast(ProcessContext& context);
- uint32_t _index;
- uint32_t _poly;
- uint32_t _buffer_size;
- DataType _type;
- bool _fixed_buffers;
- bool _broadcast;
- Sample _last_broadcasted_value;
+ uint32_t _index;
+ uint32_t _poly;
+ uint32_t _buffer_size;
+ DataType _type;
+ Raul::Atom _value;
+ bool _fixed_buffers;
+ bool _broadcast;
+ Sample _last_broadcasted_value;
Raul::Array<Buffer*>* _buffers;
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index 9764cdc0..eeb3daa8 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -141,11 +141,11 @@ PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu,
// Add submenus
for (unsigned i=0; i < slv2_plugin_classes_size(classes); ++i) {
SLV2PluginClass c = slv2_plugin_classes_get_at(classes, i);
- const char* parent = slv2_plugin_class_get_parent_uri(c);
+ SLV2Value parent = slv2_plugin_class_get_parent_uri(c);
- if (parent && !strcmp(parent, slv2_plugin_class_get_uri(plugin_class))) {
+ if (parent && slv2_value_equals(parent, slv2_plugin_class_get_uri(plugin_class))) {
Gtk::Menu_Helpers::MenuElem menu_elem = Gtk::Menu_Helpers::MenuElem(
- slv2_plugin_class_get_label(c));
+ slv2_value_as_string(slv2_plugin_class_get_label(c)));
Gtk::Menu* submenu = Gtk::manage(new Gtk::Menu());
size_t sub_num_items = build_plugin_class_menu(submenu, c, classes);