Advertisement
Guest User

Untitled

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