Cleanup formatting and warnings in tuner_slider
This commit is contained in:
parent
701e256b3f
commit
0f2e649b18
|
@ -119,20 +119,32 @@ static F taper( F aRatio, F aMid = 0.5, F aLaw = 1.0, bool aInverse = false )
|
||||||
|
|
||||||
// clamp to [0, 1] and short-cut at (non-invertible) limits
|
// clamp to [0, 1] and short-cut at (non-invertible) limits
|
||||||
if( aMid <= 0 )
|
if( aMid <= 0 )
|
||||||
|
{
|
||||||
t = aInverse ? 1 : 0;
|
t = aInverse ? 1 : 0;
|
||||||
|
}
|
||||||
else if( aMid >= 1 )
|
else if( aMid >= 1 )
|
||||||
|
{
|
||||||
t = aInverse ? 0 : 1;
|
t = aInverse ? 0 : 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// clamp, and reflect and/or scale for reverse...symmetric...normal laws
|
// clamp, and reflect and/or scale for reverse...symmetric...normal laws
|
||||||
if( aLaw >= 1 )
|
if( aLaw >= 1 )
|
||||||
t = t;
|
{
|
||||||
|
// Do nothing, leave t = t
|
||||||
|
}
|
||||||
else if( aLaw <= 0 )
|
else if( aLaw <= 0 )
|
||||||
|
{
|
||||||
t = 1 - t;
|
t = 1 - t;
|
||||||
|
}
|
||||||
else if( aRatio <= aLaw )
|
else if( aRatio <= aLaw )
|
||||||
|
{
|
||||||
t = t / aLaw;
|
t = t / aLaw;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
t = ( 1 - t ) / ( 1 - aLaw );
|
t = ( 1 - t ) / ( 1 - aLaw );
|
||||||
|
}
|
||||||
|
|
||||||
// scaling factors for domain and range in [0, 1]
|
// scaling factors for domain and range in [0, 1]
|
||||||
F a = std::norm( 1 - 1 / aMid );
|
F a = std::norm( 1 - 1 / aMid );
|
||||||
|
@ -147,13 +159,21 @@ static F taper( F aRatio, F aMid = 0.5, F aLaw = 1.0, bool aInverse = false )
|
||||||
|
|
||||||
// clamp, and scale and/or reflect for reverse...symmetric...normal laws
|
// clamp, and scale and/or reflect for reverse...symmetric...normal laws
|
||||||
if( aLaw >= 1 )
|
if( aLaw >= 1 )
|
||||||
t = t;
|
{
|
||||||
|
// Do nothing, leave t = t
|
||||||
|
}
|
||||||
else if( aLaw <= 0 )
|
else if( aLaw <= 0 )
|
||||||
|
{
|
||||||
t = 1 - t;
|
t = 1 - t;
|
||||||
|
}
|
||||||
else if( aRatio <= aLaw )
|
else if( aRatio <= aLaw )
|
||||||
|
{
|
||||||
t = t * aLaw;
|
t = t * aLaw;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
t = 1 - t * ( 1-aLaw );
|
t = 1 - t * ( 1-aLaw );
|
||||||
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +186,7 @@ TUNER_SLIDER::TUNER_SLIDER( SIM_PLOT_FRAME* aFrame, wxWindow* aParent, SCH_SYMBO
|
||||||
m_min( 0.0 ),
|
m_min( 0.0 ),
|
||||||
m_max( 0.0 ),
|
m_max( 0.0 ),
|
||||||
m_value( 0.0 ),
|
m_value( 0.0 ),
|
||||||
|
m_changed( false ),
|
||||||
m_frame ( aFrame )
|
m_frame ( aFrame )
|
||||||
{
|
{
|
||||||
const wxString compName = aSymbol->GetField( REFERENCE_FIELD )->GetText();
|
const wxString compName = aSymbol->GetField( REFERENCE_FIELD )->GetText();
|
||||||
|
@ -268,7 +289,7 @@ void TUNER_SLIDER::updateComponentValue()
|
||||||
|
|
||||||
void TUNER_SLIDER::updateSlider()
|
void TUNER_SLIDER::updateSlider()
|
||||||
{
|
{
|
||||||
assert( m_max >= m_value && m_value >= m_min );
|
wxASSERT( m_max >= m_value && m_value >= m_min );
|
||||||
|
|
||||||
int choice = m_curve->GetSelection();
|
int choice = m_curve->GetSelection();
|
||||||
wxCHECK( choice >= 0 && choice < arraysize( CURVES ), /*void*/ );
|
wxCHECK( choice >= 0 && choice < arraysize( CURVES ), /*void*/ );
|
||||||
|
|
Loading…
Reference in New Issue