Convert portaudio.cpp to use smart pointers