在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

0 投票
After finally sorting out my projects with my previous linker errors I am getting a new "unresolved external symbol" linker error when trying to use GetIDFromString function in AkSoundEngine.h.  Could anyone help with solving this please?  I am working in a C++ project and I have the integration working fine when using blueprints but seem to still have some troubles in a C++ project.

 

Thanks,

 

Jared
分类:General Discussion | 用户: Jared M. (220 分)

1个回答

+1 投票
 
已采纳
If this code is in a seperate module (that has its own *.build.cs script), you should add the dependency to AkAudio there as well.

Where are you trying to add this code?
用户: Benoit S. (Audiokinetic) (16.0k 分)
采纳于 用户:Jared M.
I am trying to add it to my C++ Game Project.  So for example my project is called MyProject.  In MyProject.build.cs I have the following:

        public MyProject(TargetInfo Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        PrivateDependencyModuleNames.AddRange(new string[] {  });

                if (UEBuildConfiguration.bCompileAudiokinetic == true)
                {
                    PublicDependencyModuleNames.Add("AkAudio");
                }
        }

Do I need to do more than that?  Inside any of the cpp files in my Game project, if I try to do something like AK:SoundEngine::GetIDFromString("String");  I get the unresolved symbol linker error.

Thanks
That is because your game isn't linking against the Wwise SDK libraries; the AkAudio module (found in the engine) is.

We have wrapped all Wwise SDK functionality in the FAkAudioDevice. Should you want to add some functionality to it, feel free to do so.

For example, you could add GetIDFromString to the FAkAudioDevice (found in UE4\Engine\Source\Runtime\AkAudio\Private\AkAudioDevice.cpp), and then, from your game code, add this:

#include "AkAudioDevice.h"

[...]

FAkAudioDevice* AudioDevice = FAkAudioDevice::Get();
if (AudioDevice)
{
    uint32 WwiseID = AudioDevice->GetIDFromString("MyString");
}

In other words, the FAkAudioDevice is the UE4 wrapper to the AK::SoundEngine workspace. Use this within your game.
Ok great.  The thought had crossed my mind to do that, since I noticed that GetIDFromString is being used in the engine source for AkReverbVolumes but I wasn't sure if that was the "right" way to do it.  Still need to the way UE4 builds its projects and adds in modules and libraries.  Thanks!
...