Handle SFXs
Fcornaire opened this issue · comments
When a SFX is played, a SoundEffectInstance
is created then played
We can grab all of SoundEffectInstance
created to save them somewhere to be able to stop it when needed
The real problem come to when a Rollback happen.
Let's admit we save the SoundEffectInstance
related to an archer in the game state, we should at least save the time played and what SFX being played
The real problem come to how to restore a SoundEffectInstance
to a specific time ?
Look likes SoundEffectInstance
has a FAudioVoiceState
with SamplesPlayed
being the value we want but trying to modify it that value crash the game
So if anyone has an idea how to fast forward a SoundEffectInstance
using FAudio 😅
(there is this branch that started something https://github.com/Fcornaire/TF.EX/tree/feature/track-sfx)
Found a solution based on johanhelsing article and Mike Z article
This should be enough to handle multiple SFX and much simpler to implement anyway
Fixed in #47
Not perfect (need to deal with intentionnal multiple SFX on the same frame + remove sfx GameState hack)