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. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

How to limit Music playback to 1 while retaining loops intact?

+3 votes
I am using the "Limit sound instances to 1" on my Music Containers to avoid multiple Music tracks to play on top of each other if the player crosses the trigger multiple times. (As detailed in the following Q&A:

However, it seems that Wwise requires the Sound instances limit be set to a higher number for it to process the loops correctly (especially using pre-entry and post-exit points).

How can I achieve both of these behaviors at the same time?
asked Mar 26, 2015 in General Discussion by Antoine V. (170 points)
I would also love to know about this.

1 Answer

0 votes
This is a difficult issue and one that I have experienced. The solution I am about to explain, I have not tested, though I will be using it soon to see.

The solution is to implement the music as if it is one long chain of switch changes. The "play music" event only ever happens once and it's at the beginning of the game. When new music is required, the switch is changed. The benefit is that, if the interactive music engine is already on switch A, and receives an event to go to switch A again, it does nothing.

 I'm guessing that your trigger has a play action in the event. Can you change the event to use a switch instead?
answered Mar 27, 2015 by Daniel Beck (370 points)
Hi Daniel,
Thanks for your answer!
This makes sense and seems to be a viable solution.
The only problem I could foresee with this, is that since we're already using states to dynamically change the music following various in-game events, adding another switch container to direct area-related music changes might be a bit convoluted. I'm especially wondering if that's the most memory-friendly solution!
Yup, Daniel's answer is solid, and this is how music in Wwise should be structured. One master play action, and switch to different playlists.  
Memory is usually never a concern with music since it is streamed.

Thanks for posting, Daniel!
Great, thanks! I've already started setting up this method, however, I'm encountering some problems related to transitions when using pre-entries.

When the Source Segment contains a pre-entry, the "Exit source at: Immediate" doesn't work as it should, it instead waits until the pre-entry is done playing before switching.
This creates a problem as the source's pre-entry will continue playing on top of the destination segment.
Furthermore, if the switch is set again to its originale value, the same pre-entry segment will be triggered again (on top of the last one if it had not done playing).

Is there any way around this? Thank you!