From 922ba9ed5c8f028ec37100ab9afbf83a7cf12cf8 Mon Sep 17 00:00:00 2001 From: Isse Date: Wed, 3 May 2023 16:15:28 +0200 Subject: [PATCH] add note about using threshold for subtitle duration --- voxygen/src/audio/mod.rs | 3 +++ voxygen/src/hud/subtitles.rs | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/voxygen/src/audio/mod.rs b/voxygen/src/audio/mod.rs index 7a08785a8f..533ad6a47b 100644 --- a/voxygen/src/audio/mod.rs +++ b/voxygen/src/audio/mod.rs @@ -255,6 +255,9 @@ impl AudioFrontend { }, }; + // NOTE: Threshold here is meant to give subtitles some idea of the duration of + // the audio, it doesn't have to be perfect but in the future, if possible we + // might want to switch it out for the actual duration. (file, item.threshold, item.subtitle.as_deref()) }) } diff --git a/voxygen/src/hud/subtitles.rs b/voxygen/src/hud/subtitles.rs index 97e9fe968c..70d15ed61f 100644 --- a/voxygen/src/hud/subtitles.rs +++ b/voxygen/src/hud/subtitles.rs @@ -289,9 +289,7 @@ impl<'a> Widget for Subtitles<'a> { subtitles .subtitles .iter() - .filter_map(|(localization, data)| { - Some((localization, data.last()?)) - }) + .filter_map(|(localization, data)| Some((localization, data.last()?))) .filter(|(_, data)| { data.position.map_or(true, |pos| { pos.distance_squared(listener_pos)