allpass.c 506 Bytes
/***************************************************************
 *
 *	allpass.c
 *	 the all-pass function
 *
 *	12/15/94		bfs initial version
 *
 */

#include "allpass.h"

float
all_pass_filter(struct ap_info* ap)
{
	float delay_in, delay_out;

	delay_out = *ap->out_ptr;
	delay_in = ap->in_data + (delay_out * ap->coef);
	ap->out_data = delay_out - (delay_in * ap->coef);
	*ap->out_ptr++ = delay_in;

	if (ap->out_ptr > (ap->base + ap->length - 1))
		ap->out_ptr = ap->base;
		
	return ap->out_data;
}