Mixer: Adjust threshold of boolean control via OSC. 'On' state is triggered at > half of maximum value.

This commit is contained in:
Jonathan Moore Liles 2013-09-09 17:28:31 -07:00
parent cc7f6a93ab
commit 795249a612
1 changed files with 10 additions and 1 deletions

View File

@ -423,8 +423,14 @@ Module::Port::osc_control_change_exact ( float v, void *user_data )
f = p->hints.maximum; f = p->hints.maximum;
else if ( f < p->hints.minimum ) else if ( f < p->hints.minimum )
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 ); p->control_value( f );
Fl::unlock(); Fl::unlock();
@ -451,8 +457,11 @@ Module::Port::osc_control_change_cv ( float v, void *user_data )
if ( p->hints.ranged ) if ( p->hints.ranged )
{ {
if ( Hints::BOOLEAN == p->hints.type )
f = f > 0.5f ? p->hints.maximum : p->hints.minimum;
// scale value to range. // scale value to range.
float scale = p->hints.maximum - p->hints.minimum; float scale = p->hints.maximum - p->hints.minimum;
float offset = p->hints.minimum; float offset = p->hints.minimum;