Re: [linux-audio-dev] full-duplex

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] full-duplex
From: David Slomin (dgslomin_AT_CS.Princeton.EDU)
Date: ma loka   11 1999 - 21:53:49 EDT


On Sun, 10 Oct 1999, Rafael Flister Monteiro wrote:

> I am a graduate student from Brazil and I am starting to work with
> sound programming under Linux. I would like to know if you could help
> me. I have been having problems with full-duplex operation, I created
> two processes, the first reads 16 milliseconds of sound samples from
> de microphone and sends them to the second process using an UDP
> socket. The second process receives these samples and writes them on
> the soundcard. I opened the device for reading and writing (O_RDWR),
> set the full-duplex option and set the fragment size (0x7fff0007). But
> I am not able to read and write the amount of data that I ask. What
> are the problems involved in full-duplex operation?

As has already been suggested, ALSA stands a much better chance than
OpenSound of allowing separate processes to simultaneously open /dev/dsp,
one for reading and one for writing. However, if installing ALSA is not
an option for you (due to complexity of installation, lack of support for
your sound card, or lack of compatibility with other apps you care about),
there is a higher latency but still viable solution...

Write a little app that opens /dev/dsp for both reading and writing, then
forwards incoming and outgoing data to/from separate FIFOs (or sockets,
but FIFOs are easier to code and, more importantly, run faster). The
FIFOs can then be opened by separate processes. I've written a little
program called "rw" which does this for MIDI messages, but it could be
adapted for audio by enlarging the size of its internal buffers and
sending the proper ioctls at startup to initialize the driver (you can't
forward the ioctls blindly over the FIFOs, like you can with the actual
audio data). Just ask, and I'll send you a copy.

Div.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:27:13 EST