Re: [linux-audio-dev] Re: minimum tick time

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

Subject: Re: [linux-audio-dev] Re: minimum tick time
From: Paul Davis (pbd_AT_Op.Net)
Date: Tue Nov 06 2001 - 21:46:41 EET


>Okay. In that case I am a bit confused of what approach to take
>to write a application with low latency and GUI interaction.
>If I use alsa in non-block mode, my GUI (and everything else)

don't use non-block mode. use poll(2).

>won't get any CPU. How to avoid that? I think I'd prefer to
>have 3 threads, 1 alsa IO, 1 processing, and 1 GUI. What would

well, thats about right if "processing" includes "write/read to/from disk".

>be the best way to syncronize these threads? pthread_cond_wait?

you don't synchronize the audio thread (you are calling it "alsa i/o")
with anything except the ALSA device. all data/buffers must be assumed
to be ready and waiting. if you allow the audio thread to block on the
GUI, there is no way of knowing how long it could wait. the audio
thread needs to be free-running other than waiting for the PCM device
to be ready with either space, data or both.

your dsp processing code needs to be in the audio thread, otherwise
there is no point using low latency. if you precompute data in a
"processing thread" and then deliver it later, any change to the
control values (e.g. via the GUI) don't show up till all the
precomputed material is handled.

--p


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

This archive was generated by hypermail 2b28 : Tue Nov 06 2001 - 21:42:17 EET