title: ALSA - multithreading, and "exclusive access" to audio HW
body: <p>I have questions about the ALSA sound library.</p>
  
  <p>Let me first state that a usual reply to questions like mine is "use JACK",
  and that that anwer is not helpful, since I probably cannot use JACK.
  I am running a native linux program on an Android device (<em>not</em> NDK, but really native), and from what I gathered, JACK does not work on Android since some libc and posix stuff incompatabilities.</p>
  
  <p>The questions:</p>
  
  <p>1) can I use 2 different threads, for a) reading captured samples and b) playing back samples? All ALSA "full duplex" examples I've seen just use alternating reading from / writing to the sound card with blocking functions, which seems not to work too great, especially if your program is supposed to do a little more than that.</p>
  
  <p>2) As I understood, ALSA mixes audio played by different applications, much like the windows audio mixer. Is it possible to get exclusive access to an audio device, such that my application is guaranteed to be the only one playing back audio, with no mixing &amp; degrading of dynamic range going on?</p>