From adc6671c0a4c747c4bb30a13c51054e8a319a145 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 9 Feb 2010 20:49:21 +0000 Subject: 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 --- src/engine/ControlBindings.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/engine') 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: -- cgit v1.2.1