Search code examples
caudiocircular-buffer

circular array in c for a delay line


I'm trying to find any resources online for programming a delay line in c.

I tried implementing this one here

https://ccrma.stanford.edu/~jos/doppler/Variable_Delay_Line_Software.html.

The problem with this is where it says

A[wptr++] = x; 

The compiler throws an error because wptr is a pointer and not an integer.

Could somebody point me toward an example of a compiler friendly example?


Solution

  • Replace:

        A[wptr++] = x; 
    y = A[rptr++];
    

    with:

        *(wptr++) = x;
    y = *(rptr++);