I’m trying to get multiple listeners to behave correctly in a 3D split-screen multiplayer game.
Each of the cameras in the scene has its own listener component. However, only the sound that the last added listener is hearing is being played at runtime. The other listeners are simply ignored. What should I do?
All existing threads on this topic are outdated, so I’m afraid I had to make a new one for Fmod 2.0.
Are you seeing any errors or warnings in the console log?
Are you assigning a different listener index on the StudioListener component for each of the listeners?
Yes, I am. But as soon as I assign any number greater than zero, I’m getting this error:
[FMOD] assert : assertion: 'listener >= 0 && listener < numlisteners' failed
FMODUnity.RuntimeManager:DEBUG_CALLBACK(DEBUG_FLAGS, StringWrapper, Int32, StringWrapper, StringWrapper) (at Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs:28)
FMOD.Studio.System:setListenerAttributes(Int32, ATTRIBUTES_3D) (at Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs:553)
FMODUnity.RuntimeManager:SetListenerLocation(Int32, GameObject, Rigidbody2D) (at Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs:934)
FMODUnity.StudioListener:SetListenerLocation() (at Assets/Plugins/FMOD/src/Runtime/StudioListener.cs:40)
FMODUnity.StudioListener:Update() (at Assets/Plugins/FMOD/src/Runtime/StudioListener.cs:29)
Another thing I noticed is that the user can effectively assign nine different numbers to the index of the Studio Listener component, if you include the zero. However, as far as I am aware, the maximum number of listeners is eight. Should the zero never be used then if there’s more than one listener in a scene? Or should the eight be ignored because it’s one too many?
Both of these issues have already been resolved for the next release, 1.10.13 & 2.00.01.
The first listener should always be index zero, the ninth (index 8) listener will fail to be set, as it should only go up to 8 (0-7).
We will likely change this in a 2.0 patch so that the integration assigns a listener index rather than the user having to specify it.
I’m eagerly awaiting the update then. I doubt you could give me an ETA, but I’ll be checking your github every day, and then eventually (hopefully) I can mark this thread as solved.
Edit: Done. Everything is now working as expected.