Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Talkthrough.h"
- #include <math.h>
- #define M_PI 3.14159265358979323846
- //--------------------------------------------------------------------------//
- // Function: Process_Data() //
- // //
- // Description: This function is called from inside the SPORT0 ISR every //
- // time a complete audio frame has been received. The new //
- // input samples can be found in the variables iChannel0LeftIn,//
- // iChannel0RightIn, iChannel1LeftIn and iChannel1RightIn //
- // respectively. The processed data should be stored in //
- // iChannel0LeftOut, iChannel0RightOut, iChannel1LeftOut, //
- // iChannel1RightOut, iChannel2LeftOut and iChannel2RightOut //
- // respectively. //
- //--------------------------------------------------------------------------//
- void Process_Data(void)
- {
- int sampleLeft=iChannel0LeftIn<<8;
- int sampleRight=iChannel0RightIn<<8;
- int sample =(sampleLeft+sampleRight)/2;
- //student's code here
- float krok = 0.00001636246;
- static float tmp = 0;
- int sampleP = sample;
- int sampleL = sample;
- sampleP *= ((cos(tmp)+1)/2);
- sampleL *= ((cos(tmp+M_PI)+1)/2);
- tmp += krok;
- //postprocessing
- sampleL=sampleL>>8;
- sampleP=sampleP>>8;
- sample=sample>>8;
- iChannel0LeftOut = sampleL;
- iChannel0RightOut = sampleP;
- iChannel1LeftOut = sampleL;
- iChannel1RightOut = sampleP;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement