Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes
I'm working on PS4 and during profiling it's noted that the wwise threads occupy core #0, I want to prevent this happening.

Finding documentation is sparse, to say the least and it's not documented really at all in the wwise documentation I've been able to find. So far, I've got this:

        AkPlatformInitSettings platformSettings = new AkPlatformInitSettings();
        AkSoundEngine.GetDefaultPlatformInitSettings(platformSettings);
        uint allCoresExcept0 = 0xfffffffe;
        platformSettings.threadLEngine.dwAffinityMask = allCoresExcept0;
        platformSettings.threadMonitor.dwAffinityMask = allCoresExcept0;
        platformSettings.threadOutputMgr.dwAffinityMask = allCoresExcept0;
        platformSettings.threadBankManager.dwAffinityMask = allCoresExcept0;

The whole platformSettings parameter is only read from the engine, how do I get it to be applied before initialization?
in General Discussion by Brian W. (100 points)

1 Answer

0 votes
> Finding documentation is sparse, to say the least and it's not documented really at all in the wwise documentation

The documentation is fine any further detail would only serve to teach people how thread affinity works in addition to where to specify the mask for each thread and is therefore outside the scope of the Wwise SDK documentation.

> I've been able to find. So far, I've got this:

That code looks fine and the mask is correct - although as a matter of taste you might consider ~0x1 to be clearer - what you are missing is to specify these settings in the call to AkSoundEngine.Init.

Also note that the stream manager's devices create threads. If you wish to ensure that all the Wwise created threads do not run on cpu0 specify the affinity mask here also.
by Dan M. (2.6k points)
Actually, it would have to be ~(uint)0x01 :) I picked the bitmask, just for preference right now.
"any further detail would only serve to teach people how thread affinity works". Isn't that the point of documentation?


For future reference, here is my fix.

AkWwiseInitializationSettings.cs, inside InitializeSoundEngine()

    public static bool InitializeSoundEngine()
    {
#if UNITY_EDITOR
        Instance.ActiveSettingsHash = GetHashOfActiveSettings();
        Instance.ActiveSettingsHaveChanged = true;
#endif

        AkInitializationSettings settings = ActivePlatformSettings.AkInitializationSettings;
        uint allCoresExcept0 = ~(uint)1;
        settings.platformSettings.threadLEngine.dwAffinityMask &= allCoresExcept0;
        settings.platformSettings.threadMonitor.dwAffinityMask &= allCoresExcept0;
        settings.platformSettings.threadOutputMgr.dwAffinityMask &= allCoresExcept0;
        settings.platformSettings.threadBankManager.dwAffinityMask &= allCoresExcept0;

        if (AkSoundEngine.Init(settings) != AKRESULT.AK_Success)
> Actually, it would have to be ~(uint)0x01 :)

Actually, no it wouldn't.

https://godbolt.org/z/SkRHnF
https://en.cppreference.com/w/c/language/integer_constant
Dan, when I try the statement "uint allCoresExcept0 = ~1", I get an error from the compiler saying "Constant value '-2' cannot be converted to uint".

Anyway, Problem solved. Thanks for the help.
...