[linux-audio-dev] I need help! I can't handle the problem about full-duplex (playback & record) programming

Pascal Haakmat a.haakmat at chello.nl
Sat Dec 14 21:21:01 UTC 2002


13/12/02 15:46, leo zhu wrote:

> Hi, guys,
> 
> I am working on a project in which I need to implement
> palyback and recording on the same sound card and in
> the same time. 
> 
> I open the soundcard with RDWR mode and used 'select'
> to wait for sound data on card and read it. After
> that, I receive audio data from socket and write this
> data into buffer on card. for now. I tested it and i
> found if just one way, ie. just read or write, it
> works fine, the quality of sound is fine. but if two
> way, ie. play&record, the sound is horrible and the
> weird is that I always get better sound quality from
> playback that what i got from recording. (I heard the
> audio from two ends). by the way, I used
> SNDCTL_DSP_TRIGGER to syncronyse them.
> 
> can this method implement full-duplex functions ? if
> not, what should I do? thanks in advance

Yes, it's possible in principle, and it can work. Although some
cards/drivers do it better than others... On Linux I believe the
easiest way is to open the audio device twice: once for reading and
once for writing. There might be other portability problems with that
method as well. 
I've never gotten SNDCTL_DSP_TRIGGER to work as
expected, but that may just have been impatience.



More information about the Linux-audio-dev mailing list