#ifndef DELAYLINE_H #define DELAYLINE_H #include "includeBS.h" #define DELAY_LINE_SIZE 64 //must be a power of 2 as this speeds up cycling through list typedef struct { int16_t elements[DELAY_LINE_SIZE]; //delay line contents uint8_t newestElement; //index of the newest element }delayLine; void delayLine_init(delayLine *dl); void delayLine_addElement(delayLine *dl, int16_t x); int16_t delayLine_runningAverage8(delayLine *dl, int32_t *accumulator, int16_t x); int16_t delayLine_runningAverage16(delayLine *dl, int32_t *accumulator, int16_t x); int16_t delayLine_runningAverage32(delayLine *dl, int32_t *accumulator, int16_t x); int16_t delayLine_runningAverage64(delayLine *dl, int32_t *accumulator, int16_t x); #endif