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've managed to change audio output using wwise in unity, but am now getting a lot of errors:

code:
https://imgur.com/ezIEuxE

    private void OutputDropdownValueChanged(OutputRef output) {
        // this is the correct device name
        string audioDevice = output.name;
        uint audioOutId = AkSoundEngine.GetDeviceIDFromName(audioDevice);
        
        if (AkBasePathGetter.GetPlatformName() == "Windows") {
            AkWindowsSettings akWindowsSettings = (AkWindowsSettings)AkWwiseInitializationSettings.ActivePlatformSettings;
            if (akWindowsSettings) {
                Debug.Log($"audioDevice={audioDevice},audioOutId={audioOutId}, m_DeviceID=" +
                    $"{akWindowsSettings.UserSettings.m_MainOutputSettings.m_DeviceID}");
                akWindowsSettings.UserSettings.m_MainOutputSettings.m_DeviceID = audioOutId;                
            }
        } else {
            Debug.Log($"audioDevice={audioDevice},audioOutId={audioOutId}, m_DeviceID=" +
                $"{AkWwiseInitializationSettings.ActivePlatformSettings.AkInitializationSettings.initSettings.settingsMainOutput.idDevice}");
        }
        AkInitializationSettings akInitializationSettings = AkWwiseInitializationSettings.ActivePlatformSettings.AkInitializationSettings;
        akInitializationSettings.initSettings.settingsMainOutput.idDevice = audioOutId;

        // so far so good

        /*
        var cam = Camera.main;
        AkGameObj akGameObj = cam.GetComponent<AkGameObj>();
        AkRoomAwareObject akRoomAwareObject = cam.GetComponent<AkRoomAwareObject>();
        AkRoomAwareManager.UnregisterRoomAwareObject(akRoomAwareObject);
        AkSoundEngine.UnregisterGameObj(akGameObj.gameObject);
        akGameObj.enabled = false;
        akRoomAwareObject.enabled = false;
        cam.GetComponent<AkAudioListener>().enabled = false;
        cam.GetComponent<AkSpatialAudioListener>().enabled = false;
        */

        if (AkSoundEngine.IsInitialized()) {
            Debug.Log("terminating AkSoundEngine so we could re-init it");
            AkSoundEngine.Term();
            // works fine ^
        }
        var success = AkWwiseInitializationSettings.InitializeSoundEngine();
        Debug.Log($"InitializeSoundEngine success={success}");
        // also works fine (returns success) but i still get the errors even when the section above is uncommented :(

    }


errors:
https://imgur.com/h7mQx5x

Wwise: Unknown game object ID. Make sure the game object is registered before using it and do not use it once it was unregistered.: 2 (GameObject: Avatar: ido (UnityEngine.GameObject)) (Instance ID: 18446744073709548102)

The above happens even if i unregister/disable all AkGameObjects as in the commented out lines. Is there something else I need to do to un- & re-register everything after outout device change?
in General Discussion by Ido Y. (100 points)
edited by Ido Y.

Please sign-in or register to answer this question.

...