From 795249a61260903947b8f0e43c7e08772f332cba Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 9 Sep 2013 17:28:31 -0700 Subject: [PATCH] Mixer: Adjust threshold of boolean control via OSC. 'On' state is triggered at > half of maximum value. --- mixer/src/Module.C | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mixer/src/Module.C b/mixer/src/Module.C index df378ee..e05559d 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -423,8 +423,14 @@ Module::Port::osc_control_change_exact ( float v, void *user_data ) f = p->hints.maximum; else if ( f < p->hints.minimum ) f = p->hints.minimum; + + if ( Hints::BOOLEAN == p->hints.type ) + f = f > (p->hints.maximum - (p->hints.maximum - p->hints.minimum)) * 0.5f ? + p->hints.maximum : + p->hints.minimum; } + p->control_value( f ); Fl::unlock(); @@ -451,8 +457,11 @@ Module::Port::osc_control_change_cv ( float v, void *user_data ) if ( p->hints.ranged ) { + if ( Hints::BOOLEAN == p->hints.type ) + f = f > 0.5f ? p->hints.maximum : p->hints.minimum; + // scale value to range. - + float scale = p->hints.maximum - p->hints.minimum; float offset = p->hints.minimum;