| | |
| | | #include <string.h> |
| | | #include <math.h> |
| | | #include "config.h" |
| | | #include "f2f.h" |
| | | #include "../drv/sport.h" |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | void in2out_bypass(ufloat* out[], ufloat* in[], int ch, int len) |
| | | { |
| | | int i, j; |
| | | for (i = 0; i < ch; i++) |
| | | for (j = 0; j < len; j++) { |
| | | out[i][j] = in[i][j]; |
| | | } |
| | | } |
| | | void sin_gen(ufloat* dat, int len) |
| | | { |
| | | static int sta = 0; |
| | | for (u32 i = 0; i < len; i++) { |
| | | dat[i] = 0.4f * sinf(2 * 3.1415926f * 675 * sta++ / SAMPLE_RATE); |
| | | } |
| | | if (sta == SAMPLE_RATE) |
| | | sta = 0; |
| | | } |
| | | uvoid UpdateOutput(u32 iid ,u32 blockIndex) |
| | | { |
| | | // in2out_bypass(mTxChannel[0], mRxChannel[0], 1, SAMPLE_NUM); |
| | | // static ufloat data[64] = {0}; |
| | | // static int odd = 0; |
| | | // if (0 == odd++ % 3) { |
| | | // sin_gen(data, SAMPLE_NUM); |
| | | // for (u32 i = 0; i < SAMPLE_NUM; i++) { |
| | | // for (u32 j = 0; j < 8; j++) { |
| | | // mTxChannel[0][j][i] = data[i]; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | for(s32 type =0 ; type < COUNT ;type ++) { |
| | | u16 channel = 0; |
| | | u16 output_num = mOutputNum[type]; |
| | |
| | | |
| | | for(u32 i =0 ;i < gCodecNum[type] ;i++) { |
| | | const AudioCodec* codec = &codec_arr[i]; |
| | | |
| | | if(codec->rx == utrue) continue; |
| | | |
| | | ubool enable = (iid == codec->follow_intr_no); |
| | |
| | | |
| | | if(codec->enable_sec){ |
| | | for(u32 j = 0; channel < output_num && j < codec->channel_num*2 ;j ++,channel++) { |
| | | if(enable && pTxChannel[channel] != NULL) |
| | | fixData(dataPtr +OFFSET(j), pTxChannel[channel], codec->slot_num*2, SAMPLE_NUM); |
| | | if(enable && pTxChannel[channel] != NULL) { |
| | | s32 shift = OFFSET(j); |
| | | fixData(dataPtr + shift, pTxChannel[channel], codec->slot_num*2, SAMPLE_NUM); |
| | | } |
| | | } |
| | | } |
| | | else{ |