Fix PortAudio to allow recording and playback with the same library using a base class the implements appropriate locking