summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-29 07:58:13 +0000
committerDavid Robillard <d@drobilla.net>2010-01-29 07:58:13 +0000
commitf02ac2f82a0342c3e548a81950734b4bce383b7d (patch)
tree06a51f5be2d41bdd8a52f1a6f8888f5f4d3db5f5 /src/engine
parent96613df7830699dbbfb5c2d9fe3ebdb0598e6aca (diff)
downloadingen-f02ac2f82a0342c3e548a81950734b4bce383b7d.tar.gz
ingen-f02ac2f82a0342c3e548a81950734b4bce383b7d.tar.bz2
ingen-f02ac2f82a0342c3e548a81950734b4bce383b7d.zip
Improved/quicker/easier handling of control port ranges.
* Add "Set minimum to current value", "Set maximum to current value", and "Reset range" to control port context menu. * Only serialise properties (e.g. lv2:minimum) if they differ from the meta object's (prototype's, e.g. plugin) value. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2395 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/ControlBindings.cpp3
-rw-r--r--src/engine/HTTPClientSender.cpp6
-rw-r--r--src/engine/InputPort.cpp6
-rw-r--r--src/engine/LV2Node.cpp10
4 files changed, 18 insertions, 7 deletions
diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp
index 2c2a1888..2874fa05 100644
--- a/src/engine/ControlBindings.cpp
+++ b/src/engine/ControlBindings.cpp
@@ -75,8 +75,7 @@ ControlBindings::remove(const Raul::Path& path)
{
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
- SharedPtr<Bindings> old_bindings = _bindings;
-
+ SharedPtr<Bindings> old_bindings(_bindings);
SharedPtr<Bindings> copy(new Bindings(*_bindings.get()));
for (Bindings::iterator i = copy->begin(); i != copy->end();) {
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index 0c14b06f..aacf9479 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -104,9 +104,9 @@ HTTPClientSender::set_property(const URI& subject, const URI& key, const Atom& v
{
Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value);
const string msg = string(
- "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
- "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n"
- "@prefix ingen-ui: <http://drobilla.net/ns/ingenuity#> .\n").append(
+ "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
+ "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n"
+ "@prefix ingenui: <http://drobilla.net/ns/ingenuity#> .\n").append(
subject.str()).append("> ingen:property [\n"
"rdf:predicate ").append(key.str()).append(" ;\n"
"rdf:value ").append(node.to_string()).append("\n] .\n");
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 010fdd93..80ae836d 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -49,6 +49,12 @@ InputPort::InputPort(BufferFactory& bufs,
{
if (!dynamic_cast<Patch*>(parent))
add_property("rdf:type", Raul::Atom(Raul::Atom::URI, "lv2:InputPort"));
+
+ // Set default control range
+ if (type == PortType::CONTROL) {
+ set_property("lv2:minimum", 0.0f);
+ set_property("lv2:maximum", 1.0f);
+ }
}
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index 003a6284..574a4eeb 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -280,8 +280,14 @@ LV2Node::instantiate(BufferFactory& bufs)
if (direction == INPUT && data_type == PortType::CONTROL) {
((AudioBuffer*)port->buffer(0).get())->set_value(val.get_float(), 0, 0);
- port->set_property("lv2:minimum", min_values[j]);
- port->set_property("lv2:maximum", max_values[j]);
+ if (!isnan(min_values[j])) {
+ port->meta().set_property("lv2:minimum", min_values[j]);
+ port->set_property("lv2:minimum", min_values[j]);
+ }
+ if (!isnan(max_values[j])) {
+ port->meta().set_property("lv2:maximum", max_values[j]);
+ port->set_property("lv2:maximum", max_values[j]);
+ }
}
SLV2Values contexts = slv2_port_get_value(plug, id, context_pred);