ALSA: blocking, nonblocking, libjack, or threads?
|Posted on: 2011-02-11 11:44:14 |
|IP: Logged |
Well we actually started off using some blocking code just for tests.|
Then moved to nonblocking around the second or third commit of the code IIRC.
Third party libraries are all good and well I guess, but you really don't need them. I wouldn't say it's simple to code for ALSA without external libs but it is doable. IMO the bigger problem isn't so much ALSA, but making sure your audio streams (if you are using streams) stitch up nicely and are in the correct format.
We were using nonblocking ALSA for quite a while because the code was there and functional, and I remember it was somewhat tedious to keep refilling the buffers (which were round robin at the time) on every tick while keeping track of all the samples and all. But it was an amazing feat really and good for morale.
Nowadays we use threaded multichannel soundsystems with low channel process priorities, structurally very similar across the different supported platforms. The channels have queues which get filled up by the main thread (or other threads, whatever). It's state of the art and we're all very proud of course, but still I'm a bit sentimental about those early days with nonblocking ALSA. Somehow it seemed more fulfilling at the time.