Check out the ALSA API:

http://www.alsa-project.org/alsa-doc...lib/index.html