resetting buffer on /dev/dsp

Discussion in 'C Programming' started by Andrew Collier, Aug 20, 2003.

  1. 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.
    Andrew Collier, Aug 20, 2003
    #1
    1. Advertising

  2. >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
    Jan Engelhardt, Aug 20, 2003
    #2
    1. Advertising

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


    okay, you got me there!
    Andrew Collier, Aug 20, 2003
    #3
  4. Andrew Collier

    Kevin Easton Guest

    In comp.lang.c Andrew Collier <> 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.
    Kevin Easton, Aug 20, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raja
    Replies:
    12
    Views:
    24,353
    John Harrison
    Jun 21, 2004
  2. kanchan
    Replies:
    1
    Views:
    813
    Karthik Kumar
    Nov 13, 2004
  3. Replies:
    2
    Views:
    592
    sergejusz
    Mar 26, 2007
  4. Neal Becker

    buffer creates only read-only buffer?

    Neal Becker, Jan 8, 2009, in forum: Python
    Replies:
    0
    Views:
    403
    Neal Becker
    Jan 8, 2009
  5. Mario D'Alessio

    Regex resetting the capture buffer

    Mario D'Alessio, Jun 21, 2007, in forum: Perl Misc
    Replies:
    3
    Views:
    252
    Mario D'Alessio
    Jun 22, 2007
Loading...

Share This Page