I am trying to create a game in which one player controls multiple drones, which they can switch between, and I would like to be able to show a sound meter for each drone, showing the volume of sound that drone can hear.
I can use a SpectrumAnalyzer to get the volume at the position of the currently active listener/camera, but I can't find any way of getting the volume as calculated at a different point to the active listener/camera.
There are only 2 drones initially for simplicity. In this example the player is controlling drone 0
As a workaround, i decided to set a timer, which runs every 1 second and does the following:
- Makes the listener on drone 1 active
- Measures the volume using the SpectrumAnalyzer
- Makes the listener on drone 0 active
But doing it this way means that the volume number always matches whatever your hearing, because it doesn't switch fast enough
Doing the same thing, but switching between listeners on each _process cycle, only measuring the volume on drone 1 (the one you're not controlling) gives the desired result, BUT, you can hear when it switches drones, so the sound you are actually hearing switches loud/quiet for a noticeable amount of time, maybe 0.5 seconds.
Does anyone know of any way to run this either fast enough that the time spent listening to the uncontrolled drone is unnoticeable, or (ideally) a way of measuring the volume at a specific listener without make it active?
Thanks in advance