Open Curve opened 2 years ago
Oh hey good to see you here :)
You are totally right, the virtmic code currently is a bit hacky and could definitely could be improved a lot. I already saw the improvements to the thread behavior in your repo, but so far I haven't gotten to implement it because there was other stuff to do and the virtmic currently just works (unlike the other stuff). I adapted the virtmic code from the pre v1.0 virtmic example and back then I just couldn't get it to run in a thread, so thats why it runs in a separate process currently. I will probably just create it from scratch again, using your new examples as reference.
Also, you may as well just consider to just link the target application to Discords Input, that would eliminate the need for a virtual-mic all together
That sounds interesting, but I am not sure how I would achieve that. I don't want discord to use the application audio as the users microphone, but instead feed the audio track of the virtmic directly into the desktop capture.
I don't want discord to use the application audio as the users microphone, but instead feed the audio track of the virtmic directly into the desktop capture.
In that case scrap that idea ^^
Currently the virtual microphone is spawned as a sub-process¹, which I'd argue is not the nicest solution.
Since
v1.3
rohrkabel has made several improvements that ensure safe-usage of the library (i.e. no exceptions in other threads, no access to non-ready objects, channels for safe inter-thread communication)So you may consider to upgrade to
v1.3
/ the latest commit at the time of writing, as it includes a small change to simplify the channel receival process and make use of the channels.Which would eliminate the need for a virtual-mic sub-process and will make the code cleaner, easier to understand and easier to debug².
Also, a few other small improvement suggestions:
main_loop
, ... when ever you want to get possible targets. Consider just running one main_loop in a different thread which tracks all created nodes and communicate with it throughchannel
sstd::optional
hereerase
with a non-existant key³