DISCRETE_74LS624 - optimized for some more speed

This commit is contained in:
Derrick Renaud 2009-09-24 23:55:33 +00:00
parent 24da866367
commit a6571e2487

View File

@ -125,6 +125,7 @@ struct dsd_ls624_context
int out_type;
double k1; /* precalculated cap part of formula */
double k2; /* precalculated ring part of formula */
double dt_vmod_at_0;
};
@ -1600,7 +1601,11 @@ static DISCRETE_STEP(dsd_ls624)
sample_t = node->info->sample_time; /* Change in time */
//dt = LS624_T(DSD_LS624__C, DSD_LS624__VRNG, DSD_LS624__VMOD) / 2.0;
dt = 1.0f / (2.0f * LS624_F(DSD_LS624__VMOD));
if (DSD_LS624__VMOD > 0.001)
dt = 1.0f / (2.0f * LS624_F(DSD_LS624__VMOD));
else
/* close enough to 0, so we can speed things up by no longer call pow() */
dt = context->dt_vmod_at_0;
t = context->remain;
en += (double) context->state * t;
while (t + dt <= sample_t)
@ -1649,6 +1654,8 @@ static DISCRETE_RESET(dsd_ls624)
context->k1 = -0.912029404 * log10(DSD_LS624__C) -0.091695877 * (DSD_LS624__VRNG) - 3.207072925;
context->k2 = -0.014110946 * (DSD_LS624__VRNG);
context->dt_vmod_at_0 = 1.0f / (2.0f * LS624_F(0));
/* Step the output */
DISCRETE_STEP_CALL(dsd_ls624);
}