Record audio while playing in audio plugin and reproduce it in background after recording

Maybe the example I posted can also help you, it plays and record simultaneously as needed:
Audio plugin host with multi file audio player and recorder