Article View: borland.public.cppbuilder.multimedia
Article #1219Re: SOUND CARD
From: Corey Murtagh
Date: Tue, 24 Jul 2001 10:06
Date: Tue, 24 Jul 2001 10:06
49 lines
2463 bytes
2463 bytes
<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."
Technical Details
Message-ID:
<3b5d488d_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3B48CDA3.CE2AAD36@ieee.org>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-07-24 03:10:32 PST From: "Corey Murtagh" <emonk@ihug.co.nz> Newsgroups: borland.public.cppbuilder.multimedia References: <3B48CDA3.CE2AAD36@ieee.org> Subject: Re: SOUND CARD Date: Tue, 24 Jul 2001 22:06:08 +1200 Lines: 51 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: 203.173.208.48 Message-ID: <3b5d488d_2@dnews> X-Trace: dnews 995969165 203.173.208.48 (24 Jul 2001 03:06:05 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews