Audiokinetic Wwise Knowledge Base

Stopping sounds using Events or through code

Unregistering a game object does not stop the sounds that are attached to it. This is usually interesting for game objects that emit one shot sounds, as unregistering them will not cause unpleasant sharp cuts. However, this can be a potential source of bugs: for example, if you unregister a game object in which a sound that is set to "infinite looping" is playing, you will lose control of this sound forever, and will never be able to stop it later.

The Wwise paradigm encourages you to always use Events in order to control playback of audio. We purposely chose to limit programmer intervention, in order to increase artistic control and improve the overall efficiency of the production pipeline.

When using Wwise, programmers must use an event created in Wwise for any of the actions available in the Event manager, such as Play, Stop, Pause, Mute, and so on. Initially, this may impact the audio implementation phase of your development cycle because the sound designer must create the events (i.e. Kill Game object) and the programmer needs to trigger the Kill game object event each time he wants to unregister a game object.

Over the course of your production, however, you will see that this new way of working drastically reduces the number of interactions between the sound designer and the audio programmer. In a typical project, the sound designer will invariably come to the programmer with cases where he wants some sounds to continue playing when unregistering a game object, for example, the groaning of an enemy that is dying, the tail of an explosion, and so on. Traditionally, the programmer would have had to code something to let the groaning sound continue to play while the other sounds are stopped. In Wwise, however, the sound designer can simply change the action from Stop All to Stop All Except and then insert the groaning sound in the exception list. He may also use a Break action in order to gracefully end a looping sound or sequence of sounds.

From an artistic point of view, Wwise gives the sound designer the power to fine tune the fade out time and curve for the stopped sounds. All the back and forth between sound designer and programmer are now gone, because the sound designer can fine tune everything on his side without bothering the programmer. The risks are also reduced because changes to the event properties do not require any changes to the code.

Yet, some will prefer stopping all sounds associated to a game object programmatically before unregistering that game object. One reason could be to reduce the memory used by the metadata in game, as explained in the following article: http://kb.gowwise.com/questions/193/Tips to reduce memory usage.

In order to do so, you may use the API method to stop sounds either per events : ExecuteActionOnEvent(),  per game objects: StopAll(),  or directly per sound instance: StopPlayingID().




Article Details

Last Updated
4th o November, 2010

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit

Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?



Thank you for rating this answer.

Related Articles

No related articles were found.

Attachments

No attachments were found.

Continue