Hi,
I want to capture a signal from the sound card (via microphone or line
input) using the DirectX.Sound.CaptureBuffer class. One of the
properties that can be setup prior to capturing is specifying that the
buffer is continous. This means that once the buffer is filled with
data, it wraps around and continues filling the buffer.
Where I see a potential problem has to do with the sampling speed of
the sound card against the speed of the computer.
After being informed that the buffer has now been filled, I only have
so much time to perform the Read method before the buffer begins to
fillup from the start again. If I fail to read in all the bytes from
the buffer before the new samples are read in, I can only assume that
the data being read using the Read method will eventually be overrun by
the process that fills the buffer and will eventually corrupt the older
data I need to read.
It isn't clear to me that this is how the DirectX buffer system really
works. What isn't clear is that when the Read method executes, does it
execute in parallel to the process that DirectX uses to fill the
buffer? If so and suppose the computer is fast enough, would it be safe
to say that the Read process can stay ahead of the DirectX process used
to fill the buffer?
Is there any safe way to prevent the DirectX buffer from being
overwritten?
Ideally I would have thought that internally, DirectX would manage
multiple buffers that are transparent to my calling application. Once
it fills a buffer, it would create a new buffer. My application could
then be running on a slower PC but that would not matter since no
buffer would be overwritten and eventually my application will get all
the data. As far as my application is concerned, it would only see one
buffer while in fact there could be multiple internal buffers.
Thanks for any info,
Johann Blake