Closed Captions / Subtitles for Vintage Story.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adjust Audibility calculations and threshold.

For the bees.

+3 -3
+3 -3
ClosedCaptions/Caption.cs
··· 1 + using System; 1 2 using System.Collections.Generic; 2 - using System.Diagnostics; 3 3 using System.Linq; 4 4 using System.Reflection; 5 5 using Vintagestory.API.Client; ··· 10 10 11 11 public class Caption 12 12 { 13 - private const double AudibilityThreshold = 0.1; 13 + private const double AudibilityThreshold = 0.07; 14 14 private static Dictionary<string, LoadedCaptionData> _metadata; 15 15 private static ICoreClientAPI _api; 16 16 private static Queue<ILoadedSound> _activeSounds; ··· 86 86 if (dist > sound.Range) return; 87 87 88 88 // Ignore sounds that are out of earshot. 89 - var audibility = (1 - (dist / sound.Range)) * sound.Volume; 89 + var audibility = (float)Math.Pow((1 - (dist / sound.Range)), 0.5) * sound.Volume; 90 90 if (audibility < AudibilityThreshold) return; 91 91 92 92 // Ignore configured tags.