Which part of Audacity's source code that handle audio recording?

I am making simple c++ program that can record audio from laptop microphone and maybe other USB microphone to circular double array buffer. Because I have very limited time, I try to duplicate Audacity source rather than learning entire new sound library manual(Gstreamer, ALSA, jackaudio, etc). When I look at Audacity source code on Github I get overwhelmed and give up looking for line that captures microphone audio, can somebody help me point where is it? I am using Ubuntu MATE 16.04

Audacity uses the PortAudio library to capture audio: http://www.portaudio.com/
Audacity has to do a lot of complex stuff when capturing audio, because of:

  • cross-platform support
  • simultaneous updating of the project XML data
  • must support full duplex
  • multi-threaded to allow simultaneous writing to disk, updating of the waveform, and remain responsive to the GUI
  • simultaneous capture of peak and rms for metering and the XML data
  • on the fly resampling when required
  • on the fly mixing of playback tracks during recording
  • synchronization with Note tracks and MIDI playback

It’s likely to be very much easier to use an appropriate library (such as PortAudio) directly, rather than deriving from Audacity’s code.

Depending on your licensing requirements, it may be worth considering Juce (https://juce.com/)