Celt Codec 간단 한 사용법

1296 단어 code
Celt Codec 은 현재 교차 컴 파일 러 를 컴 파일 해 야 WIN 플랫폼 에서 정상적으로 실 행 될 수 있 습 니 다.제 가 사용 하 는 것 은(mingw)입 니 다.컴 파일 에 성공 하면 libcel.a 가 생 길 수 있 습 니 다.또한 libgcc.a 도 프로젝트 에 COPY 를 사용 해 야 정상적으로 사용 할 수 있 습 니 다.
 g_dwNotifySize = (pwfxInput->nAvgBytesPerSec * 20)/ 1000;    



   : AudioLength=samplingrate *     (20ms) * channl * 2



void TestCeltCodec(short * sAudio)/* sAudio        */

{

 //   

 

 int err,samplingrate=32000,framesize=640,channl=1;



 int nEncodingAudioLength;//          



 unsigned char cEncodingAudioContainer[960];//        



 //   CELT  



 CELTMode * mode=celt_mode_create(samplingrate,framesize,&err);



 CELTEncoder * enc_state=celt_encoder_create(mode, channl, &err);



 CELTDecoder * dec_state=celt_decoder_create(mode, channl, &err);



 //    



 nEncodingAudioLength=celt_encode(enc_state,(celt_int16 *)sAudio,framesize,cEncodingAudioContainer,framesize);



 //    



 celt_int16 * out=(celt_int16*)malloc(framesize*channl*sizeof(celt_int16));



 //    



 celt_decode(dec_state,cEncodingAudioContainer,nEncodingAudioLength,out,framesize);



 //    



 short  sOutput[FRAME_SIZE];



 for (int i=0;i<framesize;i++)

 {

  sOutput[i]=out[i];

 }



 //    



 AudioPay((BYTE*)sAudio,nEncodingAudioLength*2);



}


좋은 웹페이지 즐겨찾기