fix thread contention for audio tweens

pull/47/head
cosmonaut 2023-03-06 11:13:13 -08:00
parent 0d441ae07a
commit 0781a99273
1 changed files with 9 additions and 9 deletions

View File

@ -194,17 +194,17 @@ namespace MoonWorks.Audio
float end,
float duration
) {
var tween = AudioTweenPool.Obtain();
tween.SoundInstanceReference = new WeakReference<SoundInstance>(soundInstance);
tween.Property = property;
tween.EasingFunction = easingFunction;
tween.Start = start;
tween.End = end;
tween.Duration = duration;
tween.Time = 0;
lock (StateLock)
{
var tween = AudioTweenPool.Obtain();
tween.SoundInstanceReference = new WeakReference<SoundInstance>(soundInstance);
tween.Property = property;
tween.EasingFunction = easingFunction;
tween.Start = start;
tween.End = end;
tween.Duration = duration;
tween.Time = 0;
AudioTweens.Add(tween);
}
}