Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include "Talkthrough.h"
  2. int bufor[48000]={0};
  3. int indeks = 0;
  4. int wyjscie = 0;
  5. //--------------------------------------------------------------------------//
  6. // Function: Process_Data() //
  7. // //
  8. // Description: This function is called from inside the SPORT0 ISR every //
  9. // time a complete audio frame has been received. The new //
  10. // input samples can be found in the variables iChannel0LeftIn,//
  11. // iChannel0RightIn, iChannel1LeftIn and iChannel1RightIn //
  12. // respectively. The processed data should be stored in //
  13. // iChannel0LeftOut, iChannel0RightOut, iChannel1LeftOut, //
  14. // iChannel1RightOut, iChannel2LeftOut and iChannel2RightOut //
  15. // respectively. //
  16. //--------------------------------------------------------------------------//
  17. void Process_Data(void)
  18. {
  19. int sampleLeft=iChannel0LeftIn<<8;
  20. int sampleRight=iChannel0RightIn<<8;
  21. int sample =(sampleLeft+sampleRight)/2;
  22.  
  23. //student's code here
  24.  
  25.  
  26.  
  27. bufor[indeks]=sample;
  28. wyjscie = bufor[indeks*2]+sample;
  29. indeks++;
  30.  
  31. if (indeks>=1000)
  32. {
  33. indeks=0;
  34. }
  35. if(indeks>20000)
  36. {
  37. wyjscie+=bufor[indeks-20000];
  38. }
  39. // for (int i= 0; i >=48000; i++)
  40. // {
  41.  
  42. // bufor[i]=sample*2;
  43.  
  44. // }
  45. sample=wyjscie;
  46.  
  47.  
  48. //postprocessing
  49. sample=sample>>8;
  50. iChannel0LeftOut = sample;
  51. iChannel0RightOut = sample;
  52. iChannel1LeftOut = sample;
  53. iChannel1RightOut = sample;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement