コミュニティQ&A

Audiokineticのコミュニティ主導のQ&Aフォーラムへようこそ。ここはWwiseとStrataのユーザのみなさまがお互いに協力し合う場です。弊社チームによる直接のサポートをご希望の場合はサポートチケットページをご利用ください。バグを報告するには、Audiokinetic LauncherのBug Reportオプションをご利用ください。(Q&AフォーラムではBug Reportを受け付けておりませんのでご注意ください。専用のBug Reportシステムをご利用いただくことで、バグの報告が適切な担当部門に届き、修正される可能性が高まります。)

最適な回答を迅速に得られるよう、ご質問を投稿される際は以下のヒントをご参考ください。

  • 具体的に示す:何を達成したいのか、またはどんな問題に直面しているのかを具体的に示してください。
  • 重要な詳細情報を含める:Wwiseとゲームエンジンのバージョンやご利用のOSなど詳細情報を記載してください。
  • 試したことを説明する:すでに試してみたトラブルシューティングの手順を教えてください。
  • 事実に焦点を当てる:問題の技術的な事実を記載してください。問題に焦点を当てることで、ほかのユーザのみなさまが解決策を迅速に見つけやすくなります。

0 支持

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);
    }
}
Leo V. (140 ポイント) General Discussion

回答 1

+1 支持
 
ベストアンサー

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.

Alessandro Famà (Audiokinetic) (6.8k ポイント)
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 :)
...