static double lfo_get_value(SimpleLFO *lfo)

{

    double phs = FFMIN(100, lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset);

    double val;



    if (phs > 1)

        phs = fmod(phs, 1.);



    switch (lfo->mode) {

    case SINE:

        val = sin(phs * 2 * M_PI);

        break;

    case TRIANGLE:

        if (phs > 0.75)

            val = (phs - 0.75) * 4 - 1;

        else if (phs > 0.25)

            val = -4 * phs + 2;

        else

            val = phs * 4;

        break;

    case SQUARE:

        val = phs < 0.5 ? -1 : +1;

        break;

    case SAWUP:

        val = phs * 2 - 1;

        break;

    case SAWDOWN:

        val = 1 - phs * 2;

        break;


    }



    return val * lfo->amount;

}
static double lfo_get_value(SimpleLFO *lfo)

{

    double phs = FFMIN(100, lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset);

    double val;



    if (phs > 1)

        phs = fmod(phs, 1.);



    switch (lfo->mode) {

    case SINE:

        val = sin(phs * 2 * M_PI);

        break;

    case TRIANGLE:

        if (phs > 0.75)

            val = (phs - 0.75) * 4 - 1;

        else if (phs > 0.25)

            val = -4 * phs + 2;

        else

            val = phs * 4;

        break;

    case SQUARE:

        val = phs < 0.5 ? -1 : +1;

        break;

    case SAWUP:

        val = phs * 2 - 1;

        break;

    case SAWDOWN:

        val = 1 - phs * 2;

        break;


    }



    return val * lfo->amount;

}
static double FUNC_0(SimpleLFO *VAR_0)

{

    double VAR_1 = FFMIN(100, VAR_0->phase / FFMIN(1.99, FFMAX(0.01, VAR_0->pwidth)) + VAR_0->offset);

    double VAR_2;



    if (VAR_1 > 1)

        VAR_1 = fmod(VAR_1, 1.);



    switch (VAR_0->mode) {

    case SINE:

        VAR_2 = sin(VAR_1 * 2 * M_PI);

        break;

    case TRIANGLE:

        if (VAR_1 > 0.75)

            VAR_2 = (VAR_1 - 0.75) * 4 - 1;

        else if (VAR_1 > 0.25)

            VAR_2 = -4 * VAR_1 + 2;

        else

            VAR_2 = VAR_1 * 4;

        break;

    case SQUARE:

        VAR_2 = VAR_1 < 0.5 ? -1 : +1;

        break;

    case SAWUP:

        VAR_2 = VAR_1 * 2 - 1;

        break;

    case SAWDOWN:

        VAR_2 = 1 - VAR_1 * 2;

        break;


    }



    return VAR_2 * VAR_0->amount;

}
static double FUNC_0(SimpleLFO *VAR_0)
{ double VAR_1 = FFMIN(100, VAR_0->phase / FFMIN(1.99, FFMAX(0.01, VAR_0->pwidth)) + VAR_0->offset); double VAR_2; if (VAR_1 > 1)
VAR_1 = fmod(VAR_1, 1.); switch (VAR_0->mode) { case SINE:
VAR_2 = sin(VAR_1 * 2 * M_PI); break; case TRIANGLE:
if (VAR_1 > 0.75)
VAR_2 = (VAR_1 - 0.75) * 4 - 1; else if (VAR_1 > 0.25)
VAR_2 = -4 * VAR_1 + 2; else
VAR_2 = VAR_1 * 4; break; case SQUARE:
VAR_2 = VAR_1 < 0.5 ? -1 : +1; break; case SAWUP:
VAR_2 = VAR_1 * 2 - 1; break; case SAWDOWN:
VAR_2 = 1 - VAR_1 * 2; break; } return VAR_2 * VAR_0->amount; }