?? process_data.c
字號:
#include "Talkthrough.h"
//--------------------------------------------------------------------------//
// 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)
{
//Process the data
int nValue;
int i;
extern int BTCLeftVolume;
extern int BTCRightVolume;
//fir_init(state, coefs, delay, NUM_TAPS, 1); // initialize filter state
iir_init(state,coefs,delay,NUM_TAPS);
if (dmaFlag == 0)
{
/*for (i=0;i<(2*VEC_SIZE);i++)
{
iTxBuffer0[i] = iRxBuffer1[i];
}*/
//firStereo(iRxBuffer1, iTxBuffer0, VEC_SIZE, &state); // apply the filter to the data
iirStereo(iRxBuffer1,iTxBuffer0, VEC_SIZE, &state);
for (i=0;i<VEC_SIZE;i++)
{
iChannel0LeftOut = iTxBuffer0[2*i];
nValue = (iChannel0LeftOut);
nValue = (nValue >> BTCLeftVolume); //volume
btc_write_value(0, (unsigned int*)&nValue, sizeof(nValue));
iChannel0RightOut = iTxBuffer0[2*i+1];
nValue = (iChannel0RightIn);
nValue = (nValue >> BTCRightVolume);//volume
btc_write_value(1, (unsigned int*)&nValue, sizeof(nValue));
}
dmaFlag = 1;
}
else
{
/*for (i=0;i<(2*VEC_SIZE);i++)
{
iTxBuffer1[i] = iRxBuffer0[i];
}*/
//firStereo(iRxBuffer0, iTxBuffer1, VEC_SIZE, &state); // apply the filter to the data
iirStereo(iRxBuffer0, iTxBuffer1, VEC_SIZE, &state); // apply the filter to the data
for (i=0;i<VEC_SIZE;i++)
{
iChannel0LeftOut = iTxBuffer1[2*i];
nValue = (iChannel0LeftOut);
nValue = (nValue >> BTCLeftVolume); //volume
btc_write_value(0, (unsigned int*)&nValue, sizeof(nValue));
iChannel0RightOut = iTxBuffer1[2*i+1];
nValue = (iChannel0RightIn);
nValue = (nValue >> BTCRightVolume);//volume
btc_write_value(1, (unsigned int*)&nValue, sizeof(nValue));
}
dmaFlag = 0;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -