menu
 

La section Questions et réponses de la communauté Audiokinetic est un forum où les utilisateurs de Wwise et de Strata peuvent poser des questions et répondre à celles des autres membres de la communauté. Si vous souhaitez obtenir une réponse de la part de l'équipe de soutien technique d'Audiokinetic, veillez à utiliser le formulaire de Tickets de Soutien.

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

dans General Discussion par ILYA L. (190 points)

1 Réponse

+1 vote
 
Meilleure réponse

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.

par Mathieu J. (Audiokinetic) (7.1k points)
sélectionné par 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
...