Article View: borland.public.cppbuilder.multimedia
Article #1326need help to use the waveIn function
From: jacob
Date: Thu, 05 Apr 2001 13:06
Date: Thu, 05 Apr 2001 13:06
51 lines
2448 bytes
2448 bytes
I wrote the code below to acquire a signal with a sound card.
I use for this the example given by Charles Petzold in "Programming windows
5th editions".
With Borland C++Builder 5 the code is compiled ands seems to be executed
properly by i
don't see the data inthe buffer after an execution.
Sure i have not understood everything !
who can help me
thanks by advance
void __fastcall TForm1::B_acquerirClick(TObject *Sender)
{
int N_audio_device = waveInGetNumDevs();
E_val_lue->Text=IntToStr(N_audio_device);
static HWAVEIN hwin;
static WAVEFORMATEX waveform;
waveform.wFormatTag = WAVE_FORMAT_PCM;
waveform.nChannels = 1; // enregistrement 1 voie
waveform.nSamplesPerSec= 8.0;
waveform.nAvgBytesPerSec=8.0;
waveform.nBlockAlign=1;
waveform.wBitsPerSample = 8;
waveform.cbSize =0;
waveInOpen( &hwin,WAVE_MAPPER, &waveform,0,0,0);
int n_byte=10000; // nombre d'octets acquis
static WAVEHDR *wavehdr1 = new WAVEHDR;
char *buffer1 = new char[n_byte];
wavehdr1->lpData = buffer1;
wavehdr1->dwBufferLength=n_byte;
waveInPrepareHeader(hwin,wavehdr1,sizeof(WAVEHDR));
waveInReset(hwin);
waveInAddBuffer(hwin,wavehdr1,sizeof(WAVEHDR));
waveInStart(hwin);
// attendre(0.15); this function waits for 0.15 s
int n=0;
n=wavehdr1->dwBytesRecorded;
E_val_lue->Text=IntToStr(n);
waveInStop(hwin);
waveInClose(hwin);
// i would like to obtain the dat in buffer1 here, How ?
delete[] buffer1;
delete wavehdr1;
}
Technical Details
Message-ID:
<3acc6d6e_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d0fc,225a79bff939e2f,start X-Google-Attributes: gid10d0fc,public X-Google-ArrivalTime: 2001-04-05 06:50:04 PST Reply-To: "jacob" <jacob86@voila.fr> From: "jacob" <jacob86@voila.fr> Newsgroups: borland.public.cppbuilder.multimedia Subject: need help to use the waveIn function Date: Thu, 5 Apr 2001 15:06:23 +0200 Lines: 55 Organization: iut X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 195.220.220.200 Message-ID: <3acc6d6e_1@dnews> X-Trace: dnews 986475886 195.220.220.200 (5 Apr 2001 06:04:46 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews