PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 296 forks source link

wasapi: Fixed Pa_ReadStream()/Pa_WriteStream() for 1-channel (Mono) I/O #948

Open dmitrykos opened 1 month ago

dmitrykos commented 1 month ago

The problem is covered by #945 issue. Modified examples can be used to test 1-channel input/output stream, including the loopback.

After the acceptance of this PR I will further address #946 issue in another PR and refactor mono-stereo mixer's implementation names.

Closes #945

arkadijs commented 1 month ago

It's better but not completely free of cracking for some? devices.

Here are two examples: http://0x0.st/Xp1-.wav - PortAudio master http://0x0.st/Xp1o.wav - this PR

Each file has 4 segments of ~3sec:

  1. Headphone callback
  2. Headphones read (short silence while msedge.exe switches to another output)
  3. Speakers callback
  4. Speakers read

While (2) is still obviously problematic it's much better now. Test program here.

dmitrykos commented 1 month ago

While (2) is still obviously problematic it's much better now.

I found the problematic place, we were writing some trash/silence behind buffer when saving trailing frames into the circular buffer. Now all is fine. I used your test bench in my tests.

Would you please check from your side.

arkadijs commented 1 month ago

Tested, it works, no problems. 🎉

dmitrykos commented 1 month ago

That's great! I hope @RossBencina and @philburk will review this PR soon.

dmitrykos commented 1 month ago

@RossBencina I updated implementation based on your review notes, please check.

dmitrykos commented 2 weeks ago

@philburk I made all changes we discussed, would you please check and approve if all is fine now.

dmitrykos commented 1 week ago

Hi Dmitry, I'm not going to hold up the merge for my latest request, more of a nice to have.

Ross, I made proposed change, thank you for pointing to it.