Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

[UE4] Using SetRTPCValueByPlayingID?

0 votes

Edit:
I found the problem - inside the PostEventAtLocation stack, at FAkAudioDevice::PostEventAtLocation, line 2319 of the default UE4 integration code, the game object is unregistered, without giving us a chance to set RTPC values on it. Changing this post to feature requests so a variant of the PostEventAtLocation can be made that gives us control over this.
Thanks!

Hello!

How do I use SetRTPCValueByPlayingID? This was my approach and it's erroring:


// Post event (sound plays correctly)
static FString EventName = ""; // Don't know what to pass here
AkPlayingID PlayingID = UAkGameplayStatics::PostEventAtLocation(      // resulting PlayingID is not AK_INVALID_PLAYING_ID
    AudioEvent, // This is a valid UAkAudioEvent* type
    PlayLocation,
    FRotator::ZeroRotator,
    EventName,
    GetWorld()
);

 

// Set RTPC
if (FAkAudioDevice* AudioDevice = FAkAudioDevice::Get())
{
    const bool IsEventsPlayingIDActive = AudioDevice->IsPlayingIDActive(AudioEvent->ShortID, PlayingID);    // IsEventsPlayingIDActive is true

    
    AkRtpcID RTPC_Id = AudioDevice->GetIDFromString(FString("PlayerSpeed"));      // RTPC_Id reads 1493153371 and is not AK_INVALID_RTPC_ID
    AudioDevice->SetRTPCValueByPlayingID(RTPC_Id, My_RTCP_Value, PlayingID, 0);      
// This errors and prints "Unknown game object ID. Make sure the game object is registered before using it and do not use it once it was unregistered.: 2"
}

I don't know what to make of this error, what am I doing wrong? Is this even possible, or do I have to use an AkComponent?


 

asked Oct 2, 2021 in Feature Requests by Vioxtar (370 points)
edited Oct 2, 2021 by Vioxtar

1 Answer

0 votes
Hey, just for reference, you can use SpawnAkComponentAtLocation to solve this. It will allow you to set switches or RTPC values on the component, and then fire the event.
answered May 23, 2023 by Robert K. (140 points)
...