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?