🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #1161

Re: SOUND CARD

#1161
From: ruygh
Date: Sat, 18 Aug 2001 23:05
67 lines
3175 bytes
Thank you very much.
I indeed took the time to dig into the windows API and finally got to
the sequence you suggests with success.
My primary job is RF & DSp electronic design, programming is a side
activity, but for one application, I needed to use the sound card
samples to process them.
I used a callback function instead of windows messages and got a
flawless class.
Thank you very much.

Corey Murtagh wrote:
> 
> <ghislain.ruy@ieee.org> wrote in message news:3B48CDA3.CE2AAD36@ieee.org...
> > Hello,
> >
> > does somebody know how to retrieve raw samples from a sound card in
> > order to process them ?
> > I had a look to winapi but it's quite cumbersome and I would prefer
> > something like a linux driver (just read a file for example). Is there a
> > dll to do the job ?
> > Is it possible via the media player trough undocumented class members or
> > so ?
> 
> Sorry about the delay replying... been messing around with news readers and
> servers.
> 
> Anyway, there are two main ways to access the sound card: MMSystem and
> DirectSound.  I prefer the first, because I've already got lots of code to
> refer to.
> 
> Here's the basic sequence I use to record sound:
> 
> 1: Prepare a WAVEFORMATEX struct to define the sample format
>    (rate, bits, channels, etc)
> 
> 2: Call waveInOpen() to open the input device
> 
> 3: prepare a couple of WAVEHDR structs by allocating buffers,
>    then calling waveInPrepareHeader() on both of them
> 
> 4: Call waveInAddBuffer() to add both buffers to the record
>    queue, then waveInStart() to start it running
> 
> 5: message loop.  Wait on MM_WIM_DATA messages, process them
>    (copy the data out of the buffer, then add it back into
>    the queue with waveInAddBuffer)
> 
> 6: when done, call waveInStop() and wait until all buffers
>    have been returned
> 
> 7: call waveInReset(), waveInUnprepareHeader() on both buffers,
>    the waveInClose() to release the port.
> 
> Hope this helps.  I have some code I can send you if you get bogged down.
> 
> --
> Corey Murtagh
> The Electric Monk
> "Quidquid latine dictum sit, altum viditur."

-- 
--------------
Ghislain RUY
F1HDD
AMSAT FRANCE
Chef de projet SATEDU
--------------
Technical Details
Message-ID: <3B7EF4B0.4F6C85C1@attglobal.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3B48CDA3.CE2AAD36@ieee.org> <3b5d488d_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d0fc,87d2fe03d5ffd029
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2001-08-18 16:09:19 PST
Message-ID: <3B7EF4B0.4F6C85C1@attglobal.net>
Date: Sun, 19 Aug 2001 01:05:20 +0200
From: ruygh@attglobal.net
Reply-To: ghislain.ruy@ieee.org
X-Mailer: Mozilla 4.61 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.multimedia
Subject: Re: SOUND CARD
References: <3B48CDA3.CE2AAD36@ieee.org> <3b5d488d_2@dnews>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 32.106.67.115
X-Trace: dnews 998175946 32.106.67.115 (18 Aug 2001 16:05:46 -0700)
Lines: 67
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews