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

Hi everyone,

I'm just getting into programming with UE5 + Wwise 2024.1.1.8691 and can't solve this linker error I get when trying to use GetSourcePlayPosition():

Error        CompilerResultsLog        WwisePlaybackActor.cpp.obj : error LNK2019: unresolved external symbol "enum AKRESULT __cdecl AK::SoundEngine::GetSourcePlayPosition(unsigned int,int *,bool)" (?GetSourcePlayPosition@SoundEngine@AK@@YA?AW4AKRESULT@@IPEAH_N@Z) referenced in function "public: virtual void __cdecl AWwisePlaybackActor::Tick(float)" (?Tick@AWwisePlaybackActor@@UEAAXM@Z)

Error        CompilerResultsLog        C:\Users\Leo\Documents\Unreal Projects\Visualiser_Tool\Binaries\Win64\UnrealEditor-Visualiser_Tool-2631.dll : fatal error LNK1120: 1 unresolved externals

I've added EnableGetSourcePlayPosition to AkGameplayTypes.h per this article : https://alessandrofama.com/tutorials/wwise/unreal-engine/playback-position
And I've also used the AK_EnableGetSourcePlayPosition flag. Not sure if the error is related to my implementation of the function or something with my Wwise implementation; posting events works fine.

Any help would be much appreciated, thank you.

Here's my code:

#include "Visualiser_Tool/Public/WwisePlaybackActor.h"
#include "Engine/Engine.h"
#include "Logging/LogMacros.h"
#include "AkGameplayStatics.h"

AWwisePlaybackActor::AWwisePlaybackActor()
{
    PrimaryActorTick.bCanEverTick = true;
    PlayingID = AK_INVALID_PLAYING_ID;
}

void AWwisePlaybackActor::BeginPlay()
{
    Super::BeginPlay();

    if (AssignedEvent)
    {
       FOnAkPostEventCallback nullCallback;
       const int32 Flags = AK_EnableGetSourcePlayPosition;

       PlayingID = UAkGameplayStatics::PostEvent(AssignedEvent,this,Flags,nullCallback);
    }
}

void AWwisePlaybackActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    if (PlayingID != AK_INVALID_PLAYING_ID)
    {
       AkTimeMs CurrentPositionMs = 0;
       AKRESULT Result = AK::SoundEngine::GetSourcePlayPosition(PlayingID, &CurrentPositionMs, true);
    }
}
in General Discussion by Leo V. (140 points)

1 Answer

+1 vote
 
Best answer

Hi Leo,

I wouldn't recommend following my tutorials anymore, as they target Wwise 2019 and Unreal Engine 4, and many code conventions and workflows have changed.

As mentioned in the Unreal Engine C++ Projects documentation page:

Note:
You must use the WwiseSoundEngine module's IWwiseSoundEngineAPI interface for all AK::SoundEngine calls.

In practice, this means you'd have to replace your current code in the Tick function with:

if (auto* SoundEngine = IWwiseSoundEngineAPI::Get())
{
    if (PlayingID != AK_INVALID_PLAYING_ID)
    {
        AkTimeMs CurrentPositionMs = 0;
        SoundEngine->GetSourcePlayPosition(PlayingID, &CurrentPositionMs, true);
    }
}

You'll need to include "Wwise/API/WwiseSoundEngineAPI.h" for this to work.


Trying to post the event on this actor will still fail with the warning:

LogAkAudio: Warning: Failed to post AkAudioEvent 'MyAwesomeEvent' with an actor that doesn't have an AkComponent on Root.

To avoid this issue and properly hear the event you have posted, add an Ak Component to this actor in the Details tab of the Unreal Inspector while the actor is selected.

by Alessandro Famà (4.4k points)
selected by Leo V.
Hi Alessandro,

Thanks for the informative reply, I've got it working now - hopefully this post helps anyone else who skims through documentation :)
...