Multiple listeners for a multiplayer asymmetric Desktop / VR game

Hi!
In this project both the VR and desktop player are in the same scene and I would like some sounds to be heard only by the VR player, other sounds only by the desktop player and probably some sounds that both players are able to hear. Is it possible to assign different sounds to two different FMOD Studio Listeners? Any help would be appreciated!

There is a way to do what you want - but listeners are not the right tool for it. See, despite the name, a listener never actually receives or processes any audio. Rather, it’s just the set of coordinates used by events to calculate their built-in parameter values and the panning and attenuation that should be applied by their spatializing effects.

Instead, the way to ensure your VR and desktop players hear different events depends on whether they are using the same machine or two different machines.

If your VR and desktop players are both using the same machine, you want port buses. Port buses exist alongside the project master bus, and each port bus routes its output to a different audio device than a platform’s default speakers. You can create a port bus by right-clicking in the routing browser and selecting “New Port”; you’ll then want to set the port bus’ port type to the appropriate port bus type for the device in question. You can read more about port buses in our documentation on the topic.

If your VR and desktop players are actually using two different computers to play over a network, they’re actually each actually playing a separate copy of your game; it’s just that those instances of the game are communicating with each other over the network. Each of these instances of your game has its own game state, its own instance of the FMOD Engine, and its own list of playing events. That being the case, determining which events are audible to which player is just a matter of ensuring each player’s instance of your game only plays the events that that player is supposed to hear.

Thanks for your reply!
I forgot to mention it is a local multiplayer game, so both players are using the same machine. I guess I still need two listeners in the scene? I’ll take a look at the documentation, thanks!

Perhaps? Your game is using… Well, not split-screen multiplayer, but something very similar to it, and using multiple listeners is often useful in that situation. I recommend reading our documentation on the topic.

I found this old post where it’s advised to use two FMOD systems for accomplishing something similar to what I have intended:

Is this just a different way to accomplish the same result? (Sounds can be heard by only one of the players or by both player) Thanks again for providing information, it’s my first time using FMOD and it feels a little overwhelming setting up all this stuff (stll working on setting up just the vr sounds first…)

Yes and no.

Using two different FMOD systems has both advantages and disadvantages, because it works a lot like having two different instances of your game on two different devices (as I described in my first post in this thread), except with only one device and only one instance of your game: It means you’re running two separate instances of the FMOD Engine, each with its own mixer and list of playing events, which do not communicate with each other (though they do both receive commands from your game engine). This allows you to keep the content playing through each FMOD system entirely separate from the other - but on the other hand, it means you must keep the content playing through each FMOD Studio system entirely separate form the other.

This has a number of consequences. For example:

  • If you want an event to be audible to both of your players, you must load and play two separate instances of that event, and each will play through a separate instance of your mixer, potentially doubling your audio resource consumption. (Of course, events that are only audible to one player won’t be doubled, so in practice the actual resource consumption multiplier will vary between 1x and 2x.)
  • Events with random elements will sound different to each player, because each player’s instance of the system will likely generate different random numbers.
  • If you ever want both players’ audio to be audible together, the mix will be slightly harder to manage, because you will have to juggle two mixers instead of one.
  • It will not be possible to use sends, sidechains, or transciever effects to send audio signals from one player’s instance of the system to the other, which may constrain you from creating certain types of interaction.

On the plus side, using two separate instances of the FMOD system will allow you to keep your players’ events separate, exactly as you’re trying to do, without requiring the use of multiple listeners or port buses; and it will simplify the process of mixing and sound designing for your game.

Thanks for the additional information. I’m going to try the two port bus approach first (got enough on my hands with a single FMOD instance right now :sweat_smile: )