I'm trying to grab the Wwise SFX bands in UE5.5 and subsequently visualize him, and I know he needs to use the
AK::SoundEngine::GetSourcePlayPosition
as well as initializing the sound Engine , I've done most of the things but the code always returns AK_PlayingIDNotFound in the Can you help me to solve why?
This is my SoundSubSystem
void UWwiseSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
//Init Memory Engine
AkMemSettings MemSettings;
AK::MemoryMgr::GetDefaultSettings(MemSettings);
AK::MemoryMgr::Init(&MemSettings);
AkStreamMgrSettings StreamMgrSettings;
AK::StreamMgr::GetDefaultSettings(StreamMgrSettings);
AK::StreamMgr::Create(StreamMgrSettings);
AkInitSettings InitSettings;
AkPlatformInitSettings PlatformInitSettings;
AK::SoundEngine::GetDefaultInitSettings(InitSettings);
AK::SoundEngine::GetDefaultPlatformInitSettings(PlatformInitSettings);
AKRESULT Result = AK::SoundEngine::Init(&InitSettings, &PlatformInitSettings);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Init Sound Engine : %d"), Result));
}
This is my Component.
int32 UWwiseComponent::GetWwisePlayPosition(int32 playingID)
{
if (playingID == AK_INVALID_PLAYING_ID)
{
UE_LOG(LogTemp, Error, TEXT("Invalid playing ID."));
return -1;
}
if (!AK::SoundEngine::IsInitialized())
{
UE_LOG(LogTemp, Error, TEXT("Wwise Sound Engine is not initialized."));
return -1;
}
AkPlayingID playID = playingID;
AkTimeMs position = 0;
auto result = AK::SoundEngine::GetSourcePlayPosition(playID, &position);
if (result != AK_Success)
{
UE_LOG(LogTemp, Error, TEXT("Failed to get position for Playing ID: %d. Error: %d"), playingID, result);
return result;
}
UE_LOG(LogTemp, Log, TEXT("Current Play Position for Playing ID %d: %d ms"), playingID, position);
return position;