📄 unit1.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include <math.h>
#pragma hdrstop
#include "Unit1.h"
#define bufsize 160
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i;
static k=0;
short datain[bufsize],dataout[bufsize];
UINT16 Adpcm[bufsize];
static int FirstRun = 1;
static G722_Handle Encode, Decode;
if(FirstRun)
{
G722_EncodeInit( &Encode );
G722_DecodeInit( &Decode );
FirstRun = 0;
}
Series1->Clear();
for( i=0; i<bufsize; i++,k++)
{
datain[i]=32767*sin(10*k*M_PI/bufsize);
Series1->Add( datain[i], "", clTeeColor );
}
//for( j=0; j<N; j++)
//{
G722_Encode( &Encode, datain, Adpcm, bufsize );
G722_Decode( &Decode, Adpcm, dataout, bufsize );
Series2->Clear();
for(i=0;i<bufsize ;i++)
{
Series2->Add( dataout[i-22], "", clTeeColor );
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -