branchrust_reboot/main/soundmodulator_leakcancel
80 Commits over 91 Days - 0.04cph!
Bugfix: Avoid double-recycle of sounds when pooling is disabled
- switched to checking recycle time
it used to rely on whether fade modulator was present or not as a flag, which doesn't work when pooling is disabled. And we can double-recycle now via NotifyOnParentDestroying and OnDisable
Tests: none, but super-confident about the theory
Merge: from main
Tests: none, trivial merge
Update: disable client-side sound pooling
- Gives us time to track down the missing bad-pooling scenario
Tests: on Craggy ran around, rode the zipline, hunted animals. Also left it to stew for a bit - no exceptions
Update: simplify MagnetCrane's audio handling
- this is an experiemental change, as in theory it should help stuttering audio, but couldn't validate in practice
Tests: while connected to a local staging server moved the arm and rotated the cabin(though I couldn't reproduce the original issue anyway)
Merge: from main
Tests: none, no conflicts
Merge: from main
Tests: Booted editor - no errors
Update: drop sound instances for variety of types on disable
- HarborBridge
- HarborCrane
- PhoneDialler
Tests: none, trivial changes
Bugfix: Stop DigitalClock from leaking sound instances when it's flags change
- Also dropping sound refs on disable
Tests: none, trivial change
Update: drop sound refs when vehicles are destroyed
- Magnet Crane
- MLRS
- Modularcar Garage
- VehicleModuleSeating
- Traincar audio
Tests: none, trivial changes
Update: drop sound refs when ScrapTransportHelicopter is destroyed
Tests: none, trivial change
Clean: removing empty override method
Tests: none, trivial change
Update: drop sound refs when AttackHelicopter is destroyed
Tests: none, trivial change
Update: drop sound references when ground vehicle is disabled
Tests: rode a pedal bike, jumped of and destroyed it with console commands - saw expected debug log
Undo: of the previous undo to ensure we don't hold dangling references
Although the resources are cleaned up, the pointers are not so we end up with stale pointers on entity recycle
Tests: none, trivial undo
Undo: Partial undo of recent work to remove unnecessary DoClientDestroy callbacks
- Turns out we already invoke cleanup for sounds that are attached to network entities - meaning we don't need to manually handle it in these cases.
Was confused why pedal bike wasn't leaking it's sounds on destroy, and tracked it down to above mechanism.
Tests: Tested compound bow and flamethrower still work and don't leak sounds
Update: recylce RotateWhenOn's sound loop
Tests: none, trivial change
Update: sanity-recycle sounds when procedural lift is disabled
Tests: none, trivial change
Update: recycle SpinUp layer sounds on disable
Tests: none, trivial change
Bugfix: Flamethrower now works if continuing fire after quickswitching
Tests: in editor, did normal firing with quickswitching intermixed
Bugfix: Flamethrower sounds leaking or missing, pt1
- Recycle sounds when destroyed or holstered
- Start play pilot sound on deploy (used to only take effect after firing)
- Cleaned up a bunch of comments and whitespaces
There's one more bug to do with holding the fire button while quick switching away and back to flamethrower, that's next.
Tests: in editor fired and quick-switched away then monitored audio.printsounds
Bugfix: fixing misplaced call in CompoundBow
Tests: none, trivial change
Bugfix: avoid leaking compound bow sound loop
- Also added sound recycle on destroy
It was just one instance that would be cleaned up on switch-back to bow per player.
Tests: in editor pulled the bow till max, quick-switched away, checked via audio.printsounds that it was gone
Update: recycle sounds when destroying a BaseLiquidVessel
Tests: none, trivial change
Update: recycle sounds when PhoneController is destroyed
Tests: none, trivial change
Update: recycle sound when MobileInventoryEntity is disabled
Tests: none, trivial change
Update: recycle sounds when RadiationOverlay is disabled
Tests: none, trivial change
Update: recycle sounds on SoundFollowCollider disable
Tests: none, trivial change
Update: CoalingTower stops it's effects on client side
Shouldn't have any effect now since we don't despawn them, but will avoid pooling issues in the future if we suddenly start
Tests: none, trivial change
Merge: from main
Tests: Rode the zipline on craggy back and forward, ran around the island and monitored pooling logs
Merge: from main
Tests: none
Merge: from main
Tests: none
Update: enable sound pooling by default
If something goes derp, can be disabled via audio.enablesoundpooling 0
Tests: was explicitly enabled over last 3 days while running all recent changes
Merge: from main
Tests: ran around on craggy with logs
Bugfix: don't leak looping sounds when quick-switching
It's possible that equipped items with sound effects (setup via sound player) can enable-then-disable across 2 frames, before SoundManager picks up the pending play request. If it's a looping sound(like torches burn loop) it would stay alive forever. Now we cleanup the pending requests on disable of sound player.
Tests: mousewheel quickswitched between rock and a torch and observed numbers in audio.printsounds - the burn loop is no longer accumulating.
Update: SoundManager pools internal lists
The pooling effect is minimal, but it achieves 2 small improvements:
- we don't hold lists in memory for sounds that don't reapper for a while - those can be reused in other parts of the code
- audio.printsounds no longer reports 0 active sounds per definintion
Tests: On craggy quickswitched between equipped items. Saw the various sounds appear and disapper in the logs.
Update: microphone drops any sounds it has accumulated on destroy
Tests: tested by playing the flute when exploding the microphone stand connected to a speaker
Update: MiningQuarry drops sound assets when destoyed (though it's invulnerable)
Tests: none, trivial change (same type of changes as previous)
Update: modular car's engine drops all sound resources on disable
Tests: blew up a modular car
Update: AmbianceWaveSounds recycles sounds on disable
Tests: none targetted(same type of change as before), but have been live on my branch for 2d while testing and working on other changes.
Update: Engine blend loop drops it's sound resources on disable
Tests: none, trivial change (same type of change as previous)
Update: Tree now drops it's sound resources on client destruction
- It also drops the Gain mod when fading out sound loop during fall
Tests: cut down a tree, saw relevant audio events in logs
Update: Traveling Vendor drops it's sound resources on client destruction
Tests: none, trivial change (same type of change as previous)
Update: Parachute and Sled drop their sound resources on destroy
Tests: none, trivial changes (same type of change as previous)
Update: CCTV and SpinnerWheel drop their sound resources on disable/destroy
Tests: none, trivial change (same type of change as previous)
Update: Sub, Snowmobile, Tugboar and Train drop their sound resources on disable/kill
- In Snowmobile's case Ski audio was previously (accidentally?) retained when sim stopped
- Train engine used to retain damage and engine reflection sounds (assume an accident/bug)
Tests: none, trivial changes (same type of changes as previously)
Update: CargoShip drops sounds resources on disable
- Also added a couple convenience StopXSound methods, since it has a bunch of different sounds.
Tests: none, trivial change (same type of change as before)
Update: Ferry drops it's sound resources when disabled
Tests: none, trivial change (same type of change as previous)
Bugfix: PatrolHeli now releases modulators alongside the sounds
Tests: none, trivial change
Bugfix: Drone now releases pitch modulator on destruction
Tests: none, trivial change
Update: Modular Vehicle drops sound resources on destruction
Tests: plugged in engine comps on Craggy's spawned vehicle, drove around in it. Put some timed c4 and drove until explosion - confirmed resources got released via logs.