- driver_mode::push_editor() stops the singing before the editor is pushed, by F11 and by the edit session. push_mode()
doesn't call exit() of the mode it covers, so the loops went on playing in the editor. Back in the driver mode the
next update scans the rails again.
- The sound of the singing isn't made in the test mode, which has no sound (enter() skips begin()); update() is under
the test-mode guard of staging since the merge.
- sound.railsinging.nearboost: a train within 40 m is louder by it, one at 40-100 m by a part of it growing as it comes,
as closeness() has it; the comment said within 100 m.
- Sonar, the values unchanged: the measured levels written as floats (each the same float as before, checked for all
232), the centres of the sixths of an octave counted in a while loop, CTAD, try_emplace, the flag of the sound made with
the default ordering, an if without a variable, using enum in a test. The std::mt19937 of the noise is NOSONAR: the
noise of a sound, the same for a seed on every compiler.
Making the sound took about 0.8 s on the main thread at the first frame of
driving, which stalled the game once. It's now made on a std::jthread
started when the driving mode is entered, and handed to the audio on the
main thread once it's done; until then the effect is silent.
The making itself is a little quicker too (0.68 s in RelWithDebInfo): the
spectrum is smoothed over the sixths of an octave in one pass, the levels
the plums and the voice are set against come from one spectrum, and dB
are turned into amplitudes with exp rather than pow. The sound made is the
same.
A listener by the track hears the rail next to them hiss before a train
arrives: the wheels set the rail vibrating and the bending waves run along
the steel far ahead of the train. The rail nearest the listener now gives
this sound for the trains along it, as far as the way along the rails lets
it through.
The sound is made in code when first needed, so no asset is needed. It's
built from a recording of rail singing: noise of its measured spectrum (a
table of levels every 1/24 octave), close tones near 1.2-1.5 kHz that
swell together now and then, a calm ring near 7.84 kHz, short tones
falling from about 1.3 to 0.9 kHz now and then, and, for a train within
100 m, steady tones near 5 and 6 kHz measured under a passing train. The
parts are six looped buffers, played by sources placed on the rail where
it's nearest the listener.
The volume follows the way along the rails, walked through the switches as
they are set: the rail takes 0.02 dB/m, each joint 0.5 dB (from the
existing sound distance of the track, so jointed track carries it a much
shorter way), each switch 3 dB. The sound comes in from 1500 m, faster as
the train nears, in full from 100 m, and 6 dB louder within 100 m. It
grows with the speed and with the mean axle load of the consist, so a
draisine hardly sings. The listener's own consist isn't heard from the
rails.
eu07.ini: sound.railsinging (yes) turns it off, and sound.railsinging.volume
(0.45), .range (1500 m), .full (100 m), .decay (0.02 dB/m) and .nearboost
(6 dB) tune it. With sound.railsinging no the simulator behaves as before.
No format changes, no SVN changes.