summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/LADSPANode.cpp19
-rw-r--r--src/libs/engine/PortImpl.cpp2
2 files changed, 10 insertions, 11 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);
}