Advertisement
kneefer

smiw - dsp final

Dec 8th, 2014
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include "Talkthrough.h"
  2.  
  3. //--------------------------------------------------------------------------//
  4. // Function:    Process_Data()                                              //
  5. //                                                                          //
  6. // Description: This function is called from inside the SPORT0 ISR every    //
  7. //              time a complete audio frame has been received. The new      //
  8. //              input samples can be found in the variables iChannel0LeftIn,//
  9. //              iChannel0RightIn, iChannel1LeftIn and iChannel1RightIn      //
  10. //              respectively. The processed data should be stored in        //
  11. //              iChannel0LeftOut, iChannel0RightOut, iChannel1LeftOut,      //
  12. //              iChannel1RightOut, iChannel2LeftOut and iChannel2RightOut   //
  13. //              respectively.                                               //
  14. //--------------------------------------------------------------------------//
  15. #define BUFFOR_SIZE 10000
  16.  
  17. int Buffor[BUFFOR_SIZE] = { 0 };
  18. int Buffor_Pozycja = 0;
  19.  
  20. int GetFromBuffer(int index)
  21. {
  22.     return Buffor[(Buffor_Pozycja + index) % BUFFOR_SIZE];
  23. }
  24.  
  25.  
  26. void Echo(void)
  27. {
  28.     int value = iChannel0LeftIn<<8;
  29.     Buffor[Buffor_Pozycja] = value;
  30.  
  31.     iChannel0LeftOut = (value / 2 + GetFromBuffer(1) / 4) >> 8;
  32.     iChannel0RightOut = iChannel0LeftOut;
  33.  
  34.     Buffor_Pozycja = (Buffor_Pozycja + 1) % BUFFOR_SIZE;
  35. }
  36.  
  37.  
  38. void Process_Data(void)
  39. {
  40.     Echo();
  41.     //iChannel0LeftOut   = iChannel0LeftIn;
  42.     //iChannel0RightOut  = iChannel0RightIn;
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement