Re: saving capture to disk



Hi Darren,
Welcome to MSDN Newsgroup!

Based on my knowledge, The DirectSound API does not include methods for
writing to WAV files. We should do it by ourselves, just like Opening a
file and writes the header chunks, Writing from a buffer to the data chunk
and advancing the write cursor, Writing the size of the data chunk in the
header and closing the file. It's so tedious and prone to error. However,
we can use CWaveFile class to achieve this goal. This class encapsulates
the "mmio" API to operate WAV file. It will make things easier. We can get
this class source code from the Dsutil.cpp file shipped with DirectXSDK.

I hope the above information is helpful for you. If there is anything I
can do for you, please feel free to let me know. Thanks and have a nice day!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
Date: Mon, 13 Mar 2006 15:19:19 -0800
From: Darren <Darren@xxxxxxxxxxxxx>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
Subject: Re: saving capture to disk
References: <Oi4m5JuRGHA.4920@xxxxxxxxxxxxxxxxxxxx>
<10nig0u0r93ph.718s0uiu21gc.dlg@xxxxxxxxxx>
In-Reply-To: <10nig0u0r93ph.718s0uiu21gc.dlg@xxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <OtzGtTvRGHA.1844@xxxxxxxxxxxxxxxxxxxx>
Newsgroups: microsoft.public.win32.programmer.directx.audio
NNTP-Posting-Host: h70-66-128-230.sbm.shawcable.net 70.66.128.230
Lines: 1
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl
microsoft.public.win32.programmer.directx.audio:8355
X-Tomcat-NG: microsoft.public.win32.programmer.directx.audio

I am using MDX.

I saw the CaptureSound sample that created a wav file but didn't want to
go through
all that work if I didn't have to. I'm capturing and also dynamically
generating
the samples and allowing the user to preview or save to a file.

I've looked at DirectShow but I don't like the API;
I don't want to deals with graphs, pins, filters etc & AFAIK there is no
managed version.


Chris P. [MVP] wrote:
On Mon, 13 Mar 2006 13:07:15 -0800, Darren wrote:

I cannot located the method that will save a capture buffer to a wav
file.
Perhaps I'm just making a bad assumption based on the buffer
constructor being able to read wav files directly.

I presume your talking about managed code here (it is always good to
specify so we don't have to guess).

Correct, there is no method to save a capture buffer to file. You have
to
do this through standard file I/O methods. The buffer constructor has
the
method out of convenience and that output is much more common than input.
It would be difficult for a capture buffer as the data is usually
streamed.

If you simply want to record a file DirectShow might be easier. The only
catch is that you have to first compile the WaveDest sample as well as
the
baseclasses which are all C++.



.



Relevant Pages

  • RE: Managed CameraCaptureDialog class causes an Unknown Exception.
    ... This works with no problems and allows me to get closer to the API itself. ... of control over the dialog, speed of the call and the issues surrounding the ... DirectShow sample it doesn't give you enough to get into modifying it. ... unknown exception when run on my Windows Mobile 5 IPaq hw6915. ...
    (microsoft.public.pocketpc.developer)
  • Re: Broadcasting using WME SDK
    ... the "presenter" can do anything on the screen and broadcast that ... > to other users of the program who can view the screen capture on their ... It doesn't really say how to use the API to ... You can use DirectShow and an instance of the WM ASF Reader filter to ...
    (microsoft.public.windowsmedia.encoder)
  • Re: MonitorLineIn of sound card
    ... What you do with the data is of no interest to Windows. ... DirectShow (higher-level wrapper above waveIn and DirectSound or native ... The mixer API is only needed to select a specific input line on a device ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: How to stream on the network encoded audio
    ... Actually another thread read the .wav file ... that is created and send chunk of bytes via network. ... The sofware is in C#, .NET 1.1 and runs on Windows 2000, Windows XP and ... If you're not using DirectShow the easiest method is to use the ACM. ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: "Uncompressing" Wav file
    ... What Chris said is ... >>>used for this conversion from encoded to raw wav file. ... >> DirectShow can be used as the decompressor or the entire player. ... >> difference is what you use for a renderer. ...
    (microsoft.public.win32.programmer.directx.audio)