mozilla / cubeb-pulse-rs

ISC License
15 stars 17 forks source link

Loopback mode implementation #84

Open nikp123 opened 1 year ago

nikp123 commented 1 year ago

While not an officially advertised feature in the PulseAudio API, all PulseAudio "sink"-s have a "monitor mode" where in any of the audio output devices there's a "loopback" input device which replicates all audio for said output. This allows us to effectively achieve recording any audio output as input within cubeb.

This commit is a continuation of said Draft shown in https://github.com/mozilla/cubeb/pull/691 but this time written in Rust. (yes it took me half a year but we're here) ps: rust is hard

As I'm quite inexperienced when it comes to Rust (especially so when it's demanding code like FFI) comments on the code or any improvements that may be done are greatly appreciated.

Thanks.

padenot commented 1 year ago

Tagging @ChunMinChang for initial review if he has some cycles. Thanks for the contribution, I'll run CI now.

ChunMinChang commented 1 year ago

I am on PTO right now. I can take a look next Monday.

nikp123 commented 1 year ago

Forced-pushed the "cargo fmt"-ed version as I was not aware of the tool. I would like a CI re-run.

nikp123 commented 1 year ago

I've done some changed to add error checking, however handling of selecting what sinks you want to use is still not implemented (because of the complexities involved).

nikp123 commented 1 year ago

Apologies if any of the mistakes in advance seem trivial.