コミュニティQ&A

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

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

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

+1 支持
I always get AK_NotInitialized when call GetSourcePlayPosition after upgrading to Wwise 2022.1.3.

Is it a known issue? Thanks.
Edward C. (140 ポイント) General Discussion
Edward C. 編集

回答 1

0 支持

Not work in 2022.1.3-2022.1.6
I guess it is caused by the inconsistency of SoundEngine。AK::SoundEngine is not instanced, So,return AK_NotInitialized.
But, can do as this:

//used by Cpp/Blueprint

int32 UAkGameplayStatics::GetSourcePlayPosition(UAkAudioEvent* AkEvent, int32 PlayingID)
{
    if (AkEvent) {
        return AkEvent->GetSourcePlayPosition(PlayingID);
    }
    return -1;
}

//expand UAkAudioEvent

int32 UAkAudioEvent::GetSourcePlayPosition(int32 PlayingID)
{
    SCOPED_AKAUDIO_EVENT_2(TEXT("UAkAudioEvent::PostEvent"));
    auto* AudioDevice = FAkAudioDevice::Get();
    if (UNLIKELY(!AudioDevice))
    {
        UE_LOG(LogAkAudio, Verbose, TEXT("Failed to post AkAudioEvent '%s' without an Audio Device."), *GetName());
        return AK_INVALID_PLAYING_ID;
    }

    if (UNLIKELY(!AudioDevice->IsInitialized()))
    {
        UE_LOG(LogAkAudio, Verbose, TEXT("Failed to post AkAudioEvent '%s' with the Sound Engine uninitialized."), *GetName());
        return AK_INVALID_PLAYING_ID;
    }

    auto* SoundEngine = IWwiseSoundEngineAPI::Get();
    if (UNLIKELY(!SoundEngine))
    {
        UE_LOG(LogAkAudio, Warning, TEXT("Failed to post AkAudioEvent '%s' without a Sound Engine."), *GetName());
        return AK_INVALID_PLAYING_ID;
    }

    auto* ExternalSourceManager = IWwiseExternalSourceManager::Get();
    if (UNLIKELY(!ExternalSourceManager))
    {
        UE_LOG(LogAkAudio, Warning, TEXT("Failed to post AkAudioEvent '%s' without the External Source Manager."), *GetName());
        return AK_INVALID_PLAYING_ID;
    }

    AkTimeMs CurrentPosition = 0;
    auto Result = SoundEngine->GetSourcePlayPosition(PlayingID, &CurrentPosition);
    if (Result == AK_Success)
    {
        return CurrentPosition;
    }
    else
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, TEXT("GetSourcePlayPosition FAILED!"), false);
        return -1;
    }
}

Sico Y. (160 ポイント)
...