res = pow(10, (svf->res_dB - 96) / 20); fr = 2.0 * (double)svf->freq / (double)play_mode->rate; q = 1.0 - fr; p = fr + 0.8 * fr * q; f = p + p - 1.0; q = res * (1.0 + 0.5 * q * (1.0 - q + 5.6 * q * q)); svf->f = TIM_FSCALE(f, 24); svf->p = TIM_FSCALE(p, 24); svf->q = TIM_FSCALE(q, 24);
if(svf->freq != svf->last_freq || svf->res_dB != svf->last_res_dB) { if(svf->last_freq == 0) {	 svf->b0 = svf->b1 = svf->b2 = svf->b3 = svf->b4 = 0; } svf->last_freq = svf->freq, svf->last_res_dB = svf->res_dB;  res = pow(10, (svf->res_dB - 96) / 20); fr = 2.0 * (double)svf->freq / (double)play_mode->rate; q = 1.0 - fr; p = fr + 0.8 * fr * q; f = p + p - 1.0; q = res * (1.0 + 0.5 * q * (1.0 - q + 5.6 * q * q)); svf->f = TIM_FSCALE(f, 24); svf->p = TIM_FSCALE(p, 24); svf->q = TIM_FSCALE(q, 24); }
void calc_filter_moog(filter_moog *svf){	double res, fr, p, q, f;	res = pow(10, (svf->res_dB - 96) / 20);	fr = 2.0 * (double)svf->freq / (double)play_mode->rate;	q = 1.0 - fr;	p = fr + 0.8 * fr * q;	f = p + p - 1.0;	q = res * (1.0 + 0.5 * q * (1.0 - q + 5.6 * q * q));	svf->f = TIM_FSCALE(f, 24);	svf->p = TIM_FSCALE(p, 24);	svf->q = TIM_FSCALE(q, 24);}