double ms20filter_tick(struct ms20filter* s, double lp_in, double bp_in, double omega, double resonance /* max 1 */) { // if (resonance > 0.999) // resonance = 0.999; if (omega > 1) omega = 1; double r = resonance * (2-omega); // 1+1/(1-omega) double s0 = s->state0; double s1 = s->state1; double feed0 = lp_in + bp_in - s1*r; double feed1 = s0 - bp_in + s1*r; s0 = s0 + omega*(fasttanh(feed0)-fasttanh(s0)); s1 = s1 + omega*(fasttanh(feed1)-fasttanh(s1)); s->state0 = s0; s->state1 = s1; return s1; }
double moog_gennext(filter *f, double xn) { if (f->m_type == BSF2 || f->m_type == LPF1 || f->m_type == HPF1) return xn; filter_moog *moog = (filter_moog *)f; double sigma = onepole_get_feedback_output(&moog->m_LPF1) + onepole_get_feedback_output(&moog->m_LPF2) + onepole_get_feedback_output(&moog->m_LPF3) + onepole_get_feedback_output(&moog->m_LPF4); xn *= 1.0 + f->m_aux_control * moog->m_k; double u = (xn - moog->m_k * sigma) * moog->m_alpha_0; if (f->m_nlp == ON) { u = fasttanh(f->m_saturation * u); } double LP1 = onepole_gennext((filter *)&moog->m_LPF1, u); double LP2 = onepole_gennext((filter *)&moog->m_LPF2, u); double LP3 = onepole_gennext((filter *)&moog->m_LPF3, u); double LP4 = onepole_gennext((filter *)&moog->m_LPF4, u); return moog->m_a * u + moog->m_b * LP1 + moog->m_c * LP2 + moog->m_d * LP3 + moog->m_e * LP4; }
int main() { a = exp(a); b = expf(b); c = fastexp(c); d = fasterexp(c); printf("%f %f %f %f\n", a, b, c, d); a = log(a); b = logf(b); c = fastlog(c); d = fasterlog(c); printf("%f %f %f %f\n", a, b, c, d); a = pow(a,a); b = pow(b,b); c = fastpow(c,c); d = fasterpow(c,c); printf("%f %f %f %f\n", a, b, c, d); a = sin(a); b = sinf(b); c = fastsin(c); d = fastersin(c); printf("%f %f %f %f\n", a, b, c, d); a = cos(a); b = cosf(b); c = fastcos(c); d = fastercos(c); printf("%f %f %f %f\n", a, b, c, d); a = tan(a); b = tanf(b); c = fasttan(c); d = fastertan(c); printf("%f %f %f %f\n", a, b, c, d); a = asin(a); b = asinf(b); printf("%f %f %f %f\n", a, b, c, d); a = acos(a); b = acosf(b); printf("%f %f %f %f\n", a, b, c, d); a = atan(a); b = atanf(b); printf("%f %f %f %f\n", a, b, c, d); a = sinh(a); b = sinhf(b); c = fastsinh(c); d = fastersinh(c); printf("%f %f %f %f\n", a, b, c, d); a = cosh(a); b = coshf(b); c = fastcosh(c); d = fastercosh(c); printf("%f %f %f %f\n", a, b, c, d); a = tanh(a); b = tanhf(b); c = fasttanh(c); d = fastertanh(c); printf("%f %f %f %f\n", a, b, c, d); a = lgamma(a); b = lgammaf(b); c = fastlgamma(c); d = fasterlgamma(c); printf("%f %f %f %f\n", a, b, c, d); return 0; }