Skip to content

Commit

Permalink
Extended FM3 is 1/1 -> 32/1 not 33/1 (#3187)
Browse files Browse the repository at this point in the history
Closes #3184
  • Loading branch information
baconpaul authored Nov 20, 2020
1 parent 67baeac commit 9fc710a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1366,9 +1366,9 @@ float Parameter::get_extended(float f)
case ct_fmratio:
{
if( f > 16 )
return ( ( f - 16 ) * 2 + 1 );
return ( ( f - 16 ) * 31.f / 16.f + 1 );
else
return -( ( 16 - f ) * 2 + 1 );
return -( ( 16 - f ) * 31.f / 16.f + 1 );
}
default:
return f;
Expand Down Expand Up @@ -1776,7 +1776,7 @@ void Parameter::get_display_of_modulation_depth(char *txt, float modulationDepth
else {
qq = mf - 1;
}
qq = ( qq + 32 ) / 64;
qq = ( qq + 31 ) / 64;
}
float exmf = qq;
int dp = (detailedMode ? 6 : 2);
Expand Down Expand Up @@ -2958,13 +2958,13 @@ bool Parameter::set_value_from_string( std::string s )
// -oonv-1 = (16-f)*2
// (1+oonv)/2 = f - 16;
// (1+oonv)/2 + 16 = f;
nv = 0.5 * (1 + oonv) + 16;
nv = 16.f / 31.f * (1 + oonv) + 16;
}
else
{
// nv = ( f - 16 ) * 2 + 1
// (nv - 1)/2 + 16 = f
nv = (nv - 1) / 2 + 16;
nv = (nv - 1) * 16.f / 31.f + 16;
}
}
val.f = nv;
Expand Down Expand Up @@ -3096,7 +3096,8 @@ float Parameter::calculate_modulation_value_from_string( const std::string &s, b
if( extend_range )
{
auto mv = (float) std::atof( s.c_str() );
mv = mv / 32;
std::cout << "MV desired is " << mv << std::endl;
mv = mv / 31;
return mv;
}
default:
Expand Down

0 comments on commit 9fc710a

Please sign in to comment.