SHARE
TWEET

dd

a guest Oct 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Talkthrough.h"
  2. #include "math.h"
  3. int second = 48000;
  4. int i = 0;
  5. int bufor[48000];
  6. int first = 1;
  7.  
  8. //--------------------------------------------------------------------------//
  9. // Function:    Process_Data()                                              //
  10. //                                                                          //
  11. // Description: This function is called from inside the SPORT0 ISR every    //
  12. //              time a complete audio frame has been received. The new      //
  13. //              input samples can be found in the variables iChannel0LeftIn,//
  14. //              iChannel0RightIn, iChannel1LeftIn and iChannel1RightIn      //
  15. //              respectively. The processed data should be stored in        //
  16. //              iChannel0LeftOut, iChannel0RightOut, iChannel1LeftOut,      //
  17. //              iChannel1RightOut, iChannel2LeftOut and iChannel2RightOut   //
  18. //              respectively.                                               //
  19. //--------------------------------------------------------------------------//
  20. void Process_Data(void)
  21. {
  22.     int sampleLeft=iChannel0LeftIn<<8;
  23.     int sampleRight=iChannel0RightIn<<8;
  24.     int sample =(sampleLeft+sampleRight)/2;
  25.    
  26.     //student's code here
  27.     int secondago = bufor[i];
  28.     bufor[i] = sample;
  29.  
  30.     sample += secondago;
  31.     bufor[i] += sample/2;
  32.  
  33.  
  34.     i++;
  35.  
  36.     i = i % second;
  37.  
  38.  
  39.     //postprocessing
  40.     sample=sample>>8;
  41.     iChannel0LeftOut = sample;
  42.     iChannel0RightOut = sample;
  43.     iChannel1LeftOut = sample;
  44.     iChannel1RightOut = sample;
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top