resetting buffer on /dev/dsp

A

Andrew Collier

hello,

i am maintaining a system for acquiring very low frequency radio
waves. we have a receiver hooked up to the sound card. this system is
presently running at the south african base in antarctica. i have the
following question: is it possible to reset the kernel input buffer on
/dev/dsp? the reason i am concerned about this is that accurate timing
is critical for our data. presently the system gets a time stamp and
then starts reading from /dev/dsp. however, there is data present in
the buffer which was read from the sound card at some time prior to
getting the time stamp and this introduces a lag between the nominal
sample time and the actual sample time.

what i failed to mention was that the code is written in c for a linux
platform. i have tried both of:

ioctl(sndinit::devdspfd, SOUND_PCM_SYNC, 0);

and

ioctl(sndinit::devdspfd, SOUND_PCM_RESET, 0);

but neither has the desired effect. this is probably due to a large
dose of ignorance on my part!

what i am basically wanting is a way to make the kernel restart
filling its internal buffer from the beginning (_discarding_ any data
present in the buffer at that time).

any ideas?

best regards,
andrew collier.
 
J

Jan Engelhardt

hello,
i am maintaining a system for acquiring very low frequency radio ....

what i failed to mention was that the code is written in c for a linux
platform. i have tried both of:

ioctl(sndinit::devdspfd, SOUND_PCM_SYNC, 0);
Uh, looks like C++.
and
ioctl(sndinit::devdspfd, SOUND_PCM_RESET, 0);

Those ioctl()s may not be implemented for your soundcard. Try checking their
return status, or, see what they do in the kernel sources.
SOUND_PCM_RESET might only reset the DAC/ADC controller, leaving the kernel
buffers untouched.
what i am basically wanting is a way to make the kernel restart
filling its internal buffer from the beginning (_discarding_ any data
present in the buffer at that time).
any ideas?

If there is no worldwide available solution, you might try modifying the linux
kernel a bit to suit your needs.
 
K

Kevin Easton

In comp.lang.c Andrew Collier said:
hello,

i am maintaining a system for acquiring very low frequency radio
waves. we have a receiver hooked up to the sound card. this system is
presently running at the south african base in antarctica. i have the
following question: is it possible to reset the kernel input buffer on
/dev/dsp? the reason i am concerned about this is that accurate timing
is critical for our data. presently the system gets a time stamp and
then starts reading from /dev/dsp. however, there is data present in
the buffer which was read from the sound card at some time prior to
getting the time stamp and this introduces a lag between the nominal
sample time and the actual sample time.

You might want to try asking in comp.os.linux.development.system and/or
comp.os.linux.development.apps.

- Kevin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top