summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-05-23 05:50:25 +0000
committerDavid Robillard <d@drobilla.net>2008-05-23 05:50:25 +0000
commit6a66c54eaa2a60b938b9b45287906c304cb99594 (patch)
tree8e5ba0dd4b65763c79dc95b2935e7b8cacdfe771 /src
parent2c46e6a464d2ac5be8e16a62fba6f00924090ea8 (diff)
downloadingen-6a66c54eaa2a60b938b9b45287906c304cb99594.tar.gz
ingen-6a66c54eaa2a60b938b9b45287906c304cb99594.tar.bz2
ingen-6a66c54eaa2a60b938b9b45287906c304cb99594.zip
Don't set default value metadata if plugin didn't specify a default value.
More readable/informative blank node names in patch files. git-svn-id: http://svn.drobilla.net/lad/ingen@1232 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/engine/LADSPANode.cpp19
-rw-r--r--src/libs/engine/PortImpl.cpp2
-rw-r--r--src/libs/serialisation/Serialiser.cpp2
3 files changed, 11 insertions, 12 deletions
diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp
index 767c0cb4..7a1faac0 100644
--- a/src/libs/engine/LADSPANode.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -175,15 +175,14 @@ LADSPANode::instantiate()
boost::optional<Sample> default_val, min, max;
get_port_limits(j, default_val, min, max);
-
- if (!default_val)
- default_val = 0.0f;
+
+ const float value = default_val ? default_val.get() : 0.0f;
if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) {
- port = new InputPort(this, port_name, j, _polyphony, type, default_val.get(), port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, type, value, 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, default_val.get(), port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, type, value, port_buffer_size);
_ports->at(j) = port;
}
@@ -191,22 +190,22 @@ LADSPANode::instantiate()
assert(_ports->at(j) == port);
// Work around broke-ass crackhead plugins
- if (default_val < min) {
+ if (default_val && default_val.get() < min) {
cerr << "WARNING: Broken LADSPA " << _descriptor->UniqueID
<< ": Port default < minimum. Minimum adjusted." << endl;
min = default_val;
}
- if (default_val > max) {
+ if (default_val && default_val.get() > max) {
cerr << "WARNING: Broken LADSPA " << _descriptor->UniqueID
<< ": Maximum adjusted." << endl;
max = default_val;
}
- // Set default value
+ // Set initial/default value
if (port->buffer_size() == 1) {
for (uint32_t i=0; i < _polyphony; ++i)
- ((AudioBuffer*)port->buffer(i))->set(default_val.get(), 0);
+ ((AudioBuffer*)port->buffer(i))->set(value, 0);
}
if (port->is_input() && port->buffer_size() == 1) {
@@ -214,6 +213,8 @@ LADSPANode::instantiate()
port->set_variable("ingen:minimum", min.get());
if (max)
port->set_variable("ingen:maximum", max.get());
+ if (default_val)
+ port->set_variable("ingen:default", default_val.get());
}
}
diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp
index cefe93a4..46a32b78 100644
--- a/src/libs/engine/PortImpl.cpp
+++ b/src/libs/engine/PortImpl.cpp
@@ -62,8 +62,6 @@ PortImpl::PortImpl(NodeImpl* const node,
if (type == DataType::EVENT)
_broadcast = true; // send activity blips
-
- set_variable("ingen:default", value);
assert(_buffers->size() > 0);
}
diff --git a/src/libs/serialisation/Serialiser.cpp b/src/libs/serialisation/Serialiser.cpp
index a6b48fb4..36c73d2f 100644
--- a/src/libs/serialisation/Serialiser.cpp
+++ b/src/libs/serialisation/Serialiser.cpp
@@ -170,7 +170,7 @@ Serialiser::path_to_node_id(const Path& path)
assert(i->second.get_node());
return i->second;
} else {
- Redland::Node id = _world.blank_id(path.name());
+ Redland::Node id = _world.blank_id(Path::nameify(path.substr(1)));
assert(id);
_node_map[path] = id;
return id;