Hi all,
I have an AmbientSound actor in my scene, being attenuated and playing a 10 minutes sound.
When the player comes in the sound zone, it starts as expected. When he leaves it stops, that’s fine.
But when the player comes back, the sound restart from the beginning !
I’d like to keep the sound “playing” (but silently), so that when the player is back, it sounds like it continued playing on his own (just like it would in real life).
It isn’t ideal but I think that the only way to achieve this currently would be to set your sound to ‘Always Play’ via its Sound Class. This will ensure that the sound won’t actually stop if it becomes inaudible. This does use up an extra channel for a sound that you won’t be able to hear though.
We don’t currently have a system that allows us to make sounds virtual, so that only their current time is advanced. You could perhaps set up a system to do that yourself, by getting the current time of the sound as you stop it and when you start the sound again set the Start Time to begin part way through the sound.
There is a MaxChannels value that can be set in your engine config ini, which defaults to 32. It should only ever really be a problem if you set a lot of sounds to always play at once, which would force other sounds you might expect to hear to not play.
Sound Classes are assets that you can set on any sound, there are some default ones that come with the engine but you will have to enable the ‘Show Engine Content’ switch in the Content Browser View Options for them to show up. For example if you wanted to ensure that sounds tagged with the default voice Sound Class always play, open the asset and change this value:
Is the maximum of 32 channels restricted across different levels? In other words - using this method, if there are a large amount of concurrent sounds playing in different streaming levels will all of them be included in the maximum 32 channels?
Instead of resuming just re-launch the sound once the player is at a certain distance.
You can also possibly write a small functionality that save the time the sound stopped playing and the current play position, then when the player is near enough it will take the current time, subtract the saved time, and figure out at what position to play the sound again.
his solution might be valid, but that does not men my technique is bad, it’s a cheap workaround, you just stop and sound and play it again when in range