πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
3 messages
3 total messages Started by jacob Thu, 05 Apr 2001 13:06
need help to use the waveIn function
#1326
Author: jacob
Date: Thu, 05 Apr 2001 13:06
51 lines
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;
}
Re: need help to use the waveIn function
#1340
Author: Damon Chandler (TeamB)
Date: Tue, 10 Apr 2001 09:42
13 lines
1278 bytes
Hi Jacob,
[snip]
> don't see the data inthe buffer after an execution.

Compare your implementation with the example from this page...

   http://bcbcaq.freeservers.com/project_WaveRecord.html

Good luck,
-- 
Damon Chandler (TeamB)
- BCBCAQ <http://bcbcaq.freeservers.com>
- Graphics API Black Book <http://graphicsBB.itgo.com>
Re: need help to use the waveIn function
#1343
Author: jacob
Date: Thu, 12 Apr 2001 07:42
21 lines
1520 bytes
It seems to be exactly what i need !

Thank you very much
Dominique jacob


Damon Chandler (TeamB) <dmc27@cornell.edu> a οΏ½crit dans le message :
3AD2D586.3DD67CB6@cornell.edu...
> Hi Jacob,
> [snip]
> > don't see the data inthe buffer after an execution.
>
> Compare your implementation with the example from this page...
>
>    http://bcbcaq.freeservers.com/project_WaveRecord.html
>
> Good luck,
> --
> Damon Chandler (TeamB)
> - BCBCAQ <http://bcbcaq.freeservers.com>
> - Graphics API Black Book <http://graphicsBB.itgo.com>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads