版本
menu_open

Limiting Object Playback Instances

To deal with limited game resources or game-design constraints, you must optimize the sounds, music, and motion objects that are playing at any one point in the game. You can manage the simultaneous playback of the various objects in your project using three different methods:

  • Limit the number of sound, music, and/or motion instances that can be played per game object or globally on an Actor-Mixer Hierarchy object.

  • Limit the overall number of sound, music, and/or music instances that can pass through a bus.

  • Limit the overall number of sound, music, and/or music instances in the entire game.

When either limit is reached, Wwise uses the priority setting of the object to determine which one to discard based on the selected behavior to adopt when the limit is reached. If objects have equal priority, you have the option to discard the newest or oldest instance that is playing.

When you set a playback limit at the Actor-Mixer or Interactive Music level, you control the number of instances within the same structure that can be played either globally or per game object. If a child object overrides the playback limit set at the parent level, the total number of instances that can play is equal to the sum of all limits defined within the structure. This means that if, for example, you have a parent with a limit of 20 and a child with a limit of 10, the total possible number of instances is 30.

When you set the playback limit at the Master-Mixer level, it specifies the number of sound, music, and/or motion instances that can pass through the bus at any one time. Since the priority of each object has already been specified at the Actor-Mixer or Interactive Music level, there is no playback priority setting for busses.

When you set the playback limit at the project/game level, it specifies the number of sound, music, and/or motion instances that can be active at any one time. Each sound will adopt its own Virtual Voice behavior set in its Advanced Settings.

To define a playback limit:

  1. Load a top-level parent object into the Property Editor.

  2. Switch to the Advanced Settings tab.

    [Note] Note

    If the object is not a top-level object, you must select the Override parent option before you can set the Playback Limit options.

  3. In the Playback Limit group box, select the Limit sound instances to x option.

    The playback limit options become available.

  4. In the corresponding text box, type the maximum number of instances that can be played simultaneously per game object.

  5. To define the scope for the playback limit select one of the following options:

    Global to apply the limit globally.

    Per game object to apply the limit per game object.

    [Note] Note

    This option is not available on busses because the limit is always global.

  6. To determine what happens when the playback is reached, select one of the following options:

    Kill voice to stop the playing instance with the lowest priority.

    Use virtual settings to adopt the defined virtual voice behavior for the sounds. The virtual sounds behaviors include: kill, send to virtual voice, and continue to play.

  7. To determine what happens when the playback limit is reached and there is more than one sound, music, or motion object with the lowest priority, select one of the following options from the When limit is reached and priority is equal list:

    Discard oldest instance to stop the oldest playing instance with the lowest priority.

    Discard newest instance to stop the newest playing instance with the lowest priority.

  8. The Project/Game limit can be modified in Wwise project settings, per platform. It may also be changed by the game using the Wwise SDK API once the sound engine is properly initialized.

When working with voice limitation system, it is good to know the following:

  • Virtual voices do not count as valid voices.

  • Sounds with the virtual voice setting set to “Continue to play” may cause the limit to be exceeded.

For example, let us suppose you have:

  • A limit on bus set to 4 simultaneous sounds.

  • The “Over limit behavior” on this bus is set to “Use virtual voice behavior”.

  • The Volume threshold is set to -60 dB.

  • You have 8 voices playing at this frame in this bus.

Sound name

Priority

Volume

Virtual Behavior

Sound_1

100

0 dB

Go Virtual

Sound_2

90

-90 dB

Go Virtual

Sound_3

80

-90 dB

Continue to play

Sound_4

70

0 dB

Go Virtual

Sound_5

60

0 dB

Kill voice

Sound_6

50

0 dB

Kill voice

Sound_7

40

0 dB

Go Virtual

Sound_8

30

0 dB

Continue to play

The result would be:

Sound name

Result

Reason

Sound_1

Play (1/4)

Highest priority and over volume threshold.

Sound_2

Will go virtual

Volume under threshold.

Sound_3

Play (2/4)

Continues to play even when under volume threshold.

Sound_4

Play (3/4)

-

Sound_5

Play (4/4)

-

Sound_6

Will be killed

Over limit, already 4 sounds with higher priority are playing

Sound_7

Will go virtual

Over limit, already 4 sounds with higher priority are playing

Sound_8

Play (5/4)*

*Will play even if the limit is exceeded, this is a special situation where this sound is not allowed to go virtual nor be killed, and is not allowed to take over the 4 sounds already playing with a higher priority.

FAQ

Q: The limit does not seem to be working? Why?

A: Check if the sound's virtual behavior is not set to “Continue to play”, it is the default value for compatibility reasons. Any sound with this setting will not be kicked nor virtualized when over the limit (unless the over limit behavior was set to kill voice explicitly). Once you start using the “Use Virtual Voice settings” when over the limit, you must set this setting for any sound that would be considered “kickable” or “virtualizable” to start saving some CPU.


Q: The limit seems to be working most of the time but the profiler sometimes shows values that are over the specified limit even if none of these sounds are set to “Continue to play”.

A: When sounds are becoming virtual, they stay active for a few ms (one audio frame) to fade out and avoid clicking. For example, if the limit is set to 1 and one sound is already playing, then another sound pops in with a higher priority, the number of active voice will temporarily be to 2 while the first sound is fading out to go virtual.


Q: Why is sending to virtual voices not the default setting when over limit? Why are all sounds set to continue to play by default?

A: Some source codec may not be perfectly accurate in virtual mode and/or could require a seek table to be added in the source to be able to work in virtual voice: play from elapsed time. For this reason and to ensure that everything runs fine by default, this is not the default setting. For example, Vorbis will require a seek table to be able to properly adopt a virtual behavior with the From Elapsed time setting.


此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅