apcomb.c 530 Bytes
/***************************************************************
 *
 *	apcomb.c
 *	 the all-pass inside a comb filter function
 *
 *	12/22/94		bfs initial version
 *
 */

#include "apcomb.h"

float
apcomb(struct apc_info* apc)
{
	float delay_in, delay_out;

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

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