Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Talkthrough.h"
- #include "math.h"
- #define X 9600 //0,2s
- int buffer[X];
- int i=0;
- float depth= 0.1;
- //--------------------------------------------------------------------------//
- // 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
- //echo
- int y = sample;
- sample =buffer[i]+sample;
- buffer[i]=y;
- i++;
- if(i>X)
- {
- i=0;
- }
- float modSignal = (1 - depth) + depth * sin(3.14*(i-X)/X);
- //float modSignal = sin(3.14*(i-X)/X);
- sample = sample*modSignal; // efekt tremolo
- //postprocessing
- sample=sample>>8;
- iChannel0LeftOut = sample;
- iChannel0RightOut = sample;
- iChannel1LeftOut = sample;
- iChannel1RightOut = sample;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement