I’m working on (what I thought would be) a simple blueprint. What I would like to happen is every time the active camera changes, the audio will be heard from the cameras position. It works for the first camera, but then the next 3 cameras have no audio. Even if I use “Clear Audio Listener Override” (which appears to do nothing) it still does not work.
Here is a quick example from my blueprint. (It is currently set to cycle through the cameras.)
I have found out what’s happening partly. The attenuation of the sound was not large enough to reach the listener. But I still have a problem.
I have, sort of, solved it. It seems that if a sound starts playing before you use “Set Audio Listener Override” then it won’t be heard. BUT if I change the attenuation to have a large falloff distance, as long as it overlaps one of the previously set locations, then it will be heard.
Once again, am I going about this the right way? is there a correct way? is there a different/better way? is there a tutorial video I can’t find?
Yes you going the right way.
However are you using that new sound mixer/system (meta sounds), or plain old subsystem for it?
It could have been fixed in metasounds.
If that does not work i have idea for workaound:
use multiple pawns for cameras, instead just camera.
make pawn that has camera only (and maybe listener in)
then unposses and posses pawns. This could work properly with sound sources.
I’m not using meta sound, might have to look into it.
I made every camera its own actor and gave it a smaller blueprint. Then I made another actor which gets all of those cameras into an Array and calls the code on each one when needed. It was still not working but I booted up my project today and its all working now. I’m afraid to move anything in case it stops working again. No idea how, it might just be a bug of some kind.
Here is the blueprints in case anyone is interested
In such situation of working and not working, check if this works or not in standalone, then packaged game. Editor does a lot of dodgy stuff (to keep stability for when you develop), but bad consequences of it is that usually some stuff that works in editor (and no error messages) does not work in standalone/packaged game. So you must test it before such errors pile up.
Also i recommend you track that bug and see why it is working and not working, less hassle later.
I figured out if I made a custom sound attenuation class with a large enough falloff radius, so that it reaches the previous listener position, it will be picked up by the listener before the change, so when it changes it works properly. I don’t know why this works like this, but it does.