summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/PortModel.cpp3
-rw-r--r--src/engine/ControlBindings.cpp12
-rw-r--r--src/engine/LV2Node.cpp13
-rw-r--r--src/engine/internals/Controller.cpp2
-rw-r--r--src/engine/internals/Note.cpp4
-rw-r--r--src/engine/internals/Trigger.cpp4
-rw-r--r--src/gui/Port.cpp6
-rw-r--r--src/shared/LV2URIMap.cpp1
-rw-r--r--src/shared/LV2URIMap.hpp1
9 files changed, 33 insertions, 13 deletions
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index 5d4cb417..a818b04f 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -37,8 +37,7 @@ PortModel::set_property(const Raul::URI& uri,
bool
PortModel::has_hint(const std::string& qname) const
{
- const Raul::Atom& hint = get_property(qname);
- return (hint.is_valid() && hint.get_bool() > 0);
+ return has_property(Shared::LV2URIMap::instance().lv2_portProperty, qname);
}
diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp
index 2144aba7..ee41bd51 100644
--- a/src/engine/ControlBindings.cpp
+++ b/src/engine/ControlBindings.cpp
@@ -69,8 +69,10 @@ void
ControlBindings::set_port_value(ProcessContext& context, PortImpl* port, Type type, int16_t value)
{
// TODO: cache these to avoid the lookup
- float min = port->get_property(Shared::LV2URIMap::instance().lv2_minimum).get_float();
- float max = port->get_property(Shared::LV2URIMap::instance().lv2_maximum).get_float();
+ const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();
+ float min = port->get_property(uris.lv2_minimum).get_float();
+ float max = port->get_property(uris.lv2_maximum).get_float();
+ bool toggled = port->has_property(uris.lv2_portProperty, uris.lv2_toggled);
float normal;
switch (type) {
@@ -84,7 +86,11 @@ ControlBindings::set_port_value(ProcessContext& context, PortImpl* port, Type ty
break;
}
- Raul::Atom atom(static_cast<float>(normal * (max - min) + min));
+ float scaled_value = normal * (max - min) + min;
+ if (toggled)
+ scaled_value = (scaled_value < 0.5) ? 0.0 : 1.0;
+
+ Raul::Atom atom(scaled_value);
port->set_value(atom);
const Events::SendPortValue ev(context.engine(), context.start(), port, true, 0,
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index a0c7dd07..2e176abe 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -198,6 +198,9 @@ LV2Node::instantiate(BufferFactory& bufs)
SLV2Value min_size_pred = slv2_value_new_uri(info->lv2_world(),
"http://lv2plug.in/ns/dev/resize-port#minimumSize");
+ SLV2Value port_property_pred = slv2_value_new_uri(info->lv2_world(),
+ "http://lv2plug.in/ns/lv2core#portProperty");
+
//SLV2Value as_large_as_pred = slv2_value_new_uri(info->lv2_world(),
// "http://lv2plug.in/ns/dev/resize-port#asLargeAs");
@@ -291,6 +294,16 @@ LV2Node::instantiate(BufferFactory& bufs)
}
}
+ // Set lv2:portProperty properties
+ SLV2Values properties = slv2_port_get_value(plug, id, port_property_pred);
+ for (uint32_t i = 0; i < slv2_values_size(properties); ++i) {
+ SLV2Value p = slv2_values_get_at(properties, i);
+ if (slv2_value_is_uri(p)) {
+ Raul::info << "SET PORT PROPERTY " << slv2_value_as_uri(p) << endl;
+ port->set_property(uris.lv2_portProperty, Raul::URI(slv2_value_as_uri(p)));
+ }
+ }
+
SLV2Values contexts = slv2_port_get_value(plug, id, context_pred);
for (uint32_t i = 0; i < slv2_values_size(contexts); ++i) {
SLV2Value c = slv2_values_get_at(contexts, i);
diff --git a/src/engine/internals/Controller.cpp b/src/engine/internals/Controller.cpp
index 4d102bef..56bc433d 100644
--- a/src/engine/internals/Controller.cpp
+++ b/src/engine/internals/Controller.cpp
@@ -61,7 +61,7 @@ ControllerNode::ControllerNode(BufferFactory& bufs,
_ports->at(1) = _param_port;
_log_port = new InputPort(bufs, this, "logarithmic", 2, 1, PortType::CONTROL, 0.0f, sizeof(Sample));
- _log_port->set_property(uris.lv2_toggled, true);
+ _log_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
_ports->at(2) = _log_port;
_min_port = new InputPort(bufs, this, "minimum", 3, 1, PortType::CONTROL, 0.0f, sizeof(Sample));
diff --git a/src/engine/internals/Note.cpp b/src/engine/internals/Note.cpp
index ecee587f..10d7eeaf 100644
--- a/src/engine/internals/Note.cpp
+++ b/src/engine/internals/Note.cpp
@@ -66,11 +66,11 @@ NoteNode::NoteNode(BufferFactory& bufs, const string& path, bool polyphonic, Pat
_ports->at(2) = _vel_port;
_gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, PortType::AUDIO, 0.0f, _buffer_size);
- _gate_port->set_property(uris.lv2_toggled, true);
+ _gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
_ports->at(3) = _gate_port;
_trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, PortType::AUDIO, 0.0f, _buffer_size);
- _trig_port->set_property(uris.lv2_toggled, true);
+ _trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
_ports->at(4) = _trig_port;
}
diff --git a/src/engine/internals/Trigger.cpp b/src/engine/internals/Trigger.cpp
index 68d938c0..a92ab605 100644
--- a/src/engine/internals/Trigger.cpp
+++ b/src/engine/internals/Trigger.cpp
@@ -58,11 +58,11 @@ TriggerNode::TriggerNode(BufferFactory& bufs, const string& path, bool polyphoni
_ports->at(1) = _note_port;
_gate_port = new OutputPort(bufs, this, "gate", 2, 1, PortType::AUDIO, 0.0f, _buffer_size);
- _gate_port->set_property(uris.lv2_toggled, true);
+ _gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
_ports->at(2) = _gate_port;
_trig_port = new OutputPort(bufs, this, "trigger", 3, 1, PortType::AUDIO, 0.0f, _buffer_size);
- _trig_port->set_property(uris.lv2_toggled, true);
+ _trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
_ports->at(3) = _trig_port;
_vel_port = new OutputPort(bufs, this, "velocity", 4, 1, PortType::AUDIO, 0.0f, _buffer_size);
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index d710f10d..84557548 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -224,9 +224,9 @@ Port::property_changed(const URI& key, const Atom& value)
set_control_min(value.get_float());
else if (key == uris.lv2_maximum)
set_control_max(value.get_float());
- } else if (value.type() == Atom::BOOL) {
- if ((key == uris.lv2_toggled))
- set_toggled(value.get_bool());
+ } else if (key == uris.lv2_portProperty) {
+ if (value == uris.lv2_toggled)
+ set_toggled(true);
} else if (value.type() == Atom::URI) {
ArtVpathDash* dash = this->dash();
_rect->property_dash() = dash;
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index 70ca954f..9a4ae7c7 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -80,6 +80,7 @@ LV2URIMap::LV2URIMap()
, lv2_maximum(NS_LV2 "maximum")
, lv2_minimum(NS_LV2 "minimum")
, lv2_name(NS_LV2 "name")
+ , lv2_portProperty(NS_LV2 "portProperty")
, lv2_symbol(NS_LV2 "symbol")
, lv2_toggled(NS_LV2 "toggled")
, lv2ev_EventPort("http://lv2plug.in/ns/ext/event#EventPort")
diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp
index d773591f..923312c5 100644
--- a/src/shared/LV2URIMap.hpp
+++ b/src/shared/LV2URIMap.hpp
@@ -88,6 +88,7 @@ public:
const Quark lv2_maximum;
const Quark lv2_minimum;
const Quark lv2_name;
+ const Quark lv2_portProperty;
const Quark lv2_symbol;
const Quark lv2_toggled;
const Quark lv2ev_EventPort;