WaveIn Problem in XP



This won't make much sense unless you have used waveIn functions to
record wave files.

I have a recording program which uses WaveIn???() to record dictation.
Since moving to XP a problem and executable which worked OK on Win 98
malfunctions by filling buffers too fast (by a factor of some 4.3).

I call waveInOpen with a GSM WaveFormatEx record to record 11025
samples/sec which should record at 2239{.45} bytes / sec. waveInOpen
returns with a value of 0 (meaning success). I desire to use 0.2 sec
buffers and set them to 455 bytes (block size is 65 bytes on GSM) and
allocate memory for the buffers and headers and waveInPrepare the
headers. All preparation functions return OK. I put the buffers in the
queue and call waveInStart.

When the buffer is filled with wave data it sends a MM_WIM_DATA message
to a mini-window for messages in my application with a pointer to the
waveheader holding the buffer reference. As part of the debugging to
find out where it goes wrong I display the count of bytes recorded by
wavein in the buffer (455 bytes - OK) and the time the message is
received (and I guess sent). This shows that a buffer is returned every
47 mSec. Which agrees with the increased rate of recording. It should
return a buffer every 203 mSecs.

I have another, much smaller program doing identical actions (it was a
development version of the main code) which works perfectly at the
correct speed. Careful comparison shows no difference in the code.

When I change the WaveFormatEx record (defining the sampling rate etc)
to 8000Hz instead of 11025Hz (with the same buffer) the buffers were
returned at the same rate - ie once every 47 mSecs.

The exe of this program works OK on other XP PCs, and exes from the
same code compiled on other XP PC work OK on them but fail with a fast
record on my PC.

Any suggestions of cause, or of further investigation would be welcome.

Alan Lloyd

.



Relevant Pages

  • Re: Mystic Playback stops problem with waveInPrepareHeader, waveInAddBuffer etc.
    ... > modern sound cards you are probably ok reusing accross AddBuffer ... > If you use a thread for wavein and another thread for waveout, ... > have a sufficiently deep record buffer pool, ... > into any performance issues when preparing/unpreparing with every use. ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Can someone explain how to correctly use Low level Digital Audio A
    ... You have to have more than one buffer and associated WaveHdr structure ... All that starts the waveIn recording. ... PtrWaveHdr: PWaveHdr; ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: callback function immediatly called with an empty buffer
    ... > I try to record a wavefile with wavein API. ... > Waveinprepareheader and waveinAddbuffer work fine, with a waveheader ... > buffer large to hold a few seconds audio. ... > Strangely, just after waveinstart, the callback function is executed, ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Sound Card read Data
    ... > I want to read realtime data from sound cards R/L channels. ... > I've found sources of an oscilloscope program using ... waveInUnprepareHeader, copy the data from the buffer, then re-prepare it. ... Using two buffers ensures that the waveIn device continues to ...
    (comp.programming)