Related with this topic, I would like to contribute with 3 pieces of code made with an educational point of view (though I don't teach audio processing and I don't consider an expert myself). These examples use libsndfile library, that is important if the source or the destination of your audio data is a wav file.

a) jcapture:
*http://wiki.joanillo.org/images/0/07/Jcapture-1.0.0.tar.gz
reads the data coming from the microphone, and saves a wav file. Shows a textual signal meter in the console. (I know the existance of jack-capture. I didn't look at jack-capture code, sure that has better performance and lots of options, I just wanted the minimal code)

b) jplay-sndfile-simple:
*http://wiki.joanillo.org/images/1/1e/Jplay-sndfile-simple-1.0.0.tar.gz
It's just a playback wav file. In the callback function there are two possibilities: copying blocks of memory; or copying sample by sample, and this permits a little signal processing (in this simple case just divide the signal by 2).
I borrowed code from sndfile-jackplay.c (sndfile-tools-1.03, Erik de Castro Lopo & Jonatan Liljedahl), where is interesting the thread implementation  (playing while reading the file) that I didn't implemented.

c) jplay-sndfile:
*http://wiki.joanillo.org/images/e/e6/Jplay-sndfile-1.0.0.tar.gz
This is more interesting and not simple like the previous. A part of playing back the file, it permits frequency shifting and frequency sweeping in a range between .5 and 2.

Hope this helps to somebody,
Joan Quintana