Re: callback function immediatly called with an empty buffer
- From: "Stephane" <stef_09@xxxxxxxxxxx(donotspam)>
- Date: Mon, 3 Oct 2005 03:22:02 -0700
"alanglloyd@xxxxxxx" wrote:
> 1. Stephane Sep 16, 1:15 pm show options
>
> Newsgroups: microsoft.public.win32.programmer.mmedia
> From: "Stephane" <Steph...@xxxxxxxxxxxxxxxxxxxxxxxxx> - Find messages
> by this author
> Date: Fri, 16 Sep 2005 05:15:06 -0700
> Local: Fri, Sep 16 2005 1:15 pm
> Subject: callback function immediatly called with an empty buffer
> Reply | Reply to Author | Forward | Print | Individual Message | Show
> original | Report Abuse
>
> Hi,
> I try to record a wavefile with wavein API.
> Waveinprepareheader and waveinAddbuffer work fine, with a waveheader
> data
> buffer large to hold a few seconds audio.
> Strangely, just after waveinstart, the callback function is executed,
> and
> the waveheader param does not match the initialised waveheader
> Here is a code snipset
>
>
> > mhd.dwBufferLength = m_BufferSize
> > mhd.dwFlags = 0
> > mhd.dwLoops = 0
> > mhd.dwUser = 0
> > rc = waveInPrepareHeader(m_WaveIn, mhd, Marshal.SizeOf(mhd))
>
> Have you set the pointer to the buffer into mhd.lpData(after allocating
> it - or don't you have to do that in VB).
>
> Alan Lloyd
>
>
Thank you for you answer, Alan.
Yes, I did, allocate memory and set the pointer, with code like that:
For i = 0 To NUM_BUFFERS - 1
GlobalFree(hmem(i))
hmem(i) = GlobalAlloc(&H40, m_BufferSize)
pmem(i) = GlobalLock(hmem(i))
m_hdr(i).lpData = pmem(i)
m_hdr(i).dwBufferLength = m_BufferSize
m_hdr(i).dwFlags = 0
m_hdr(i).dwLoops = 0
And when I debug the callback function, I see that all the fields of that
parameter are set to 0, except dwflags, set to 3. It is like the parameter
points to an incorrect memory area.
I realy do not know what to do with that.
Stephane
.
- Follow-Ups:
- Re: callback function immediatly called with an empty buffer
- From: alanglloyd
- Re: callback function immediatly called with an empty buffer
- From: alanglloyd
- Re: callback function immediatly called with an empty buffer
- Prev by Date: IWMHeaderInfo/IWMReader discrepancy
- Next by Date: Re: Mp3 -> Wav -> Mp3
- Previous by thread: IWMHeaderInfo/IWMReader discrepancy
- Next by thread: Re: callback function immediatly called with an empty buffer
- Index(es):
Relevant Pages
|