ValveSoftware / steam-audio

Steam Audio
https://valvesoftware.github.io/steam-audio/
Apache License 2.0
2.2k stars 152 forks source link

Fixed FMODStudioAudioEngineSource losing DSP every frame #360

Closed quentinleon closed 2 weeks ago

quentinleon commented 2 weeks ago

Currently, the eventInstance != mEventInstance check always returns true, causing mFoundDSP to be set to false for every emitter, each frame. As a result FindDSP() runs past the guard clause for every emitter in the main Update() loop. This creates kBs worth of garbage and performance losses with just a handful of audio sources.

Observed in Unity 2022.3.4f1, FMOD 2.01.07, and both Steam Audio 4.1.2 and 4.5.3

After changing eventInstance != mEventInstance to !eventInstance.Equals(mEventInstance), mFoundDSP remains true until either the fmodEventEmitter changes, or the underlying fmodEventInstance changes (which I assume is the intended behavior).

Tested in Unity 2022.3.4f1, FMOD 2.01.07, and Steam Audio 4.5.3