Re: CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- From: "Mitch Gallant" <jensigner@xxxxxxxxxxxxxxxx>
- Date: Fri, 23 Jan 2009 17:20:41 -0400
"Bob Masta" <N0Spam@xxxxxxxxxxx> wrote in message
news:4979c031.584057@xxxxxxxxxxxxxxxxxxxxx
On Thu, 22 Jan 2009 18:13:46 -0500, "Chris P."
<msdn@xxxxxxxxxxxx> wrote:
On Thu, 22 Jan 2009 17:55:27 -0400, Mitch Gallant wrote:
Can anyone explain why there is a cpu increase that eventually is 100%
in
this windows proc. message which handles sampled buffers when ready.
Petzold should be ashamed of himself. It's the realloc. The performance
of the realloc will get worse and worse as the amount of memory requested
increases. You will also potentially lose audio samples as the time taken
increases.
3 options.
- Record to file.
- Allocated fixed amount of memory.
- Allocated fixed amount of memory and grow by large fixed increment.
The best approach here depends on what is going to
be done with the data. If you are just going to
look at it on the screen (scope, spectrum
analyzer, etc) then just use a fixed amount of
memory. Make it larger than you need for the
display, and wrap around to the start when it's
full. This is essentially a big circular buffer,
but you will be filling it by waveInAddBuffer
sized chunks.
If you want to save the continuous recording to a
file, you can do the same thing, only do the
writes in big chunks... say, half the overall
buffer size. That way you can keep on recording
and writing indefinitely with a fixed-size file.
(Well, "indefinitely" until you hit the upper
limit of a .WAV file or whatever you are using.)
I think I have enough feedback on this to proceed. Thanks to Bob and Chris.
I'm pretty sure that Daqarta would have some of the functionality I
want/need, but initially at least I would like to have some rudimentary code
that I can modify with complete control. Speaking of which, is there any
possibility to extend the code of Daqarta? (slightly off topic). Also, do
any "sound cards" support actual DC input? (most are of course audio with
lower end rolloff at ~ 10 kHz or similar). One application I'm interested
in is sampling time-based variation of DC input signals .
- Mitch
.
- Follow-Ups:
- References:
- CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- From: Mitch Gallant
- Re: CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- From: Chris P.
- Re: CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- From: Bob Masta
- CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- Prev by Date: Re: Semi Tansparent text on video window.
- Next by Date: S/PDIF stream monitor software
- Previous by thread: Re: CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- Next by thread: Re: CPU usage creep in waveIn sample during handling MM_WIM_DATA message
- Index(es):
Relevant Pages
|
Loading