New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cubeb to mozilla/cubeb@27d2a102b0b75d9e49d43bc1ea516233fb87d778 #10343
Conversation
051cef6
to
54706a0
Compare
|
Worth noting that it seems Mozilla deprecated (some parts of) the library in favor of the rust version: https://github.com/mozilla/cubeb/wiki/Backend-Support I would recommend using wil for the COM management , since it nicely solves the problem(s) and we already include it (maybe time to update that External, as well :)) Otherwise, lgtm |
54706a0
to
b799946
Compare
b799946
to
e0b57dc
Compare
e0b57dc
to
c481afc
Compare
|
Hey this actually builds now with the build server upgrade, great! |
|
nice. in addition to using WIL, what do you think about using submodule instead of copying the sources? |
|
Yeah I think we can use a submodule. Regarding WIL, I'm not quite sure how to design this as-is with WIL? I guess it would in general be better to always use a separate thread here since we don't want to randomly enable MTA mode permanently on whatever thread happens to call a Cubeb function... let's see... |
|
hrm, starting a thread to handle a single function call seems a bit smelly :p but yea, maybe it doesn't fit. |
|
We could have a cubeb worker thread that gets function calls to execute via a queue, if that's better. |
574f91f
to
7c8dd95
Compare
|
7c8dd95 is a variant using a worker thread. It's a bit ridiculous, but maybe actually the better option? Avoids the CoInitialize on the main thread and never opens any temporary secondary threads. |
7c8dd95
to
728c9ec
Compare
728c9ec
to
e8942f2
Compare
e8942f2
to
82a51ed
Compare
82a51ed
to
67e8b50
Compare
67e8b50
to
da74bff
Compare
|
i was looking at c++/winrt stuff recently and noticed it has functionality to forward coroutines/callbacks onto a threadpool (for cross-apartment invocations). I wouldn't be surprised if WIL has a similar thing (or maybe it's better to just use the code in winrt header, anyway - it's |
…ule. CMakeLists.txt has been extracted and modified a bit to work with Dolphin's typical build settings.
…sed on dolphin-emu#8920 (comment) Co-authored-by: Michael M <mchtly@gmail.com>
…ialize state of whatever thread happens to call a Cubeb function.
da74bff
to
49252a0
Compare
|
I'll be honest, I'm not sure how either WIL or WinRT help me here. If you have an idea how to do this better please go ahead, because this is the best I can come up with. |
|
I’m not going to get to that and the pr has been around forever so if you think it’s good go for it |
|
Well, don't mind me then... |
|
Depending on how the deprecation goes we could presumably use the C++ bindings to cubeb-rs, btw. |
|
Happy to see this got merged. Thanks for quoting your references. I have resumed work on my other audio PRs, so this should make things a little simpler. |
|
@AdmiralCurtiss |
I've done it here: #11466 |
Our current revision is from October 2017, so it's reasonable to update it. This fixes a long-standing issue where Windows would not remember Dolphin's volume as set in the Volume Mixer between sessions.
What complicates this is that cubeb at some point changed so it requires the user to initialize COM on Windows rather than doing it by itself, and also (at least via documentation, although it seems in practice this isn't a hard rule -- still, one should abide by the documentation...) requires that all calls to the cubeb API be only done on threads where COM has been initialized in MTA (
CoInitializeEx(nullptr, COINIT_MULTITHREADED)) mode.I've done this by adding a
RunInCubebContext()function that tries to initialize in MTA mode, and if that fails creates a temporary thread to do it there instead. This is inspired by a long comment thread over in #8920, the last attempt at this, though with my own spin on it. That attempt never got merged, but maybe this one will be good enough?Some extra notes:
CMakeLists.txt, which was slightly modified to work with our CMake build scripts..csprojfiles.