Re: callback function immediatly called with an empty buffer
- From: alanglloyd@xxxxxxx
- Date: 3 Oct 2005 23:23:00 -0700
> 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
{ flags for dwFlags field of WAVEHDR }
const
WHDR_DONE = $00000001; { done bit }
WHDR_PREPARED = $00000002; { set if this header has been prepared
}
WHDR_BEGINLOOP = $00000004; { loop start block }
WHDR_ENDLOOP = $00000008; { loop end block }
WHDR_INQUEUE = $00000010; { reserved for driver }
.... so your header has been prepared and is done. When you return the
header to the queue you should
set dwFlags to ...
dwFlags and not WHDR_DONE
... or whatever VB requires to do that setting.
Have you tried doing nothing in the MM_WIM_DONE handler if
dwBytesRecorded is zero. It certainly sounds strange activity to
immediately return an empty buffer as done (and my usage shows the
correct buffer length on return), but such a test would prevent
recording errors arising.
Does GlobalAlloc set the allocated memory to 0 ?
You seem to be doing everything you should. All I do (in Delph) is ...
InBuffers[i] := AllocMem(BufferSize);
InHeaders[i] := AllocMem(SizeOf(TWaveHdr));
with InHeaders[i]^ do begin
lpData := InBuffers[i];
dwBufferLength := BufferSize;
dwUser := integer(RecStrm); // for use in MMWIMData to copy
buffer
end;
{... and prepare headers}
WaveInPrepareHeader(hndWaveIn, InHeaders[i], SizeOf(TWaveHdr));
... and Delphi AllocMem zeroes the memory for me.
Alan Lloyd
.
- References:
- Re: callback function immediatly called with an empty buffer
- From: Stephane
- Re: callback function immediatly called with an empty buffer
- Prev by Date: Re: WAVEFORMATEX structure
- Next by Date: Re: callback function immediatly called with an empty buffer
- Previous by thread: Re: callback function immediatly called with an empty buffer
- Next by thread: Re: callback function immediatly called with an empty buffer
- Index(es):
Relevant Pages
|