Article View: borland.public.cppbuilder.multimedia
Article #1217Re: SOUND CARD
From: Corey Murtagh
Date: Mon, 09 Jul 2001 22:05
Date: Mon, 09 Jul 2001 22:05
50 lines
3200 bytes
3200 bytes
<ghislain.ruy@ieee.org> wrote in message news:3B48CDA3.CE2AAD36@ieee.org... > Hello, Hi Ghislane, > 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 ? Unfortunately the driver model in Windows is significantly different to the Linux one. However, although the mmSystem API is a little complex it doesn't take too long to work out. Create a WAVEFORMATEX structure to describe the recording format you need and pass it to waveInOpen() to open a wave input device. Prepare two (or more - two is a good starting number) buffers using waveInPrepareHeader(), then add them to the record queue with waveInAddBuffer(). Start recording with waveInStart(). Don't forget to allocate the memory for the buffers, as the mmsystem won't do this for you. Once that's all done you should get callbacks (or messages, or...) when each buffer is filled. Take the data out of the buffer and re-add the buffer to the recording queue. You might want to do this in a seperate thread to abstract it all from your processing routines - use a memory stream or something to store it in, then your processing routines just need to read from the stream. Once you are done recording, call waveInStop() to stop recording, wait for the mmsystem to tell you it is done, then clean up: call waveInUnprepareHeader() on all buffers prepared earlier, then waveInReset() and finally waveInClose(). > Is it possible via the media player trough undocumented class members or > so ? I prefer to go straight to the mmsystem as it's about as low-level as you can get without some knowledge of the actual sound drivers. Of course you could try using DirectSound... assuming it has a recording facility? I haven't touched DirectX yet, but then I haven't needed it. > Thank you in advance for help. Hope it helps. Let me know if you get lost. -- Corey Murtagh The Electric Monk "Quidquid latine dictum sit, altum viditur."
Technical Details
Message-ID:
<9id9pl$7c8$1@lust.ihug.co.nz>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-out.nibble.net!news-in.nibble.net!nntp-relay.ihug.net!lust.ihug.co.nz!ihug.co.nz!not-for-mailReferences:
<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-09 15:04:40 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-out.nibble.net!news-in.nibble.net!nntp-relay.ihug.net!lust.ihug.co.nz!ihug.co.nz!not-for-mail From: "Corey Murtagh" <emonk@ihug.co.nz> Newsgroups: borland.public.cppbuilder.multimedia Subject: Re: SOUND CARD Date: Tue, 10 Jul 2001 10:05:09 +1200 Organization: ihug ( New Zealand ) Lines: 53 Message-ID: <9id9pl$7c8$1@lust.ihug.co.nz> References: <3B48CDA3.CE2AAD36@ieee.org> NNTP-Posting-Host: 203-109-154-147.akl.ihugultra.co.nz X-Trace: lust.ihug.co.nz 994716278 7560 203.109.154.147 (9 Jul 2001 22:04:38 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Mon, 9 Jul 2001 22:04:38 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200