[linux-audio-dev] Re: Fullduplex audio client/server implementation

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

Subject: [linux-audio-dev] Re: Fullduplex audio client/server implementation
From: David Olofson (audiality_AT_swipnet.se)
Date: ma syys   27 1999 - 16:15:13 EDT


On Mon, 27 Sep 1999, Benno Senoner wrote:
> SERVER:
> -------
> while(1)
> {
> read() from /dev/dsp to a shared mem input buffer
> for(i=0;i<NUM_CLIENTS;i++)
> {
> if(client[i]->shmem.ready) // when client is ready it sets the ready flag
> in the shmem buffer
> {
> read audiodata from client i via shmem
> mix audiodata ( client[i].shmem.oubuf ) to output buffer
> }
> }
> write() output buffer to /dev/dsp
> for(i=0;i<NUM_CLIENTS;i++)
> {
> client[i]->shmem.ready=0;
> wakeup client i (through a semaphore or message)
> }
> }
> -----
>
> CLIENT:
> ----
> clear client's audio output buffer
> shmem.ready=1;
> wait for wakeup from server ( through msgrcv() or a semaphore)
> while(1)
> {
> do DSP computations using as input buffer the server's shared audio input
> buffer
> write results to shmem.outbuf
> shmem.ready=1;
> wait for wakeup from server
> }
> ------

Looks nice to me, unless I've missed something... :-)

However, how about extending shmem.ready to a queue system? That is, you set up
a couple of buffers in shared memory, and instead of telling the engine that
you have one ready for output, you tell the egine which buffer is the last one
ready for playback.

In order to be useful, this scheme should allow that the application takes
back buffers that aren't already in the process of being mixed, so that you can
mix ahead, and then change your mind and add some extra sounds to your buffers
if something "unexpected" happens.

Target: Games sound engines and soft synths running under non-RT scheduling.

//David

 ·A·U·D·I·A·L·I·T·Y· P r o f e s s i o n a l L i n u x A u d i o
- - ------------------------------------------------------------- - -
    ·Rock Solid David Olofson:
    ·Low Latency www.angelfire.com/or/audiality ·Audio Hacker
    ·Plug-Ins audiality_AT_swipnet.se ·Linux Advocate
    ·Open Source ·Singer/Composer


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:12 EST