如何叫入語音檔秀到TChart? |
|
Bio6
一般會員 發表:48 回覆:37 積分:17 註冊:2005-04-07 發送簡訊給我 |
對TChart還不是了解,compiler會err.有傳整支檔.請指導一下
謝謝 //--------------------------------------------------------------------------- #include #pragma hdrstop #include "uint.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TGraphic *Graphic; //--------------------------------------------------------------------------- __fastcall TGraphic::TGraphic(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TGraphic::btnExitClick(TObject *Sender) { bExit = true; Close(); } //--------------------------------------------------------------------------- void __fastcall TGraphic::btnOpenClick(TObject *Sender) { if(pVoiceBuffer) pVoiceBuffer = NULL; if(f) { f=NULL;} bExit = false; OpenDialog->InitialDir = GetCurrentDir(); if (OpenDialog->Execute()==false) { btnOpen->Enabled = true; return; } btnPlay->Enabled = true; sOpenFileName = OpenDialog->FileName; Graphic->Caption = sOpenFileName.SubString(sOpenFileName.LastDelimiter('\\') 1, sOpenFileName.Length()); Label5->Caption = Graphic->Caption; f = new TFileStream( sOpenFileName , fmShareDenyWrite ); cpHeader = new char[44]; f->ReadBuffer(cpHeader,44); f->Seek(22,soFromBeginning); f->Read(&sChannels,sizeof(short)); Label10->Caption = IntToStr(sChannels); f->Seek(24,soFromBeginning); f->Read(&lSamplingRate,sizeof(long)); Label6->Caption = IntToStr(lSamplingRate) " samples/second"; f->Seek(34,soFromBeginning); f->Read(&sBitsPerSample,sizeof(short)); Label8->Caption = IntToStr(sBitsPerSample) "bits/sample"; f->Seek(40,soFromBeginning); f->Read(&lFileSize,sizeof(long)); Label7->Caption = IntToStr(lFileSize) " bytes"; if(sBitsPerSample == 8) iSampleSize = lFileSize; else if(sBitsPerSample == 16) iSampleSize = lFileSize/2; else { MessageDlg("Not PCM formats!!",mtInformation,TMsgDlgButtons()< } pVoiceBuffer = new short[iSampleSize]; f->Seek(44,soFromBeginning); f->ReadBuffer( pVoiceBuffer ,lFileSize ); int i,yValue; for ( i = 0 ; i < lFileSize; i ) { yValue =pVoiceBuffer[i] ; //yValue = (ChartSeries *)yValue; //Series->AddSeries(yValue,i,"",clRed); Series->Add(yValue,i,"",clRed); //Series->AddSeries(yValue); } } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |