Positional AudioNodes not audible by second cam


I created a splitscreen game by cloning the original cam:

Camera cam2 = this.cam.clone();
this.cam.setViewPort( 0.0f , 1f, 0.0f, 0.5f);
cam2.setViewPort( 0.0f , 1f, 0.51f, 1f);
cam2.resize(this.settings.getWidth(), this.settings.getHeight(), true);
cam.resize(this.settings.getWidth(), this.settings.getHeight(), true);

and create a new viewport for it:
this.view2 = renderManager.createMainView(“View of camera 2”, cam2);
this.view2.setClearFlags(false, true, false);

each cam follows a vehicle. This seems to works fine.
But booth vehicles got AudioNodes which are set to positional and
they are only audible when near the original cam.
What have I forgotten to make them audible for booth?

You need to update the application AudioListener to your camera location. Listener (jMonkeyEngine3). That being said, I don’t know how one could feed two cameras in it? Your application class (i.e. SimpleApp) has this listener and also you can access the AudioRenderer to get the AudioListener.

yes, like you say: the listener seems to have only one Location. And in the AudioRenderer I can just set or update the listener and not add a new one as second listener.
But I hope there is a way.

There is only one listener… there is only one set of speakers. You can put the listener wherever you want. You don’t have to use the default camera-based listeners.

Perhaps ambient (non-positional) audio would make more sense for this application.

yes, perhaps. I thought that too. It was just an initial thought, when booth cameras are zoomed out, you hear the cars and their crashes calm.

1 Like