0

Hello i've trying to use wasapi to record and playback using two threads but I encountered one problem which is I don't know how to save the both streams in one buffer is there a way to do that like mixing the two buffer in one wave file without having drops for data?

Bin
  • 1
  • Please provide enough code so others can better understand or reproduce the problem. – Community Oct 21 '21 at 15:08
  • Don't use 2 threads, 1 will suffice. Call both IAudioRenderClient::GetBuffer and IAudioCaptureClient::GetBuffer in a loop to get your hands on 2 buffers at once. If you don't receive buffers of equal size (which is very likely) you can either choose to pad/drop samples on the spot or introduce a ternary buffer (and associated latency) to minimize glitching. Of cource this ternary buffer will risk underflow/overflow eventually, also. Anyway, wasapi doesn't provide full duplex out of the box so you're basically on your own in terms of stream synchronization. – Sjoerd van Kreel Nov 10 '21 at 17:29

0 Answers0