Re: Calling waveOut functions from Visual C++ 2005?
- From: "Dave" <noone@xxxxxxxxxxx>
- Date: Mon, 15 May 2006 20:44:13 -0000
you do have to be very careful with who is calling which of those functions.
there are bad things that happen for instance if your callback function
tries to do a reset or to send a new header or some of the other functions.
you may want to cut down the code and post some of it here... and maybe also
ask on a .net developer group, there may be some quirks with .net using mm
functions that way.
"Chris P. [MVP]" <msdn@xxxxxxxxxxxx> wrote in message
news:174a6qaq5naln.1ombbhqt36vqb.dlg@xxxxxxxxxxxxx
On Mon, 15 May 2006 05:21:02 -0700, David Harrison wrote:
I have a Visual C++ application (2005 Express Edition). I want to call
the
waveform audio interface functions such as waveOutOpen,
waveOutPrepareHeader
etc. to play, pause and otherwise manipulate a block of audio wave
samples.
I also have the Platform SDK installed, so I have tried two methods:
1) Calling the functions directly (linking with WinMM.lib and including
the
mmreg.h etc include files).
2) Using the .NET platfom Invoke, using the
System::Runtime::Interopservices
DLLImport attribute to declare a .NET wrapper around the native C
functions.
Either way works, up to a point. The problem is that when the wave file
stops playing, either by reaching the end, or when I call the
waveOutReset
function, the application aborts. When using the debugger, I simply get
a
message that says error in kernel32.dll, so I cannot find the problem.
I am allocating memory for the wave samples using the C native malloc
function. I am not using GlobalAlloc or any of the other fancy memory
allocation functions.
Should I Be?
Does anyone have any idea why a relatively simple set of functions are
not
working properly in Visual C++ 2005?
It sounds pretty standard, nothing is jumping out at me. Memory alloced
by
malloc is fine, the prepare header function locks the buffer in memory for
access by the driver (on Win2K/XP I think this is a NOOP).
Usually when apps just abort like this it's due to bad pointers being
passed to kernel functions or an attempt to move the instruction to 0.
--
http://www.chrisnet.net/code.htm
http://www.avdevforum.com/AV
.
- Follow-Ups:
- Re: Calling waveOut functions from Visual C++ 2005?
- From: David Harrison
- Re: Calling waveOut functions from Visual C++ 2005?
- References:
- Re: Calling waveOut functions from Visual C++ 2005?
- From: Chris P. [MVP]
- Re: Calling waveOut functions from Visual C++ 2005?
- Prev by Date: Re: WaveIn on a pocketpc: INVALPARAM after 5 seconds?
- Next by Date: Re: Calling waveOut functions from Visual C++ 2005?
- Previous by thread: Re: Calling waveOut functions from Visual C++ 2005?
- Next by thread: Re: Calling waveOut functions from Visual C++ 2005?
- Index(es):
Relevant Pages
|