[PATCH 1/2] xaudio2: Fix support for FAudio 19.06 and newer

Ethan Lee elee at codeweavers.com
Thu May 2 22:34:17 CDT 2019


It looks like both __attribute__((deprecated)) and __declspec(deprecated) both support messages, so I can do that as well. I’d still throw in a big fat error message in at runtime just in case somebody attempts to update FAudio by itself.

The original CommitChanges was a stub since we didn’t support OperationSet at all; for all functions we treated all calls as if they submitted `COMMIT_NOW`, which runs the command immediately instead of queueing it for later. This mostly works, but has the aforementioned timing issues and doesn’t allow for proper batching (for example, playing two sources at once). Microsoft’s overview explains the feature pretty well:

https://docs.microsoft.com/en-us/windows/desktop/xaudio2/xaudio2-operation-sets <https://docs.microsoft.com/en-us/windows/desktop/xaudio2/xaudio2-operation-sets>

So by adding support for operation sets we’re not just changing behavior for one function, we’re changing behavior for a dozen functions, where any one function not falling in line can topple the whole thing over. This is also how we found the issue in the first place; because it was a stub and nobody was using operation sets, nobody noticed the bad signature.

-Ethan

> On May 2, 2019, at 11:13 PM, Chris Robinson <chris.kcat at gmail.com> wrote:
> 
> On 5/2/19 6:45 PM, Ethan Lee wrote:
>> I’m really glad you butted in because this is actually a very good point (sorry I didn’t see it earlier, I only get wine-devel messages as digests). So maybe what I can do is add something totally different like `FAudio_CommitOperationSet` and in the documentation deliberately put the phrase “CommitChanges” in so users wondering where that function went can go find it quickly. I still think my bogus CommitChanges needs to be scrapped somehow but if we can agree that any use of CommitChanges is a bug (yes, even retroactively), maybe I can just make it do something extremely unpleasant that still allows the program to run, but make it so anyone using it can see something is wrong (stderr messages maybe?).
> 
> With GCC/Clang, you can mark a function with __attribute__((deprecated)) in the header, which causes a compile-time warning if code tries to use it. I think it's also possible to supply a message, to give a specific reason and/or alternative. The code will still compile and thus maintain API compatibility, but the developer will know it's an outdated function it should now avoid using. The library can also still export some version of the function, maintaining ABI compatibility too.
> 
> As for what to do regarding the old function's behavior, it ultimately depends. I'm not very familiar with XAudio, so I don't know exactly what the OperationSet parameter is for. Why wasn't it needed before, and why is it needed now? What did the function do before without it (I assume it worked in some capacity)?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190502/ea16ebfb/attachment.html>


More information about the wine-devel mailing list