Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes

Let's say we have to play many short 3D events in random locations.

To do that, we:

1) create temporary SoundObj

2) set position to it

3) PostEvent to it

... renderAudio()...

4) handle AK_EndOfEvent  callback to delete temp SoundObj

Is it the best way?

Basically, I need something like PostEvent( eventId, AkSoundPos, ... ) without SoundObj

Thank you

in General Discussion by ILYA L. (190 points)

1 Answer

+1 vote
 
Best answer

The best way is slightly simpler, you don't have to wait for the Ak_EndOfEvent.

  1. temp = RegisterGameObj();
  2. SetPosition(temp, x,y,z)
  3. PostEvent
  4. UnregisterGameObj(temp);

RenderAudio could be called before or after the UnregisterGameObj, it doesn't matter.  UnregisterGameObj only marks the game object for destruction.  Wwise will keep it alive until all the sounds playing on it are finished.

by Mathieu J. (Audiokinetic) (7.1k points)
selected by ILYA L.
Thank you, Mathieu. it's good to know.
What about reusing temp object inplace?
i.e.
temp = RegisterGameObj();
SetPosition(temp, pos1)
PostEvent(event1, temp)
SetPosition(temp, pos2)
PostEvent(event2, temp)
UnregisterGameObj(temp);
...
renderAudio()
...

will event1 have pos1 and will event2 have pos2 in this case?
A game object can have only one position, both sounds will be posted at the same location (pos2).  Don't worry, a game object consumes very little resources.  As long as you don't spawn thousand of them concurrently, you won't hit any performance problem.
Thank you, Mathieu
You, AK guys, are the best when it comes to customer support.
Regards,
Ilya
...