circular buffer

31 Oct 2011

I am trying to add a circular buffer to the reverse effects code.

http://mbed.org/users/mbed2f/notebook/usbmainc--the-main-file-of-the-usb-reverse-audio-c/

I got the circular buffer code from the cookbook

http://mbed.org/cookbook/TLV320AIC23B

http://mbed.org/users/d_worrall/programs/playback/lvgoa5/docs/main_8cpp_source.html

But I don't seem to understand what fillBuffer is linked to what hardware command it is linked to like LPC_DAC->DACR = PlaySample & 0xFFC0; would write from the dac register

(circularBuffer, readPointer, 8);



int circularBuffer[4096];    
volatile int readPointer = 0;
volatile int theta = 0;




fillBuffer
if (Playback)
    {
        PlaySample = circularBuffer[4096];
        readPointer += 8;
        readPointer &= 0xfff;
        theta -= 8
    }
static volatile int writePointer = 0;
     if(theta < 4096){
       Playback = TRUE;

            theta+=4;
            writePointer+=4;
            writePointer &= 0xfff;
        }

  LPC_DAC->DACR = PlaySample & 0xFFC0;      /* Set Speaker Output */





 	  
/*****************************************************************************
**   Main Function  main()
******************************************************************************/


for(int j = 0; j < 4096; ++j){          //upon interrupt generation
        circularBuffer[j] = 0;              //clear circular buffer

    fillBuffer();                           //continually fill circular buffer

29 Jan 2019

.

29 Jan 2019

.