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;
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,6 +457,9 @@ 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;