Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > resetting buffer on /dev/dsp

Reply
Thread Tools

resetting buffer on /dev/dsp

 
 
Andrew Collier
Guest
Posts: n/a
 
      08-20-2003
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.
 
Reply With Quote
 
 
 
 
Jan Engelhardt
Guest
Posts: n/a
 
      08-20-2003
>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.

--
- Jan Engelhardt
 
Reply With Quote
 
 
 
 
Andrew Collier
Guest
Posts: n/a
 
      08-20-2003
> >ioctl(sndinit::devdspfd, SOUND_PCM_SYNC, 0);
> Uh, looks like C++.


okay, you got me there!
 
Reply With Quote
 
Kevin Easton
Guest
Posts: n/a
 
      08-20-2003
In comp.lang.c Andrew Collier <(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
buffer creates only read-only buffer? Neal Becker Python 0 01-08-2009 01:58 AM
When using System.IO.FileStream, I write 8 bytes, then seek to the start of the file, does the 8 bytes get flushed on seek and the buffer become a readbuffer at that point instead of being a write buffer? DR ASP .Net 2 07-29-2008 09:50 AM
Regex resetting the capture buffer Mario D'Alessio Perl Misc 3 06-22-2007 02:16 PM
convert M bit buffer to N bit buffer runcyclexcski@yahoo.com C++ 2 03-26-2007 09:43 AM
How to know the buffer size and increase buffer size in c++ Raja C++ 12 06-21-2004 06:21 PM



Advertisments