src/FaustSawtooth.cpp
static FAUSTFLOAT dB2Scale(FAUSTFLOAT dB)
{
    FAUSTFLOAT scale = FAUSTFLOAT(1.0);
    
    /*if (dB < -70.0f)
     scale = 0.0f;
     else*/
    if (dB < FAUSTFLOAT(-60.0))
        scale = (dB + FAUSTFLOAT(70.0)) * FAUSTFLOAT(0.0025);
    else if (dB < FAUSTFLOAT(-50.0))
        scale = (dB + FAUSTFLOAT(60.0)) * FAUSTFLOAT(0.005) + FAUSTFLOAT(0.025);
    else if (dB < FAUSTFLOAT(-40.0))
        scale = (dB + FAUSTFLOAT(50.0)) * FAUSTFLOAT(0.0075) + FAUSTFLOAT(0.075);
    else if (dB < FAUSTFLOAT(-30.0))
        scale = (dB + FAUSTFLOAT(40.0)) * FAUSTFLOAT(0.015) + FAUSTFLOAT(0.15);
    else if (dB < FAUSTFLOAT(-20.0))
        scale = (dB + FAUSTFLOAT(30.0)) * FAUSTFLOAT(0.02) + FAUSTFLOAT(0.3);
    else if (dB < FAUSTFLOAT(-0.001) || dB > FAUSTFLOAT(0.001))  /* if (dB < 0.0) */
        scale = (dB + FAUSTFLOAT(20.0)) * FAUSTFLOAT(0.025) + FAUSTFLOAT(0.5);
    
    return scale;
}
/**
 * Convert a dB value into a scale between 0 and 1 (following IEC standard ?)
 */
Convert a dB value into a scale between 0 and 1 (following IEC standard ?)
Convert a dB value into a scale between 0 and 1 ( following IEC standard ? )
static FAUSTFLOAT dB2Scale(FAUSTFLOAT dB)
{
    FAUSTFLOAT scale = FAUSTFLOAT(1.0);
    if (dB < FAUSTFLOAT(-60.0))
        scale = (dB + FAUSTFLOAT(70.0)) * FAUSTFLOAT(0.0025);
    else if (dB < FAUSTFLOAT(-50.0))
        scale = (dB + FAUSTFLOAT(60.0)) * FAUSTFLOAT(0.005) + FAUSTFLOAT(0.025);
    else if (dB < FAUSTFLOAT(-40.0))
        scale = (dB + FAUSTFLOAT(50.0)) * FAUSTFLOAT(0.0075) + FAUSTFLOAT(0.075);
    else if (dB < FAUSTFLOAT(-30.0))
        scale = (dB + FAUSTFLOAT(40.0)) * FAUSTFLOAT(0.015) + FAUSTFLOAT(0.15);
    else if (dB < FAUSTFLOAT(-20.0))
        scale = (dB + FAUSTFLOAT(30.0)) * FAUSTFLOAT(0.02) + FAUSTFLOAT(0.3);
    else if (dB < FAUSTFLOAT(-0.001) || dB > FAUSTFLOAT(0.001))  
        scale = (dB + FAUSTFLOAT(20.0)) * FAUSTFLOAT(0.025) + FAUSTFLOAT(0.5);
    return scale;
}
static FAUSTFLOAT dB2Scale ( FAUSTFLOAT dB ) { FAUSTFLOAT scale = FAUSTFLOAT ( 1.0 ) ; if ( dB < FAUSTFLOAT ( -60.0 ) ) scale = ( dB + FAUSTFLOAT ( 70.0 ) ) * FAUSTFLOAT ( 0.0025 ) ; else if ( dB < FAUSTFLOAT ( -50.0 ) ) scale = ( dB + FAUSTFLOAT ( 60.0 ) ) * FAUSTFLOAT ( 0.005 ) + FAUSTFLOAT ( 0.025 ) ; else if ( dB < FAUSTFLOAT ( -40.0 ) ) scale = ( dB + FAUSTFLOAT ( 50.0 ) ) * FAUSTFLOAT ( 0.0075 ) + FAUSTFLOAT ( 0.075 ) ; else if ( dB < FAUSTFLOAT ( -30.0 ) ) scale = ( dB + FAUSTFLOAT ( 40.0 ) ) * FAUSTFLOAT ( 0.015 ) + FAUSTFLOAT ( 0.15 ) ; else if ( dB < FAUSTFLOAT ( -20.0 ) ) scale = ( dB + FAUSTFLOAT ( 30.0 ) ) * FAUSTFLOAT ( 0.02 ) + FAUSTFLOAT ( 0.3 ) ; else if ( dB < FAUSTFLOAT ( -0.001 ) || dB > FAUSTFLOAT ( 0.001 ) ) scale = ( dB + FAUSTFLOAT ( 20.0 ) ) * FAUSTFLOAT ( 0.025 ) + FAUSTFLOAT ( 0.5 ) ; return scale ; }
Convert a dB value into a scale between 0 and 1 (following IEC standard ?)
Convert a dB value into a scale between 0 and 1 ( following IEC standard ? )
/*if (dB < -70.0f)
     scale = 0.0f;
     else*/ /* if (dB < 0.0) */