audacity library for recording

I can record audio successfully using audacity tool but i want all this with a program. Is there any audacity library which i can use to get recorded data in a buffer and do further processing myself?

Currently i can get it with arecord/aplay utilities but they are giving single channel data although i am setting -channel=2. Quality of audacity tool is very good thats why i am looking for audacity library or any audacity-devel package.
Kindly suggest.

Best Regards,
Naseeb Panghal

Audacity uses PortAudio