summaryrefslogtreecommitdiffstats
path: root/src/engine/ControlBindings.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-09 20:49:21 +0000
committerDavid Robillard <d@drobilla.net>2010-02-09 20:49:21 +0000
commitadc6671c0a4c747c4bb30a13c51054e8a319a145 (patch)
treefeb6b6a6c7c3c26fbf3836ddfbc8eb9c4afe38e6 /src/engine/ControlBindings.cpp
parentcbed8ff4b83526eec34d07c478952e1738f4c8ed (diff)
downloadingen-adc6671c0a4c747c4bb30a13c51054e8a319a145.tar.gz
ingen-adc6671c0a4c747c4bb30a13c51054e8a319a145.tar.bz2
ingen-adc6671c0a4c747c4bb30a13c51054e8a319a145.zip
Non-fatal warning when control is out of range (needs to be sorted out...).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2437 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/ControlBindings.cpp')
-rw-r--r--src/engine/ControlBindings.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp
index ac8deca5..91d425a4 100644
--- a/src/engine/ControlBindings.cpp
+++ b/src/engine/ControlBindings.cpp
@@ -213,7 +213,18 @@ ControlBindings::port_value_to_control(PortImpl* port, Type type)
float value = port->value().get_float();
float normal = (value - min) / (max - min);
- assert(normal >= 0.0f && normal <= 1.0f);
+ if (normal < 0.0f) {
+ warn << "Value " << value << " (normal " << normal << ") for "
+ << port->path() << " out of range" << endl;
+ normal = 0.0f;
+ }
+
+ if (normal > 1.0f) {
+ warn << "Value " << value << " (normal " << normal << ") for "
+ << port->path() << " out of range" << endl;
+ normal = 1.0f;
+ }
+
switch (type) {
case MIDI_CC:
case MIDI_CHANNEL_PRESSURE: