Implement FAudioDebugConfiguration #59
Labels
No labels
Bug
Extensions
New Feature
Not our bug - SDL2
Not our bug - WMA
Utilities
Wine
X3DAudio Accuracy
XACT Accuracy
XAudio2 Accuracy
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-FNA-XNA/FAudio#59
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From MSDN: https://docs.microsoft.com/en-us/windows/desktop/api/xaudio2/ns-xaudio2-xaudio2_debug_configuration
In addition to filling in one more XAudio2 feature, this is a legitimately useful for general FAudio debugging without having to step through a whole lot. It can be extremely verbose, however, so this should only be enabled for non-release builds (i.e.
!_DEBUG && !DEBUG && (GCC && !OPTIMIZED)). Additionally, I would like to add the ability to enable features with environment variables, not just SetDebugConfiguration. This is useful for projects like Wine that won't have access to these entry points without added hackery. Each flag/bool should get a variable in some way.As for the implementation, this can be mapped to something like SDL_Log, though I don't know how complicated we'll need to get. I'm hoping we can make all these log types macros that are blanked in release builds, but that's totally speculation without having actually tried to write this at all.
It's a big ol checklist:
Using SetDebugConfiguration requires having the FAudio pointer available any place we want to add logging. Would you be OK if we have a global FAudioDebugConfiguration struct which just affects all FAudio instances instead of just the one that SetDebugConfiguration is called on?
I'd be okay with that, but which functions don't have the FAudio instance? I think every function has access, though it requires a bunch of walking to get to it (i.e.
voice->audiofor most voice functions).The walking itself is annoying, but I was thinking of the internal resampler functions, for example.
Ah, right - we may have to fudge that a bit by dumping the parameters as well as the function pointer handle before calling, without actually printing within the function. (Or maybe we can print the function pointer when we assign it, not sure...)
SetDebugConfiguration now has an implementation, it just needs to be used now:
https://github.com/FNA-XNA/FAudio/pull/64
Wrote a HUGE pile of code that allows writing debug traces with quick lines like this:
It should now be pretty easy to write up most of the essentials and all the DebugConfiguration stuff should Just Work with each config combination. It even supports environment variables for each TraceMask flag and LogX bools!
Logs, logs everywhere
A couple things that may be of interest to Proton builds:
LOG_ASSERTIONS
FORCE_ENABLE_DEBUGCONFIGURATION
How can I let the log messages be written to a file instead of pop up windows?
You can either build with the LOG_ASSERTIONS CMake option or set the SDL_ASSERT environment variable to “always_ignore”.