3.3音頻解壓縮與回放
音頻解壓縮部份也在winio.dll封裝,在VB程序中調用,解壓部份用了話音壓縮解碼庫G729a.lib中的函數va_g729a_init_decoder()。
bool _stdcall talk729decoderinit ()//初始化解碼器
{
va_g729a_init_decoder();
return TRUE;
}
bool _stdcall DecodeAudioData( BYTE* pin,int len,short* pout,int* lenr)
//解壓音頻數據, 一次解壓260字節壓縮數據,
{
va_g729a_decoder(pin, pout,0);
va_g729a_decoder(pin+10, pout+80,0);
va_g729a_decoder(pin+20, pout+160,0);
va_g729a_decoder(pin+30, pout+240,0);
…
va_g729a_decoder(pin+250, pout+1820,0);
return TRUE;
}
解壓縮函數void va_g729a_decoder(unsigned char *bitstream, short *synth_short, int bfi),每次解壓10個字節 數據,變成80個16 位 數據,是壓縮的反過程。
3.4 封裝在VB6.0 調用的函數
bool _stdcall talk729decoderinit ()//初始化解壓器
bool _stdcall DecodeAudioData( BYTE* pin,int len,short* pout,int* lenr)//解壓音頻數據, 一次解壓260字節壓縮數據。
bool _stdcall sendhwndtlp(HWND apitexthwnd,unsigned char* apilpmax,HWND apistorekhwnd,short* apilpalldata1,short* apilpalldata2,unsigned char* apilpcodedata)//向DLL傳送句柄與數據地址指針
|