Skip to content
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

Implement FAudioDebugConfiguration #59

Open
flibitijibibo opened this issue Nov 11, 2018 · 10 comments

Comments

Projects
None yet
3 participants
@flibitijibibo
Copy link
Member

commented Nov 11, 2018

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:

  • TraceMask XAUDIO2_LOG_*
    • ERRORS
    • WARNINGS
    • INFO
    • DETAIL
    • API_CALLS
    • FUNC_CALLS
    • TIMING
    • LOCKS
    • MEMORY
    • STREAMING
  • BreakMask XAUDIO2_LOG_*
    • ERRORS
    • WARNINGS
  • LogThreadID
  • LogFileline
  • LogFunctionName
  • LogTiming
@aeikum

This comment has been minimized.

Copy link
Contributor

commented Nov 13, 2018

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?

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2018

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->audio for most voice functions).

@aeikum

This comment has been minimized.

Copy link
Contributor

commented Nov 13, 2018

The walking itself is annoying, but I was thinking of the internal resampler functions, for example.

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2018

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...)

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2018

SetDebugConfiguration now has an implementation, it just needs to be used now:

#64

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Nov 30, 2018

Wrote a HUGE pile of code that allows writing debug traces with quick lines like this:

void FAudioPretendVoice_DoStuff(FAudioVoice *voice)
{
    LOG_API_ENTER(voice->audio);
    /* Stuff */
    LOG_API_EXIT(voice->audio);
}

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!

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Dec 4, 2018

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Dec 7, 2018

A couple things that may be of interest to Proton builds:

LOG_ASSERTIONS
FORCE_ENABLE_DEBUGCONFIGURATION

@NeroBurner

This comment has been minimized.

Copy link
Contributor

commented Mar 31, 2019

How can I let the log messages be written to a file instead of pop up windows?

@flibitijibibo

This comment has been minimized.

Copy link
Member Author

commented Mar 31, 2019

You can either build with the LOG_ASSERTIONS CMake option or set the SDL_ASSERT environment variable to “always_ignore”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.