JACK is exactly designed for this use case.  The documentation is bit hard to get from a
beginner's perspective, but there are of sample apps that you can look at in the JACK
distribution.
Basically all audio processing in Linux is done on a buffer-by-buffer basis with a
several-buffer queue.  You need to do nothing to get that, it's just the way the
underlying system works.
Thanks,
Bill Gribble
  On Jun 20, 2015, at 13:21, mehrdad ghassempoory
<ghassempoory(a)gmail.com> wrote:
 I want to write a small audio signal processing application.
 What I want to do is to successive blocks of N samples,
 process them and display the results in real time.
 The processing takes a lot more time than sampling interval,
 however it can be comfortably done in the time it takes to
 collect N samples. That is why I like to have an arrangement
 where I can queue two or three buffers for audio input and
 process the first full buffer in plenty of time while the audio
 software is filling in the next buffer.  As soon as I finish
 processing  the buffer, I could queue it to be filled again.
 I would also like use callbacks as much as possible.
 I have tried PORTAUDIO and it does not seem to do multi-buffering
 I have tried JACK briefly but it suffers from lack of documentation and
 as far as I could gather it had no facilities for this kind of thing.
 I know I could write a higher level interface for PORTAUDIO
 to simulate multi-buffering but it means I have to copy input buffer into
 intermediate buffers to simulate multi-buffering and apart from
 synchronisation problems that I may encounter, it is a solution
 that appears very inelegant to me.
 Is there anything out there which can do multi-buffer audio I/O ?
 Any pointers to web pages, advice or admonition is very welcome!
 _______________________________________________
 Linux-audio-user mailing list
 Linux-audio-user(a)lists.linuxaudio.org
 
http://lists.linuxaudio.org/listinfo/linux-audio-user