Hello,
i have been working intensively in fmod in the last few days and so far i have achieved results that are actually very satisfying.
However, I have now encountered a first minor problem. I try to implement rain sounds.
See here:
Unfortunately the weather changes in X-Plane immediately without a smooth transition. Do you know a possibility in fmod that the parameters are taken over with a longer time delay? When the weather changes from precipitation to no precipitation I want the rain to stop slowly.
I have written my own little "rain script" over xlua, which creates a new dataref and "follows" the actual precipitation with a delay.
----------------------------------- LOCATE AND/OR CREATE DATAREFS -----------------------------------
precipitation_on_aircraft_ratio = find_dataref("sim/weather/precipitation_on_aircraft_ratio")
delay_precipitation = create_dataref("sim/weather/delay_precipitation", "number")
precipitation = create_dataref("sim/weather/precipitation", "number")
precipitation_direction = create_dataref("sim/weather/precipitation_direction", "number")
----------------------------------- RUNTIME CODE -----------------------------------
function before_physics()
if precipitation_on_aircraft_ratio <= precipitation then
precipitation_direction = -1
else
precipitation_direction = 1
end
if precipitation_on_aircraft_ratio > 0 then
delay_precipitation = precipitation + (precipitation_direction * ((SIM_PERIOD / 6) * precipitation_on_aircraft_ratio))
elseif precipitation >= 0.01 then
delay_precipitation = precipitation - (SIM_PERIOD / 3) * 0.1
else
delay_precipitation = 0
end
end
function after_physics()
precipitation = delay_precipitation
end
Now I could achieve the following result:
But I feel it is a waste of resources to run extra xlua scripts for such small things like smoothing the change of the intensity of the precipitation.
Does anyone of you have a good idea how to do this in fmod without external scripts?
Thank you very much and best regards
Philip