zaddo
New Member
Posts: 9
Posts: 9
|
Post by zaddo on Jul 8, 2021 12:29:31 GMT
Hi,
I have just started using Master Audio. I got background music up and running, but I am stuck trying to play a sound with PlaySound3DAtTransformAndForget.
As noob, I must be missing something basic, but I have gone through the youtube tutorials a few times and i can't see what I am missing.
here is a short video of the issue. I trigger the sound at the start of the video by clicking on the speaker in the inspector. Then I trigger the sound by shooting the barrel, but the explosion sound does not play through the speakers. However, the inspector seems to show that it is playing?
|
|
|
Post by DarkTonic Dev on Jul 8, 2021 16:06:11 GMT
It's fairly common. We cannot predict the size and scale of your Scene. What's happening is the default Audio Source Template has a Max Distance that's too small for the scale of your Scene, so nothing can be heard. You will need to use an Audio Source Template with a larger Max Distance. There are 7 included. From the Master Audio Mixer, you can apply progressively larger Audio Source Templates to all or selected groups.
For sounds that shouldn't even use 3D Sound, you can route them to a Bus that's "Force to 2D" and they won't have this issue.
|
|
zaddo
New Member
Posts: 9
Posts: 9
|
Post by zaddo on Jul 8, 2021 23:49:10 GMT
Fantastic :-) thank you for the prompt reply. I had this set to "Max Distance 1000". I have 9 scenes loaded in a grid each with one terrain tile 384x284. So total size of Terrain tiles is 1152. I will change the distance to "Max Distance 5000" and give it a go when I get home tonight. I read through the documentation on this property. But I don't really understand how it works and how it relates to my environment. I have a large open world, 15000x15000, the player (including audio listener) will move through the world and the game will progressively load and unload the scenes around them. I use World Streamer to reset the world origin to avoid floating point issues. How do I calculate the correct value for the Audio Source Template. I had assumed it was the maximum distance from the audio listener, the transform passed to the PlaySound3DAtTransformAndForget had a distance less than 5, well within the "Max Distance 1000" I had set, but could not be heard. Where is the distance measured from? is it measured from the Master Audio gameobject? If so, should I move the master audio gameobject with the player to ensure that the player is always at the center of the sound area? Thanks. Audio Source Template: Audio Source Templates are used to set up 3D settings and other Audio Source properties in bulk for many Sound Groups. All Variations in all Groups you create in the future will use the Audio Source Template you select here. There is a library of 4 in the folder: MasterAudio/Sources/Prefabs/AudioSourceTemplates. If you need more, you can add them in that folder or ask us to create them. Apply Audio Source Template to All: This button appears in the top row of the Mixer section. This will apply the selected template to all Sound Groups. There's also an option in Bulk Group Changes to apply the template to a whichever Sound Groups you select. Note: Groups created at runtime by a Dynamic Sound Group Creator will not use this setting. The Audio Sources will be copied from the Dynamic SGC as is when creating the temporary Groups.
|
|
|
Post by DarkTonic Dev on Jul 9, 2021 0:44:31 GMT
Correct, the max distance is the distance from the audio listener to the object making the sound (the Audio Source itself. Make sure you are playing the sound from the location of the caller.
To double check you don't have something fishy going on, force your entire mixer section to 2D and make sure you can hear it that way.
You can also turn on Log Sounds in Advanced Settings which will log any reasons why the sound isn't played (there are several).
The location of the master audio game object does not matter at all.
Does previewing Sound Groups work in play mode?
-Brian
|
|
zaddo
New Member
Posts: 9
Posts: 9
|
Post by zaddo on Jul 9, 2021 9:24:28 GMT
Appologies, it was my mistake. The PlaySound3DAtTransformAndForget call was running before I had moved the transform.
|
|
|
Post by DarkTonic Dev on Jul 9, 2021 21:15:13 GMT
In that case, you can use "PlaySound3dFollowTransformAndForget". The "Follow" variant will follow the transform around as the sound plays.
|
|