Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. Contact Sales if your project requires a support plan.

How to use AK::SoundEngine::SetRTPCValueByPlayingID without getting an error

0 votes

We are not able to use AK::SoundEngine::SetRTPCValueByPlayingID without getting an error.

Let me describe the use case:

  1. Trigger a sound, register for the end of event callback, and keep the playing ID
  2. Each game frame call AK::SoundEngine::SetRTPCValueByPlayingID to update the RTPC

The callback that will tell us that the sound is finished is being queued by our game engine to be processed on the game thread. Hence, the last time we call AK::SoundEngine::SetRTPCValueByPlayingID we always receive an error that the sound is not playing anymore. The next frame the callback is being processed by the game engine (that was queued), so we eventually stop trying updating the RTPC but one frame too late.


For sure, I could try to not use my system that process the callback on the game thread and do something custom for when I call SetRTPCValueByPlayingID but I find it is a lot of work. Also, I don't care that much to send one extra RPTC value to garbage (this would be better than getting an error each time we use SetRTPCByPlayingID.


Would it be possible to not output an error message when using SetRTPCValueByPlayingID? At least add add a new error type, so we can decide to mute this error in the output log of our game. Is there a way to mute specific errors in the Wwise profiler. If not, that would partially solve our problem.


My current solution to mute the error is to call AK::SoundEngine::Query::GetPlayingIDsFromGameObject prior to AK::SoundEngine::SetRTPCValueByPlayingID, so I can know if the sound has just finished playing or not. However, I don't find the solution optimal.


Also, I was wondering why the SetRTPCValueByPlayingID function is doing a lock to find the game object.  AK::SoundEngine::SeekOnEvent doesn't do that and we just pass the game object id.




asked Apr 4, 2018 in General Discussion by Stéphane B. (200 points)

Please sign-in or register to answer this question.