summaryrefslogtreecommitdiffstats
path: root/src/client/NodeModel.cpp
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/client/NodeModel.cpp
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/client/NodeModel.cpp')
-rw-r--r--src/client/NodeModel.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index 07bdccf8..ea419e3a 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -170,12 +170,14 @@ NodeModel::port(uint32_t index) const
void
-NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) const
+NodeModel::default_port_value_range(SharedPtr<PortModel> port, float& min, float& max) const
{
- assert(port->parent().get() == this);
+ // Default control values
+ min = 0.0;
+ max = 1.0;
+ // Get range from client-side LV2 data
#ifdef HAVE_SLV2
- // Plugin value first
if (_plugin && _plugin->type() == PluginModel::LV2) {
if (!_min_values) {
@@ -196,6 +198,17 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) c
}
#endif
+ // TODO: LADSPA support
+}
+
+
+void
+NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) const
+{
+ assert(port->parent().get() == this);
+
+ default_port_value_range(port, min, max);
+
// Possibly overriden
const Atom& min_atom = port->get_property("lv2:minimum");
const Atom& max_atom = port->get_property("lv2:maximum");